[
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "<!--\nThank you for reporting an issue!\n\nRemember, this issue tracker is for reporting issues ONLY with node-gyp.\n\nIf you have an issue installing a specific module, please file an issue on\nthat module's issue tracker (`npm issues modulename`). Open issue here only if\nyou are sure this is an issue with node-gyp, not with the module you are\ntrying to build.\n\nFill out the form below. We probably won't investigate an issue that does not\nprovide the basic information we require.\n\n-->\n\nPlease look thru your error log for the string `gyp info using node-gyp@` and if the version number is less than the [current release of node-gyp](https://github.com/nodejs/node-gyp/releases) then __please upgrade__ using the instructions at https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md and try your command again.\n\nRequests for help with [`node-sass` are very common](https://github.com/nodejs/node-gyp/issues?q=label%3A%22Node+Sass+--%3E+Dart+Sass%22). Please be aware that this package is deprecated, you should seek alternatives and avoid opening new issues about it here.\n\n* **Node Version**: <!-- `node -v` and `npm -v` -->\n* **Platform**: <!-- `uname -a` (UNIX), or `systeminfo | findstr /B /C:\"OS Name\" /C:\"OS Version\" /C:\"System Type\"` (Windows) -->\n* **Compiler**: <!-- `cc -v` (UNIX) or `msbuild /version & cl` (Windows) -->\n* **Module**: <!-- what you tried to build/install -->\n\n<details><summary>Verbose output (from npm or node-gyp):</summary>\n\n```\nPaste your log here, between the backticks. It can be:\n  - npm --verbose output,\n  - or contents of npm-debug.log,\n  - or output of node-gyp rebuild --verbose.\nInclude the command you were trying to run.\n\nThis should look like this:\n\n>npm --verbose\nnpm info it worked if it ends with ok\nnpm verb cli [\nnpm verb cli   'C:\\\\...\\\\node\\\\13.9.0\\\\x64\\\\node.exe',\nnpm verb cli   'C:\\\\...\\\\node\\\\13.9.0\\\\x64\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js',\nnpm verb cli   '--verbose'\nnpm verb cli ]\nnpm info using npm@6.13.7\nnpm info using node@v13.9.0\n\nUsage: npm <command>\n(...)\n```\n\n</details>\n\n<!-- Any further details -->\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "<!--\nThank you for your pull request. Please review the below requirements.\n\nContributor guide: https://github.com/nodejs/node/blob/main/CONTRIBUTING.md\n-->\n\n##### Checklist\n<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->\n\n- [ ] `npm install && npm run lint && npm test` passes\n- [ ] tests are included <!-- Bug fixes and new features should include tests -->\n- [ ] documentation is changed or added\n- [ ] commit message follows [commit guidelines](https://github.com/googleapis/release-please#how-should-i-write-my-commits)\n\n##### Description of change\n<!-- Provide a description of the change -->\n\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "# Keep GitHub Actions up to date with Dependabot...\n# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot\nversion: 2\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"daily\"\n  - package-ecosystem: \"npm\"\n    directory: \"/\"\n    schedule:\n      interval: \"daily\"\n"
  },
  {
    "path": ".github/scripts/check-engines.js",
    "content": "const { join } = require('path')\nconst semver = require('semver')\nconst Arborist = require('@npmcli/arborist')\n\nconst run = async (path, useEngines) => {\n  const pkgPath = join(path, 'package.json')\n  const pkg = require(pkgPath)\n\n  const engines = useEngines || pkg.engines.node\n\n  const arb = new Arborist({ path })\n  const tree = await arb.loadActual({ forceActual: true })\n  const deps = await tree.querySelectorAll(`#${pkg.name} > .prod:attr(engines, [node])`)\n\n  const invalid = []\n  for (const dep of deps) {\n    const depEngines = dep.target.package.engines.node\n    if (!semver.subset(engines, depEngines)) {\n      invalid.push({\n        name: `${dep.name}@${dep.version}`,\n        location: dep.location,\n        engines: depEngines\n      })\n    }\n  }\n\n  if (invalid.length) {\n    const msg = 'The following production dependencies are not compatible with ' +\n`\\`engines.node: ${engines}\\` found in \\`${pkgPath}\\`:\\n` + invalid.map((dep) => [\n  `${dep.name}:`,\n  `  engines.node: ${dep.engines}`,\n  `  location: ${dep.location}`\n    ].join('\\n')).join('\\n')\n    throw new Error(msg)\n  }\n}\n\nrun(process.cwd(), ...process.argv.slice(2)).then(() => console.log('Success')).catch((err) => {\n  console.error(err)\n  process.exitCode = 1\n})\n"
  },
  {
    "path": ".github/workflows/release-please.yml",
    "content": "name: release-please\n\non:\n  push:\n    branches:\n      - main\n\npermissions:\n  id-token: write  # Required for OIDC\n  contents: read\n\njobs:\n  release-please:\n    outputs:\n      release_created:  ${{ steps.release.outputs.release_created }}\n    runs-on: ubuntu-latest\n    steps:\n      - uses: googleapis/release-please-action@v4\n        id: release\n        with:\n          token: ${{ secrets.GH_USER_TOKEN }}\n          # Standard Conventional Commits: `feat` and `fix`\n          # node-gyp subdirectories: `bin`, `gyp`, `lib`, `src`, `test`\n          # node-gyp subcommands: `build`, `clean`, `configure`, `install`, `list`, `rebuild`, `remove`\n          # Core abstract category: `deps`\n          # Languages/platforms: `python`, `lin`, `linux`, `mac`, `macos`, `win`, `window`, `zos`\n          # Documentation: `doc`, `docs`, `readme`\n          # Standard Conventional Commits: `chore` (under \"Miscellaneous\")\n          # Miscellaneous abstract categories: `refactor`, `ci`, `meta`\n\n  npm-publish:\n    needs: release-please\n    if: ${{ needs.release-please.outputs.release_created }}\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      id-token: write # to generate npm provenance statements\n    steps:\n      - uses: actions/checkout@v6\n      - uses: actions/setup-node@v6\n        with:\n          node-version: lts/*\n          registry-url: 'https://registry.npmjs.org'\n      - run: npm install npm@11 -g # Use npm@11 to publish with OIDC\n      - run: npm publish --provenance --access public\n"
  },
  {
    "path": ".github/workflows/tests.yml",
    "content": "# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources\n# TODO: add `python -m pytest --doctest-modules`\n\nname: Tests\non:\n  push:\n    branches: [ main ]\n  pull_request:\n    branches: [ main ]\n  workflow_call:\n\npermissions:\n  contents: read # to fetch code (actions/checkout)\n\njobs:\n  lint-python:\n    name: Lint Python\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v6\n    - uses: astral-sh/ruff-action@v3\n      with:\n        args: \"check --select=E,F,PLC,PLE,UP,W,YTT --ignore=E721,PLC0206,PLC0415,PLC1901,S101,UP031 --target-version=py39\"\n    - run: ruff format --check --diff\n\n  lint-js:\n    name: Lint JS\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout Repository\n      uses: actions/checkout@v6\n    - name: Use Node.js 22.x\n      uses: actions/setup-node@v6\n      with:\n        node-version: 22.x\n    - name: Install Dependencies\n      run: npm install\n    - name: Lint\n      run: npm run lint\n\n  check-engines:\n    name: Check Engines\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout Repository\n      uses: actions/checkout@v6\n    - name: Use Node.js 22.x\n      uses: actions/setup-node@v6\n      with:\n        node-version: 22.x\n    - name: Install Dependencies\n      run: npm install\n    - name: Check Engines\n      run: |\n        # TODO: move this to its own action\n        npm install @npmcli/arborist@7 semver@7 --no-save\n        node .github/scripts/check-engines.js\n\n  test-pack:\n    name: Test Pack\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout Repository\n      uses: actions/checkout@v6\n    - name: Use Node.js 22.x\n      uses: actions/setup-node@v6\n      with:\n        node-version: 22.x\n    - name: Update npm\n      run: npm install npm@latest -g\n    - name: Install Dependencies\n      run: npm install\n    - name: Pack\n      id: pack\n      env:\n        NODE_GYP_TEMP_DIR: '${{ runner.temp }}/node-gyp'\n      run: |\n        mkdir -p $NODE_GYP_TEMP_DIR\n        npm pack\n        tar xzf *.tgz -C $NODE_GYP_TEMP_DIR --strip-components=1\n        cp -r test/ $NODE_GYP_TEMP_DIR/test/\n        echo \"dir=$NODE_GYP_TEMP_DIR\" >> \"$GITHUB_OUTPUT\"\n    - name: Test\n      working-directory: ${{ steps.pack.outputs.dir }}\n      env:\n        FULL_TEST: '1'\n      run: |\n        npm install\n        npm test\n\n  tests:\n    strategy:\n      fail-fast: false\n      max-parallel: 11\n      matrix:\n        os: [macos-latest, ubuntu-latest, windows-latest]\n        python: [\"3.10\", \"3.12\", \"3.14\"]\n        node: [20.x, 22.x, 24.x]\n        include:\n          - os: macos-15-intel  # macOS on Intel\n            python: \"3.14\"\n            node: 24.x\n          - os: ubuntu-24.04-arm  # Ubuntu on ARM\n            python: \"3.14\"\n            node: 24.x\n          - os: windows-11-arm  # Windows on ARM\n            python: \"3.14\"\n            node: 24.x\n    name: ${{ matrix.os }} - ${{ matrix.python }} - ${{ matrix.node }}\n    runs-on: ${{ matrix.os }}\n    env:\n      WASI_VERSION: '25'\n      WASI_VERSION_FULL: '25.0'\n      WASI_SDK_PATH: 'wasi-sdk-25.0'\n    steps:\n      - name: Checkout Repository\n        uses: actions/checkout@v6\n      - name: Use Node.js ${{ matrix.node }}\n        uses: actions/setup-node@v6\n        with:\n          node-version: ${{ matrix.node }}\n      - name: Use Python ${{ matrix.python }}\n        uses: actions/setup-python@v6\n        with:\n          python-version: ${{ matrix.python }}\n          allow-prereleases: true\n      - uses: seanmiddleditch/gha-setup-ninja@v6\n      - name: Install wasi-sdk (Windows)\n        shell: pwsh\n        if: runner.os == 'Windows'\n        run: |\n          $MaxRetries = 3\n          $RetryDelay = 10\n          $Attempt = 0\n          while ($Attempt -lt $MaxRetries) {\n            try {\n              Start-BitsTransfer -Source https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${env:WASI_VERSION}/wasi-sdk-${env:WASI_VERSION_FULL}-x86_64-windows.tar.gz\n              break\n            }\n            catch {\n              Write-Host \"Error: $($_.Exception.Message)\"\n              $Attempt++\n              if ($Attempt -lt $MaxRetries) {\n                Write-Host \"Retrying in $RetryDelay seconds\"\n                Start-Sleep -Seconds $RetryDelay\n              }\n              else {\n                Write-Host \"Max retries reached. Download failed.\"\n                exit 1\n              }\n            }\n          }\n          New-Item -ItemType Directory -Path ${env:WASI_SDK_PATH}\n          tar -zxvf wasi-sdk-${env:WASI_VERSION_FULL}-x86_64-windows.tar.gz -C ${env:WASI_SDK_PATH} --strip 1\n      - name: Install Dependencies\n        run: |\n          npm install\n          pip install pytest\n      - name: Set Windows Env\n        if: runner.os == 'Windows'\n        run: |\n          echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV\n          echo 'GYP_MSVS_OVERRIDE_PATH=C:\\\\Dummy' >> $Env:GITHUB_ENV\n      - name: Run Python Tests\n        run: python -m pytest\n      - name: Run Tests (macOS or Linux)\n        if: runner.os != 'Windows'\n        shell: bash\n        run: npm test --python=\"${pythonLocation}/python\"\n        env:\n          FULL_TEST: ${{ (matrix.node == '24.x' && matrix.python == '3.14') && '1' || '0' }}\n      - name: Run Tests (Windows)\n        if: runner.os == 'Windows'\n        shell: bash # Building wasm on Windows requires using make generator, it only works in bash\n        run: npm run test --python=\"${pythonLocation}\\\\python.exe\"\n        env:\n          FULL_TEST: ${{ (matrix.node == '24.x' && matrix.python == '3.14') && '1' || '0' }}\n"
  },
  {
    "path": ".github/workflows/update-gyp-next.yml",
    "content": "name: Update gyp-next\n\non:\n  schedule:\n    # Run once a week at 12:00 AM UTC on Sunday.\n    - cron: 0 0 * * *\n  workflow_dispatch:\n\npermissions:\n  contents: read\n\nenv:\n  NODE_VERSION: lts/*\n\njobs:\n  update-gyp-next:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v6\n        with:\n          persist-credentials: false\n\n      - uses: actions/github-script@v8\n        id: get-gyp-next-version\n        with:\n          script: |\n            const result = await github.rest.repos.getLatestRelease({\n              owner: 'nodejs',\n              repo: 'gyp-next',\n            });\n            return result.data.tag_name\n          result-encoding: string\n\n      - name: Update gyp-next\n        run: |\n          python update-gyp.py --no-commit ${{ steps.get-gyp-next-version.outputs.result }}\n\n      - name: Open or update PR for the gyp-next update\n        uses: gr2m/create-or-update-pull-request-action@v1\n        with:\n          branch: actions/update-gyp-next\n          author: Node.js GitHub Bot <github-bot@iojs.org>\n          title: 'feat: update gyp-next to ${{ steps.get-gyp-next-version.outputs.result }}'\n          commit-message: 'feat: update gyp-next to ${{ steps.get-gyp-next-version.outputs.result }}'\n          update-pull-request-title-and-body: true\n          body: >\n            This is an automated update of the gyp-next to\n            https://github.com/nodejs/gyp-next/releases/tag/${{ steps.get-gyp-next-version.outputs.result }}.\n        env:\n          GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/visual-studio.yml",
    "content": "# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources\n\nname: visual-studio\non:\n  push:\n    branches: [ main ]\n  pull_request:\n    branches: [ main ]\n\npermissions:\n  contents: read # to fetch code (actions/checkout)\n\njobs:\n  visual-studio:\n    strategy:\n      fail-fast: false\n      max-parallel: 8\n      matrix:\n        include:\n          - os: windows-2022\n            msvs-version: 2022\n          - os: windows-2025\n            msvs-version: 2022  # Fix this when Visual Studio 2025 is released\n          - os: windows-11-arm\n            msvs-version: 2022  # Fix this when Visual Studio 2025 is released\n    runs-on: ${{ matrix.os }}\n    steps:\n      - name: Checkout Repository\n        uses: actions/checkout@v6\n      - name: Use Python 3\n        uses: actions/setup-python@v6\n        with:\n          python-version: \"3.x\"\n      - name: Install Dependencies\n        run: npm install\n      - name: Run Node tests\n        shell: pwsh\n        run: npm run test --python=\"${env:pythonLocation}\\\\python.exe\" --msvs-version=\"${{ matrix.msvs-version }}\"\n"
  },
  {
    "path": ".gitignore",
    "content": ".ncu\n.nyc_output\n*.swp\ngyp/test\nnode_modules\nnode-gyp-*.tgz\npackage-lock.json\ntest/.node-gyp\n"
  },
  {
    "path": ".npmignore",
    "content": ".ncu\n.nyc_output\n*.swp\n/.github/\n/docs/\n/gyp/.github/\n/gyp/*.md\n/gyp/AUTHORS\n/gyp/test\n/gyp/tools/\n/node-gyp-*.tgz\n/test/\n/test/.node-gyp\n/update-gyp.py\nnode-gyp-*.tgz\n"
  },
  {
    "path": ".release-please-manifest.json",
    "content": "{\n    \".\": \"12.2.0\"\n}\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\n## [12.2.0](https://github.com/nodejs/node-gyp/compare/v12.1.0...v12.2.0) (2026-01-26)\n\n\n### Features\n\n* include built package version in error logs ([#3254](https://github.com/nodejs/node-gyp/issues/3254)) ([ee9cbdd](https://github.com/nodejs/node-gyp/commit/ee9cbdd6e1d40dc7c1cdc5ed6a75432c716eaf3f))\n* update gyp-next to v0.21.1 ([#3273](https://github.com/nodejs/node-gyp/issues/3273)) ([888ff2c](https://github.com/nodejs/node-gyp/commit/888ff2c48a4cf5602013b96b52c6670906976f63))\n\n\n### Bug Fixes\n\n* cpu concurrency detection on some platforms ([#3255](https://github.com/nodejs/node-gyp/issues/3255)) ([f15b79a](https://github.com/nodejs/node-gyp/commit/f15b79a03c54cea0f66d940a0d6d839df867a319)), closes [#3191](https://github.com/nodejs/node-gyp/issues/3191)\n* python is no longer a valid npm config setting ([#3258](https://github.com/nodejs/node-gyp/issues/3258)) ([c7c678f](https://github.com/nodejs/node-gyp/commit/c7c678f89837d956194f326b01c5a8eb1d745db3))\n* Switch to URL instead of url.parse ([#3256](https://github.com/nodejs/node-gyp/issues/3256)) ([3f81949](https://github.com/nodejs/node-gyp/commit/3f819499d8ce6d46c646466de7b9492bf7bde663))\n* Test Windows on Python 3.14, not 3.13 ([#3262](https://github.com/nodejs/node-gyp/issues/3262)) ([7b4f315](https://github.com/nodejs/node-gyp/commit/7b4f315e4dad880c841d21df641d6dd9b68bf36b))\n\n\n### Core\n\n* **deps:** bump actions/checkout from 5 to 6 ([#3248](https://github.com/nodejs/node-gyp/issues/3248)) ([db5385c](https://github.com/nodejs/node-gyp/commit/db5385c5467e5bfb914b9954f0313c46f1f4e10d))\n\n\n### Doc\n\n* add a note about changes in gyp folder ([#3259](https://github.com/nodejs/node-gyp/issues/3259)) ([a52bc81](https://github.com/nodejs/node-gyp/commit/a52bc819f44b881854ff798865ad416430e3dce2))\n* correct typos ([#3269](https://github.com/nodejs/node-gyp/issues/3269)) ([0f2bc7d](https://github.com/nodejs/node-gyp/commit/0f2bc7d2e0665b1c7bb03e1cd8653ea330277a70))\n* remove obsolete Microsoft Node.js Guidelines link ([#3268](https://github.com/nodejs/node-gyp/issues/3268)) ([30cda26](https://github.com/nodejs/node-gyp/commit/30cda268730798dc0f67182c8c568d8b8069964e))\n* update Python manual install instructions for Windows ([#3265](https://github.com/nodejs/node-gyp/issues/3265)) ([0407877](https://github.com/nodejs/node-gyp/commit/0407877e3e26d3201f74cf1a9deabbbfc40bdbb7))\n\n\n### Miscellaneous\n\n* **deps:** upgrade tar to 7.5.4 to address CVE-2026-23950 ([#3271](https://github.com/nodejs/node-gyp/issues/3271)) ([7bf371c](https://github.com/nodejs/node-gyp/commit/7bf371c4dd7c694232ab3169d02fe8197e1ecc6d))\n\n## [12.1.0](https://github.com/nodejs/node-gyp/compare/v12.0.0...v12.1.0) (2025-11-12)\n\n\n### Features\n\n* Add support for Visual Studio 2026 (18.x) ([69e5fd2](https://github.com/nodejs/node-gyp/commit/69e5fd2c98ac83dad5200a47515b301ccd80d2d3))\n* Support for Visual Studio 2026 (18.x) ([69e5fd2](https://github.com/nodejs/node-gyp/commit/69e5fd2c98ac83dad5200a47515b301ccd80d2d3))\n\n## [12.0.0](https://github.com/nodejs/node-gyp/compare/v11.5.0...v12.0.0) (2025-11-10)\n\n\n### ⚠ BREAKING CHANGES\n\n* align to npm 11 node engine range\n\n### Features\n\n* align to npm 11 node engine range ([2f85686](https://github.com/nodejs/node-gyp/commit/2f85686bbe745673350a8f9dbb0e86ee0190f213))\n* update gyp-next to v0.21.0 ([c57cd2e](https://github.com/nodejs/node-gyp/commit/c57cd2e86dc57707475b9f7e676e189f064817de))\n\n\n### Core\n\n* **deps:** bump actions/setup-node from 5 to 6 ([ae90e63](https://github.com/nodejs/node-gyp/commit/ae90e632d9fab85f4cd902dc9205ba9dfafaf3bc))\n* **deps:** bump env-paths from 2.2.1 to 3.0.0 ([#3235](https://github.com/nodejs/node-gyp/issues/3235)) ([5fffb2f](https://github.com/nodejs/node-gyp/commit/5fffb2ffee304cc898fdea7a0cd9e41d54c53839))\n* **deps:** bump which from 5.0.0 to 6.0.0 ([#3238](https://github.com/nodejs/node-gyp/issues/3238)) ([eaa8e34](https://github.com/nodejs/node-gyp/commit/eaa8e34cb5a0710bef0602c42e5840b47eb76822))\n* make-fetch-happen@15.0.0 ([e2b9d21](https://github.com/nodejs/node-gyp/commit/e2b9d21bce27c35d18fcb6f8583e386d15ce395c))\n* nopt@9.0.0 ([9bdeaf3](https://github.com/nodejs/node-gyp/commit/9bdeaf307cd7a254946859d306465989fa39dfb2))\n* proc-log@6.0.0 ([dfc68df](https://github.com/nodejs/node-gyp/commit/dfc68dfba3c17deb0bda9a395bb49d8fb9fa5951))\n\n\n### Miscellaneous\n\n* increase test timeouts ([#3237](https://github.com/nodejs/node-gyp/issues/3237)) ([3b41971](https://github.com/nodejs/node-gyp/commit/3b41971e2f6b90e02b1d7df592d403b8dfc8fa4d))\n* setup dependabot for npm ([86d65c7](https://github.com/nodejs/node-gyp/commit/86d65c7874eb41eb49c9b8bbf342becac8e57c6f))\n* update devDependencies ([41b0cea](https://github.com/nodejs/node-gyp/commit/41b0cea2f12342a790580cc8f844f075d49e096c))\n\n## [11.5.0](https://github.com/nodejs/node-gyp/compare/v11.4.2...v11.5.0) (2025-10-15)\n\n\n### Features\n\n* update gyp-next to v0.20.5 ([#3222](https://github.com/nodejs/node-gyp/issues/3222)) ([848e950](https://github.com/nodejs/node-gyp/commit/848e950833b90f0b25f346710ee42e9be4797604))\n\n\n### Bug Fixes\n\n* **ci:** Run Visual Studio test on Windows 11 on ARM ([#3217](https://github.com/nodejs/node-gyp/issues/3217)) ([8bd3f63](https://github.com/nodejs/node-gyp/commit/8bd3f6354b8bd43262a4d99d58a568beab0459e8))\n* **ci:** Test on Python 3.14 release candidate 3 on Linux and macOS ([#3216](https://github.com/nodejs/node-gyp/issues/3216)) ([085b445](https://github.com/nodejs/node-gyp/commit/085b445d1c00f8f1fc6a6ff80d8a93c6643f11ee))\n\n\n### Core\n\n* **deps:** bump actions/github-script from 7 to 8 ([#3213](https://github.com/nodejs/node-gyp/issues/3213)) ([c6b968c](https://github.com/nodejs/node-gyp/commit/c6b968caf7f4e22687fc10716162675b1411f713))\n* **deps:** bump actions/setup-node from 4 to 5 ([#3211](https://github.com/nodejs/node-gyp/issues/3211)) ([921c04d](https://github.com/nodejs/node-gyp/commit/921c04d142549f172d3aeae4097c9e0af05599dd))\n* **deps:** bump actions/setup-python from 5 to 6 ([#3210](https://github.com/nodejs/node-gyp/issues/3210)) ([6b70b05](https://github.com/nodejs/node-gyp/commit/6b70b05ed21cb977214348c97c2b97515c0d08f3))\n\n## [11.4.2](https://github.com/nodejs/node-gyp/compare/v11.4.1...v11.4.2) (2025-08-26)\n\n\n### Bug Fixes\n\n* add adaptation for OpenHarmony platform ([#3207](https://github.com/nodejs/node-gyp/issues/3207)) ([b406532](https://github.com/nodejs/node-gyp/commit/b406532c77659c441c845708ec3ecdf09f013a3b))\n\n### Miscellaneous\n\n* update gyp-next to v0.20.4 ([#3208](https://github.com/nodejs/node-gyp/issues/3208)) ([adc61b1](https://github.com/nodejs/node-gyp/commit/adc61b1458315d9648591e74bf16bbe39511401e))\n* **ci:** Update Node.js version matrix in `tests.yml` ([#3209](https://github.com/nodejs/node-gyp/issues/3209)) ([a4e1da6](https://github.com/nodejs/node-gyp/commit/a4e1da6683a37fde565e1ea50f1fa86fa99a83c7))\n* ruff format Python code ([#3203](https://github.com/nodejs/node-gyp/issues/3203)) ([cb30a53](https://github.com/nodejs/node-gyp/commit/cb30a538eadf49ca0310980ffb0bfdb8fcebf0a4))\n\n## [11.4.1](https://github.com/nodejs/node-gyp/compare/v11.4.0...v11.4.1) (2025-08-20)\n\n\n### Miscellaneous\n\n* **release:** use npm@11 for OIDC publishing ([#3202](https://github.com/nodejs/node-gyp/issues/3202)) ([6b9638a](https://github.com/nodejs/node-gyp/commit/6b9638a0f80352e5bf7c1702e6ef622a6474d44a)), closes [#3201](https://github.com/nodejs/node-gyp/issues/3201)\n\n## [11.4.0](https://github.com/nodejs/node-gyp/compare/v11.3.0...v11.4.0) (2025-08-19)\n\n\n### Features\n\n* read from config case-insensitively ([#3198](https://github.com/nodejs/node-gyp/issues/3198)) ([5538e6c](https://github.com/nodejs/node-gyp/commit/5538e6c5d78dffd41e2a588adfa7ea9022150b9d))\n* support reading config from package.json ([#3196](https://github.com/nodejs/node-gyp/issues/3196)) ([1822dff](https://github.com/nodejs/node-gyp/commit/1822dff4f616a30ac3ca72e5946d81389cb8557e)), closes [#3156](https://github.com/nodejs/node-gyp/issues/3156)\n\n\n### Core\n\n* **deps:** bump actions/checkout from 4 to 5 ([#3193](https://github.com/nodejs/node-gyp/issues/3193)) ([27f5505](https://github.com/nodejs/node-gyp/commit/27f5505ec236551081366bf8a9c13ef5d8e468bf))\n\n\n### Miscellaneous\n\n* use npm oicd connection for publishing ([#3197](https://github.com/nodejs/node-gyp/issues/3197)) ([0773615](https://github.com/nodejs/node-gyp/commit/077361502933fcb994ca365c3c07c03177503df2))\n\n## [11.3.0](https://github.com/nodejs/node-gyp/compare/v11.2.0...v11.3.0) (2025-07-29)\n\n\n### Features\n\n* update gyp-next to v0.20.2 ([#3169](https://github.com/nodejs/node-gyp/issues/3169)) ([0e65632](https://github.com/nodejs/node-gyp/commit/0e656322c1e94041331ab3b01bf66c2ef9bd6ead))\n\n\n### Bug Fixes\n\n* Correct Visual Studio 2019 test version ([#3153](https://github.com/nodejs/node-gyp/issues/3153)) ([7d883b5](https://github.com/nodejs/node-gyp/commit/7d883b5cf4c26e76065201f85b0be36d5ebdcc0e))\n* Normalize win32 library names ([#3189](https://github.com/nodejs/node-gyp/issues/3189)) ([b81a665](https://github.com/nodejs/node-gyp/commit/b81a665acfb9d88102e8044a8ec8ca74a3e9eccc))\n* use temp dir for tar extraction on all platforms ([#3170](https://github.com/nodejs/node-gyp/issues/3170)) ([b41864f](https://github.com/nodejs/node-gyp/commit/b41864f7c1c60e4a160c1b4dd91558dcaa3f74e4)), closes [#3165](https://github.com/nodejs/node-gyp/issues/3165)\n\n\n### Miscellaneous\n\n* retry wasi-sdk download in CI ([#3151](https://github.com/nodejs/node-gyp/issues/3151)) ([8f3cd8b](https://github.com/nodejs/node-gyp/commit/8f3cd8b3a157bccd8d7110e7d46a27c2926625cd))\n* Windows 2019 has been removed from GitHub Actions ([#3190](https://github.com/nodejs/node-gyp/issues/3190)) ([3df8789](https://github.com/nodejs/node-gyp/commit/3df8789a9aa73c60707eec8f02f4e926491d6102))\n\n## [11.2.0](https://github.com/nodejs/node-gyp/compare/v11.1.0...v11.2.0) (2025-04-01)\n\n\n### Features\n\n* update gyp-next to v0.20.0 ([#3149](https://github.com/nodejs/node-gyp/issues/3149)) ([80e9c79](https://github.com/nodejs/node-gyp/commit/80e9c795a739c490cfbc85633e63022b36a7c70d))\n\n\n### Bug Fixes\n\n* disable msbuild.exe nodeReuse ([#3112](https://github.com/nodejs/node-gyp/issues/3112)) ([0cf16d2](https://github.com/nodejs/node-gyp/commit/0cf16d29fe604266fb47325496287a63075ea532))\n* use maxRetries on fs.rm calls ([#3113](https://github.com/nodejs/node-gyp/issues/3113)) ([a2772a7](https://github.com/nodejs/node-gyp/commit/a2772a76709f939af1e80dd8fe766ca2143aa5bf))\n\n\n### Tests\n\n* fix wasm test on Windows ([#3145](https://github.com/nodejs/node-gyp/issues/3145)) ([ee1d6fd](https://github.com/nodejs/node-gyp/commit/ee1d6fd8d83c9dd3eae7df7ec533bb6b39e1a812))\n* use maxRetries with tests too ([#3150](https://github.com/nodejs/node-gyp/issues/3150)) ([0ccbe7e](https://github.com/nodejs/node-gyp/commit/0ccbe7e90afb096b46a7818ba127a4871237952e))\n\n\n### Doc\n\n* add ffi-napi to docs/README.md ([#3138](https://github.com/nodejs/node-gyp/issues/3138)) ([4885110](https://github.com/nodejs/node-gyp/commit/48851107ad8c5d2cf18a55e8bd2764f5938e7102))\n\n\n### Miscellaneous\n\n* switch to tinyglobby ([#3133](https://github.com/nodejs/node-gyp/issues/3133)) ([c3b3ab0](https://github.com/nodejs/node-gyp/commit/c3b3ab06ee0f092cd5c0646120d57e56d41b79fc))\n* update tinyglobby ([#3136](https://github.com/nodejs/node-gyp/issues/3136)) ([b21cf87](https://github.com/nodejs/node-gyp/commit/b21cf874f58883f3fd4dd07bec3b584fb07e831d))\n\n## [11.1.0](https://github.com/nodejs/node-gyp/compare/v11.0.0...v11.1.0) (2025-02-10)\n\n\n### Features\n\n* update gyp-next to v0.19.1 ([#3122](https://github.com/nodejs/node-gyp/issues/3122)) ([504250e](https://github.com/nodejs/node-gyp/commit/504250e5e3e27c6ef6dcfcaa744b36e1a99c1be8))\n\n\n### Bug Fixes\n\n* Find VC.Tools.ARM64 on arm64 machine ([#3075](https://github.com/nodejs/node-gyp/issues/3075)) ([b899fae](https://github.com/nodejs/node-gyp/commit/b899faed56270d3d8496da7576b5750b264c2c21))\n* try libnode.dll first in load_exe_hook ([#2834](https://github.com/nodejs/node-gyp/issues/2834)) ([b9d10a5](https://github.com/nodejs/node-gyp/commit/b9d10a5a37081e2a731937e43eca52c83609e7f5))\n\n\n### Miscellaneous\n\n* add gyp-next updater ([#3105](https://github.com/nodejs/node-gyp/issues/3105)) ([e3f9a77](https://github.com/nodejs/node-gyp/commit/e3f9a7756f65a7f4e50799017b3dc51d5bc195b2))\n* Test on Ubuntu-24.04-arm and Node.js v23 ([#3121](https://github.com/nodejs/node-gyp/issues/3121)) ([2530f51](https://github.com/nodejs/node-gyp/commit/2530f51cec3ba595184e5bcb7fe1245e240beb59))\n* Use astral-sh/ruff-action@v3 to run the Python linter ([#3114](https://github.com/nodejs/node-gyp/issues/3114)) ([94448fc](https://github.com/nodejs/node-gyp/commit/94448fcd9f090814bce1c4361471dae199dc2e82))\n\n## [11.0.0](https://github.com/nodejs/node-gyp/compare/v10.3.1...v11.0.0) (2024-12-03)\n\n\n### ⚠ BREAKING CHANGES\n\n* drop node 16 support ([#3102](https://github.com/nodejs/node-gyp/issues/3102))\n\n### Features\n\n* drop node 16 support ([#3102](https://github.com/nodejs/node-gyp/issues/3102)) ([0e6b6f8](https://github.com/nodejs/node-gyp/commit/0e6b6f8bea615cf031d76ecff9102a38e5474c72))\n\n\n### Miscellaneous\n\n* migrate from standard to neostandard ([#3103](https://github.com/nodejs/node-gyp/issues/3103)) ([a130178](https://github.com/nodejs/node-gyp/commit/a13017807d0ae7da8fa076b0bcf23153af7c60a6))\n\n## [10.3.1](https://github.com/nodejs/node-gyp/compare/v10.3.0...v10.3.1) (2024-12-02)\n\n\n### Miscellaneous\n\n* fix npm-publish dependencies and add provenance ([#3099](https://github.com/nodejs/node-gyp/issues/3099)) ([6dded88](https://github.com/nodejs/node-gyp/commit/6dded88065872a32f44114e60731ba4b701ec057))\n\n## [10.3.0](https://github.com/nodejs/node-gyp/compare/v10.2.0...v10.3.0) (2024-11-29)\n\n\n### Features\n\n* prohibit compiling with ClangCL on Windows ([#3098](https://github.com/nodejs/node-gyp/issues/3098)) ([88260bf](https://github.com/nodejs/node-gyp/commit/88260bf86aeb4c39959b78104a5edc3dc88d3aef))\n\n\n### Bug Fixes\n\n* **ci:** use correct release-please-action domain after organization url was changed ([#3032](https://github.com/nodejs/node-gyp/issues/3032)) ([d1ed3d4](https://github.com/nodejs/node-gyp/commit/d1ed3d4dc3a53b8ccab4093d002e43945bbece0e))\n\n\n### Miscellaneous\n\n* add links to Code of Conduct from root file ([#2196](https://github.com/nodejs/node-gyp/issues/2196)) ([d22e2eb](https://github.com/nodejs/node-gyp/commit/d22e2eb080807c6290533a67249c343a7605a989))\n* publish to npm with release-please ([#3051](https://github.com/nodejs/node-gyp/issues/3051)) ([8319847](https://github.com/nodejs/node-gyp/commit/831984736393a3ea8417efec5255f95d53a70785))\n\n## [10.2.0](https://github.com/nodejs/node-gyp/compare/v10.1.0...v10.2.0) (2024-07-09)\n\n\n### Features\n\n* allow VCINSTALLDIR to specify a portable instance ([#3036](https://github.com/nodejs/node-gyp/issues/3036)) ([d38af2e](https://github.com/nodejs/node-gyp/commit/d38af2e0c2a81b12cd221b1f8517fb89e609d62c))\n* **gyp:** update gyp to v0.18.1 ([#3039](https://github.com/nodejs/node-gyp/issues/3039)) ([ea99fea](https://github.com/nodejs/node-gyp/commit/ea99fea83485dc5be04db01df9b2fdbe05319b8e))\n* support `rebuild` and `build` for cross-compiling Node-API module to wasm on Windows ([#2974](https://github.com/nodejs/node-gyp/issues/2974)) ([6318d2b](https://github.com/nodejs/node-gyp/commit/6318d2b210224415ff5932c2863e6cc14d4583dc))\n\n\n### Core\n\n* add an arch check to VS 2019 ([#3025](https://github.com/nodejs/node-gyp/issues/3025)) ([323957b](https://github.com/nodejs/node-gyp/commit/323957b74e9586fb3fbfb2acad5040379c778de6))\n* **deps:** bump seanmiddleditch/gha-setup-ninja from 4 to 5 ([#3041](https://github.com/nodejs/node-gyp/issues/3041)) ([10f6730](https://github.com/nodejs/node-gyp/commit/10f6730be660e7a38be8a12111937e37fcf74834))\n* proc-log@4.0.0 ([#3022](https://github.com/nodejs/node-gyp/issues/3022)) ([141aa6b](https://github.com/nodejs/node-gyp/commit/141aa6bf029e6f984be8ea98aaf985e5df894082))\n* tar@6.2.1 ([#3021](https://github.com/nodejs/node-gyp/issues/3021)) ([b22d5ee](https://github.com/nodejs/node-gyp/commit/b22d5eef861892c968052ffc1c71b551f738163b))\n\n\n### Doc\n\n* `node-pre-gyp` is no longer maintained ([#3015](https://github.com/nodejs/node-gyp/issues/3015)) ([93186f1](https://github.com/nodejs/node-gyp/commit/93186f10c966b4148fc500e48f8cbffacccdfa3c))\n* add the way to configuring Python dependency for Windows PowerShell ([#2996](https://github.com/nodejs/node-gyp/issues/2996)) ([9fd7936](https://github.com/nodejs/node-gyp/commit/9fd7936f0d7232a8a79e6a7b6cbfb814d9042b13))\n* Installation -- Python >= v3.12 requires `node-gyp` >= v10 ([#3010](https://github.com/nodejs/node-gyp/issues/3010)) ([a6b48fc](https://github.com/nodejs/node-gyp/commit/a6b48fca9993e54d757cd110f6b41f8200d99ca4))\n\n\n### Miscellaneous\n\n* fix ruff command ([#3044](https://github.com/nodejs/node-gyp/issues/3044)) ([b3916d5](https://github.com/nodejs/node-gyp/commit/b3916d5b25704a53e89be16b500036a14bdc5060))\n\n## [10.1.0](https://github.com/nodejs/node-gyp/compare/v10.0.1...v10.1.0) (2024-03-13)\n\n\n### Features\n\n* improve visual studio detection ([#2957](https://github.com/nodejs/node-gyp/issues/2957)) ([109e3d4](https://github.com/nodejs/node-gyp/commit/109e3d4245504a7b75c99f578e1203c0ef4b518e))\n\n\n### Core\n\n* add support for locally installed headers ([#2964](https://github.com/nodejs/node-gyp/issues/2964)) ([3298731](https://github.com/nodejs/node-gyp/commit/329873141f0d3e3787d3c006801431da04e4ed0c))\n* **deps:** bump actions/setup-python from 4 to 5 ([#2960](https://github.com/nodejs/node-gyp/issues/2960)) ([3f0df7e](https://github.com/nodejs/node-gyp/commit/3f0df7e9334e49e8c7f6fdbbb9e1e6c5a8cca53b))\n* **deps:** bump google-github-actions/release-please-action ([#2961](https://github.com/nodejs/node-gyp/issues/2961)) ([b1f1808](https://github.com/nodejs/node-gyp/commit/b1f1808bfff0d51e6d3eb696ab6a5b89b7b9630c))\n* print Python executable path using UTF-8 ([#2995](https://github.com/nodejs/node-gyp/issues/2995)) ([c472912](https://github.com/nodejs/node-gyp/commit/c4729129daa9bb5204246b857826fb391ac961e1))\n* update supported vs versions ([#2959](https://github.com/nodejs/node-gyp/issues/2959)) ([391cc5b](https://github.com/nodejs/node-gyp/commit/391cc5b9b25cffe0cb2edcba3583414a771b4a15))\n\n\n### Doc\n\n* npm is currently v10 ([#2970](https://github.com/nodejs/node-gyp/issues/2970)) ([7705a22](https://github.com/nodejs/node-gyp/commit/7705a22f31a62076e9f8429780a459f4ad71ea4c))\n* remove outdated Node versions from readme ([#2955](https://github.com/nodejs/node-gyp/issues/2955)) ([ae8478e](https://github.com/nodejs/node-gyp/commit/ae8478ec32d9b2fa71b591ac22cdf867ef2e9a7d))\n* remove outdated update engines.node reference in 10.0.0 changelog ([b42e796](https://github.com/nodejs/node-gyp/commit/b42e7966177f006f3d1aab1d27885d8372c8ed01))\n\n\n### Miscellaneous\n\n* only run release please on push ([cff9ac2](https://github.com/nodejs/node-gyp/commit/cff9ac2c3083769a383e00bc60b91562f03116e3))\n* upgrade release please action from v2 to v4 ([#2982](https://github.com/nodejs/node-gyp/issues/2982)) ([0035d8e](https://github.com/nodejs/node-gyp/commit/0035d8e9dc98b94f0bc8cd9023a6fa635003703e))\n\n### [10.0.1](https://www.github.com/nodejs/node-gyp/compare/v10.0.0...v10.0.1) (2023-11-02)\n\n\n### Bug Fixes\n\n* use local `util` for `findAccessibleSync()` ([b39e681](https://www.github.com/nodejs/node-gyp/commit/b39e6819aa9e2c45107d6e60a4913ca036ebfbfd))\n\n\n### Miscellaneous\n\n* add parallel test logging ([7de1f5f](https://www.github.com/nodejs/node-gyp/commit/7de1f5f32d550d26d48fe4f76aed5866744edcba))\n* lint fixes ([4e0ed99](https://www.github.com/nodejs/node-gyp/commit/4e0ed992566f43abc6e988af091ad07fde04acbf))\n* use platform specific timeouts in tests ([a68586a](https://www.github.com/nodejs/node-gyp/commit/a68586a67d0af238300662cc062422b42820044d))\n\n## [10.0.0](https://www.github.com/nodejs/node-gyp/compare/v9.4.0...v10.0.0) (2023-10-28)\n\n\n### ⚠ BREAKING CHANGES\n\n* use .npmignore file to limit which files are published (#2921)\n* the `Gyp` class exported is now created using ECMAScript classes and therefore might have small differences to classes that were previously created with `util.inherits`.\n* All internal functions have been coverted to return promises and no longer accept callbacks. This is not a breaking change for users but may be breaking to consumers of `node-gyp` if you are requiring internal functions directly.\n* `node-gyp` now supports node `^16.14.0 || >=18.0.0`\n\n### Features\n\n* convert all internal functions to async/await ([355622f](https://www.github.com/nodejs/node-gyp/commit/355622f4aac3bd3056b9e03aac5fa2f42a4b3576))\n* convert internal classes from util.inherits to classes ([d52997e](https://www.github.com/nodejs/node-gyp/commit/d52997e975b9da6e0cea3d9b99873e9ddc768679))\n* drop node 14 support ([#2929](https://www.github.com/nodejs/node-gyp/issues/2929)) ([1b3bd34](https://www.github.com/nodejs/node-gyp/commit/1b3bd341b40f384988d03207ce8187e93ba609bc))\n* drop rimraf dependency ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* **gyp:** update gyp to v0.16.1 ([#2923](https://www.github.com/nodejs/node-gyp/issues/2923)) ([707927c](https://www.github.com/nodejs/node-gyp/commit/707927cd579205ef2b4b17e61c1cce24c056b452))\n* replace npmlog with proc-log ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* update engines.node to ^14.17.0 || ^16.13.0 || >=18.0.0 ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* use .npmignore file to limit which files are published ([#2921](https://www.github.com/nodejs/node-gyp/issues/2921)) ([864a979](https://www.github.com/nodejs/node-gyp/commit/864a979930cf0ef5ad64bc887b901fa8955d058f))\n\n\n### Bug Fixes\n\n* create Python symlink only during builds, and clean it up after ([#2721](https://www.github.com/nodejs/node-gyp/issues/2721)) ([0f1f667](https://www.github.com/nodejs/node-gyp/commit/0f1f667b737d21905e283df100a2cb639993562a))\n* promisify build command ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* use fs/promises in favor of fs.promises ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n\n\n### Tests\n\n* increase mocha timeout ([#2887](https://www.github.com/nodejs/node-gyp/issues/2887)) ([445c28f](https://www.github.com/nodejs/node-gyp/commit/445c28fabc5fbdf9c3bb3341fb70660a3530f6ad))\n* update expired certs ([#2908](https://www.github.com/nodejs/node-gyp/issues/2908)) ([5746691](https://www.github.com/nodejs/node-gyp/commit/5746691a36f7b37019d4b8d4e9616aec43d20410))\n\n\n### Doc\n\n* Add note about Python symlinks (PR 2362) to CHANGELOG.md for 9.1.0 ([#2783](https://www.github.com/nodejs/node-gyp/issues/2783)) ([b3d41ae](https://www.github.com/nodejs/node-gyp/commit/b3d41aeb737ddd54cc292f363abc561dcc0a614e))\n* README.md Do not hardcode the supported versions of Python ([#2880](https://www.github.com/nodejs/node-gyp/issues/2880)) ([bb93b94](https://www.github.com/nodejs/node-gyp/commit/bb93b946a9c74934b59164deb52128cf913c97d5))\n* update applicable GitHub links from master to main ([#2843](https://www.github.com/nodejs/node-gyp/issues/2843)) ([d644ce4](https://www.github.com/nodejs/node-gyp/commit/d644ce48311edf090d0e920ad449e5766c757933))\n* Update windows installation instructions in README.md ([#2882](https://www.github.com/nodejs/node-gyp/issues/2882)) ([c9caa2e](https://www.github.com/nodejs/node-gyp/commit/c9caa2ecf3c7deae68444ce8fabb32d2dca651cd))\n\n\n### Core\n\n* find python checks order changed on windows ([#2872](https://www.github.com/nodejs/node-gyp/issues/2872)) ([b030555](https://www.github.com/nodejs/node-gyp/commit/b030555cdb754d9c23906e7e707115cd077bbf76))\n* glob@10.3.10 ([#2926](https://www.github.com/nodejs/node-gyp/issues/2926)) ([4bef1ec](https://www.github.com/nodejs/node-gyp/commit/4bef1ecc7554097d92beb397fbe1a546c5227545))\n* glob@8.0.3 ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* make-fetch-happen@13.0.0 ([#2927](https://www.github.com/nodejs/node-gyp/issues/2927)) ([059bb6f](https://www.github.com/nodejs/node-gyp/commit/059bb6fd41bb50955a9efbd97887773d60d53221))\n* nopt@^7.0.0 ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* standard@17.0.0 and fix linting errors ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* which@3.0.0 ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* which@4.0.0 ([#2928](https://www.github.com/nodejs/node-gyp/issues/2928)) ([e388255](https://www.github.com/nodejs/node-gyp/commit/e38825531403aabeae7abe58e76867f31b832f36))\n\n\n### Miscellaneous\n\n* add check engines script to CI ([#2922](https://www.github.com/nodejs/node-gyp/issues/2922)) ([21a7249](https://www.github.com/nodejs/node-gyp/commit/21a7249b40d8f95e7721e450fd18764adb1648a7))\n* empty commit to add changelog entries from [#2770](https://www.github.com/nodejs/node-gyp/issues/2770) ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))\n* GitHub Workflows security hardening ([#2740](https://www.github.com/nodejs/node-gyp/issues/2740)) ([26683e9](https://www.github.com/nodejs/node-gyp/commit/26683e993df038fb94d89f2276f3535e4522d79a))\n* misc testing fixes ([#2930](https://www.github.com/nodejs/node-gyp/issues/2930)) ([4e493d4](https://www.github.com/nodejs/node-gyp/commit/4e493d4fb262d12ac52c84979071ccc79e666a1a))\n* run tests after release please PR ([3032e10](https://www.github.com/nodejs/node-gyp/commit/3032e1061cc2b7b49f83c397d385bafddc6b0214))\n\n## [9.4.0](https://www.github.com/nodejs/node-gyp/compare/v9.3.1...v9.4.0) (2023-06-12)\n\n\n### Features\n\n* add support for native windows arm64 build tools ([bb76021](https://www.github.com/nodejs/node-gyp/commit/bb76021d35964d2bb125bc6214286f35ae4e6cad))\n* Upgrade Python linting from flake8 to ruff ([#2815](https://www.github.com/nodejs/node-gyp/issues/2815)) ([fc0ddc6](https://www.github.com/nodejs/node-gyp/commit/fc0ddc6523c62b10e5ca1257500b3ceac01450a7))\n\n\n### Bug Fixes\n\n* extract tarball to temp directory on Windows ([#2846](https://www.github.com/nodejs/node-gyp/issues/2846)) ([aaa117c](https://www.github.com/nodejs/node-gyp/commit/aaa117c514430aa2c1e568b95df1b6ed1c1fd3b6))\n* log statement is for devDir not nodedir ([#2840](https://www.github.com/nodejs/node-gyp/issues/2840)) ([55048f8](https://www.github.com/nodejs/node-gyp/commit/55048f8be5707c295fb0876306aded75638a8b63))\n\n\n### Miscellaneous\n\n* get update-gyp.py to work with Python >= v3.5 ([#2826](https://www.github.com/nodejs/node-gyp/issues/2826)) ([337e8e6](https://www.github.com/nodejs/node-gyp/commit/337e8e68209bd2481cbb11dacce61234dc5c9419))\n\n\n### Doc\n\n* docs/README.md add advise about deprecated node-sass ([#2828](https://www.github.com/nodejs/node-gyp/issues/2828)) ([6f3c2d3](https://www.github.com/nodejs/node-gyp/commit/6f3c2d3c6c0de0dbf8c7245f34c2e0b3eea53812))\n* Update README.md ([#2822](https://www.github.com/nodejs/node-gyp/issues/2822)) ([c7927e2](https://www.github.com/nodejs/node-gyp/commit/c7927e228dfde059c93e08c26b54dd8026144583))\n\n\n### Tests\n\n* remove deprecated Node.js and Python ([#2868](https://www.github.com/nodejs/node-gyp/issues/2868)) ([a0b3d1c](https://www.github.com/nodejs/node-gyp/commit/a0b3d1c3afed71a74501476fcbc6ee3fface4d13))\n\n### [9.3.1](https://www.github.com/nodejs/node-gyp/compare/v9.3.0...v9.3.1) (2022-12-16)\n\n\n### Bug Fixes\n\n* increase node 12 support to ^12.13 ([#2771](https://www.github.com/nodejs/node-gyp/issues/2771)) ([888efb9](https://www.github.com/nodejs/node-gyp/commit/888efb9055857afee6a6b54550722cf9ae3ee323))\n\n\n### Miscellaneous\n\n* update python test matrix ([#2774](https://www.github.com/nodejs/node-gyp/issues/2774)) ([38f01fa](https://www.github.com/nodejs/node-gyp/commit/38f01fa57d10fdb3db7697121d957bc2e0e96508))\n\n## [9.3.0](https://www.github.com/nodejs/node-gyp/compare/v9.2.0...v9.3.0) (2022-10-10)\n\n\n### Features\n\n* **gyp:** update gyp to v0.14.0 ([#2749](https://www.github.com/nodejs/node-gyp/issues/2749)) ([713b8dc](https://www.github.com/nodejs/node-gyp/commit/713b8dcdbf44532ca9453a127da266386cc737f8))\n* remove support for VS2015 in Node.js >=19 ([#2746](https://www.github.com/nodejs/node-gyp/issues/2746)) ([131d1a4](https://www.github.com/nodejs/node-gyp/commit/131d1a463baf034a04154bcda753a8295f112a34))\n* support IBM Open XL C/C++ on z/OS ([#2743](https://www.github.com/nodejs/node-gyp/issues/2743)) ([7d0c83d](https://www.github.com/nodejs/node-gyp/commit/7d0c83d2a95aca743dff972826d0da26203acfc4))\n\n## [9.2.0](https://www.github.com/nodejs/node-gyp/compare/v9.1.0...v9.2.0) (2022-10-02)\n\n\n### Features\n\n* Add proper support for IBM i ([a26494f](https://www.github.com/nodejs/node-gyp/commit/a26494fbb8883d9ef784503979e115dec3e2791e))\n* **gyp:** update gyp to v0.13.0 ([3e2a532](https://www.github.com/nodejs/node-gyp/commit/3e2a5324f1c24f3a04bca04cf54fe23d5c4d5e50))\n\n\n### Bug Fixes\n\n* node.js debugger adds stderr (but exit code is 0) -> shouldn't throw ([#2719](https://www.github.com/nodejs/node-gyp/issues/2719)) ([c379a74](https://www.github.com/nodejs/node-gyp/commit/c379a744c65c7ab07c2c3193d9c7e8f25ae1b05e))\n\n\n### Core\n\n* enable support for zoslib on z/OS ([#2600](https://www.github.com/nodejs/node-gyp/issues/2600)) ([83c0a12](https://www.github.com/nodejs/node-gyp/commit/83c0a12bf23b4cbf3125d41f9e2d4201db76c9ae))\n\n\n### Miscellaneous\n\n* update dependency - nopt@6.0.0 ([#2707](https://www.github.com/nodejs/node-gyp/issues/2707)) ([8958ecf](https://www.github.com/nodejs/node-gyp/commit/8958ecf2bb719227bbcbf155891c3186ee219a2e))\n\n## [9.1.0](https://www.github.com/nodejs/node-gyp/compare/v9.0.0...v9.1.0) (2022-07-13)\n\n\n### Features\n\n* Update function getSDK() to support Windows 11 SDK ([#2565](https://www.github.com/nodejs/node-gyp/issues/2565)) ([ea8520e](https://www.github.com/nodejs/node-gyp/commit/ea8520e3855374bd15b6d001fe112d58a8d7d737))\n\n\n### Bug Fixes\n\n* extend tap timeout length to allow for slow CI ([6f74c76](https://www.github.com/nodejs/node-gyp/commit/6f74c762fe3c19bdd20245cb5c02e2dfa65d9451))\n* new ca & server certs, bundle in .js file and unpack for testing ([147e3d3](https://www.github.com/nodejs/node-gyp/commit/147e3d34f44a97deb7aa507207680cf0f4e662a2))\n* re-label ([#2689](https://www.github.com/nodejs/node-gyp/issues/2689)) ([f0b7863](https://www.github.com/nodejs/node-gyp/commit/f0b7863dadfa365afc173025ae95351aec79abd9))\n* typo on readme ([bf81cd4](https://www.github.com/nodejs/node-gyp/commit/bf81cd452b931dd4dfa82762c23dd530a075d992))\n\n\n### Doc\n\n* update docs/README.md with latest version number ([62d2815](https://www.github.com/nodejs/node-gyp/commit/62d28151bf8266a34e1bcceeb25b4e6e2ae5ca5d))\n\n\n### Core\n\n* update due to rename of primary branch ([ca1f068](https://www.github.com/nodejs/node-gyp/commit/ca1f0681a5567ca8cd51acebccd37a633f19bc6a))\n* Add Python symlink to path (for non-Windows OSes only) ([#2362](https://github.com/nodejs/node-gyp/pull/2362)) ([b9ddcd5](https://github.com/nodejs/node-gyp/commit/b9ddcd5bbd93b05b03674836b6ebdae2c2e74c8c))\n\n\n### Tests\n\n* Try msvs-version: [2016, 2019, 2022] ([#2700](https://www.github.com/nodejs/node-gyp/issues/2700)) ([68b5b5b](https://www.github.com/nodejs/node-gyp/commit/68b5b5be9c94ac20c55e88654ff6f55234d7130a))\n* Upgrade GitHub Actions ([#2623](https://www.github.com/nodejs/node-gyp/issues/2623)) ([245cd5b](https://www.github.com/nodejs/node-gyp/commit/245cd5bbe4441d4f05e88f2fa20a86425419b6af))\n* Upgrade GitHub Actions ([#2701](https://www.github.com/nodejs/node-gyp/issues/2701)) ([1c64ca7](https://www.github.com/nodejs/node-gyp/commit/1c64ca7f4702c6eb43ecd16fbd67b5d939041621))\n\n## [9.0.0](https://www.github.com/nodejs/node-gyp/compare/v8.4.1...v9.0.0) (2022-02-24)\n\n\n### ⚠ BREAKING CHANGES\n\n* increase \"engines\" to \"node\" : \"^12.22 || ^14.13 || >=16\" (#2601)\n\n### Bug Fixes\n\n* _ in npm_config_ env variables ([eef4eef](https://www.github.com/nodejs/node-gyp/commit/eef4eefccb13ff6a32db862709ee5b2d4edf7e95))\n* update make-fetch-happen to a minimum of 10.0.3 ([839e414](https://www.github.com/nodejs/node-gyp/commit/839e414b63790c815a4a370d0feee8f24a94d40f))\n\n\n### Miscellaneous\n\n* add minimal SECURITY.md ([#2560](https://www.github.com/nodejs/node-gyp/issues/2560)) ([c2a1850](https://www.github.com/nodejs/node-gyp/commit/c2a185056e2e589b520fbc0bcc59c2935cd07ede))\n\n\n### Doc\n\n* Add notes/disclaimers for upgrading the copy of node-gyp that npm uses ([#2585](https://www.github.com/nodejs/node-gyp/issues/2585)) ([faf6d48](https://www.github.com/nodejs/node-gyp/commit/faf6d48f8a77c08a313baf9332358c4b1231c73c))\n* Rename and update Common-issues.md --> docs/README.md ([#2567](https://www.github.com/nodejs/node-gyp/issues/2567)) ([2ef5fb8](https://www.github.com/nodejs/node-gyp/commit/2ef5fb86277c4d81baffc0b9f642a8d86be1bfa5))\n* rephrase explanation of which node-gyp is used by npm ([#2587](https://www.github.com/nodejs/node-gyp/issues/2587)) ([a2f2988](https://www.github.com/nodejs/node-gyp/commit/a2f298870692022302fa27a1d42363c4a72df407))\n* title match content ([#2574](https://www.github.com/nodejs/node-gyp/issues/2574)) ([6e8f93b](https://www.github.com/nodejs/node-gyp/commit/6e8f93be0443f2649d4effa7bc773a9da06a33b4))\n* Update Python versions ([#2571](https://www.github.com/nodejs/node-gyp/issues/2571)) ([e069f13](https://www.github.com/nodejs/node-gyp/commit/e069f13658a8bfb5fd60f74708cf8be0856d92e3))\n\n\n### Core\n\n* add lib.target as path for searching libnode on z/OS ([1d499dd](https://www.github.com/nodejs/node-gyp/commit/1d499dd5606f39de2d34fa822fd0fa5ce17fbd06))\n* increase \"engines\" to \"node\" : \"^12.22 || ^14.13 || >=16\" ([#2601](https://www.github.com/nodejs/node-gyp/issues/2601)) ([6562f92](https://www.github.com/nodejs/node-gyp/commit/6562f92a6f2e67aeae081ddf5272ff117f1fab07))\n* make-fetch-happen@10.0.1 ([78f6660](https://www.github.com/nodejs/node-gyp/commit/78f66604e0df480d4f36a8fa4f3618c046a6fbdc))\n\n### [8.4.1](https://www.github.com/nodejs/node-gyp/compare/v8.4.0...v8.4.1) (2021-11-19)\n\n\n### Bug Fixes\n\n* windows command missing space ([#2553](https://www.github.com/nodejs/node-gyp/issues/2553)) ([cc37b88](https://www.github.com/nodejs/node-gyp/commit/cc37b880690706d3c5d04d5a68c76c392a0a23ed))\n\n\n### Doc\n\n* fix typo in powershell node-gyp update ([787cf7f](https://www.github.com/nodejs/node-gyp/commit/787cf7f8e5ddd5039e02b64ace6b7b15e06fe0a4))\n\n\n### Core\n\n* npmlog@6.0.0 ([8083f6b](https://www.github.com/nodejs/node-gyp/commit/8083f6b855bd7f3326af04c5f5269fc28d7f2508))\n\n## [8.4.0](https://www.github.com/nodejs/node-gyp/compare/v8.3.0...v8.4.0) (2021-11-05)\n\n\n### Features\n\n* build with config.gypi from node headers ([a27dc08](https://www.github.com/nodejs/node-gyp/commit/a27dc08696911c6d81e76cc228697243069103c1))\n* support vs2022 ([#2533](https://www.github.com/nodejs/node-gyp/issues/2533)) ([5a00387](https://www.github.com/nodejs/node-gyp/commit/5a00387e5f8018264a1822f6c4d5dbf425f21cf6))\n\n## [8.3.0](https://www.github.com/nodejs/node-gyp/compare/v8.2.0...v8.3.0) (2021-10-11)\n\n\n### Features\n\n* **gyp:** update gyp to v0.10.0 ([#2521](https://www.github.com/nodejs/node-gyp/issues/2521)) ([5585792](https://www.github.com/nodejs/node-gyp/commit/5585792922a97f0629f143c560efd74470eae87f))\n\n\n### Tests\n\n* Python 3.10 was release on Oct. 4th ([#2504](https://www.github.com/nodejs/node-gyp/issues/2504)) ([0a67dcd](https://www.github.com/nodejs/node-gyp/commit/0a67dcd1307f3560495219253241eafcbf4e2a69))\n\n\n### Miscellaneous\n\n* **deps:** bump make-fetch-happen from 8.0.14 to 9.1.0 ([b05b4fe](https://www.github.com/nodejs/node-gyp/commit/b05b4fe9891f718f40edf547e9b50e982826d48a))\n* refactor the creation of config.gypi file ([f2ad87f](https://www.github.com/nodejs/node-gyp/commit/f2ad87ff65f98ad66daa7225ad59d99b759a2b07))\n\n## [8.2.0](https://www.github.com/nodejs/node-gyp/compare/v8.1.0...v8.2.0) (2021-08-23)\n\n\n### Features\n\n* **gyp:** update gyp to v0.9.6 ([#2481](https://www.github.com/nodejs/node-gyp/issues/2481)) ([ed9a9ed](https://www.github.com/nodejs/node-gyp/commit/ed9a9ed653a17c84afa3c327161992d0da7d0cea))\n\n\n### Bug Fixes\n\n* add error arg back into catch block for older Node.js users ([5cde818](https://www.github.com/nodejs/node-gyp/commit/5cde818aac715477e9e9747966bb6b4c4ed070a8))\n* change default gyp update message ([#2420](https://www.github.com/nodejs/node-gyp/issues/2420)) ([cfd12ff](https://www.github.com/nodejs/node-gyp/commit/cfd12ff3bb0eb4525173413ef6a94b3cd8398cad))\n* doc how to update node-gyp independently from npm ([c8c0af7](https://www.github.com/nodejs/node-gyp/commit/c8c0af72e78141a02b5da4cd4d704838333a90bd))\n* missing spaces ([f0882b1](https://www.github.com/nodejs/node-gyp/commit/f0882b1264b2fa701adbc81a3be0b3cba80e333d))\n\n\n### Core\n\n* deep-copy process.config during configure ([#2368](https://www.github.com/nodejs/node-gyp/issues/2368)) ([5f1a06c](https://www.github.com/nodejs/node-gyp/commit/5f1a06c50f3b0c3d292f64948f85a004cfcc5c87))\n\n\n### Miscellaneous\n\n* **deps:** bump tar from 6.1.0 to 6.1.2 ([#2474](https://www.github.com/nodejs/node-gyp/issues/2474)) ([ec15a3e](https://www.github.com/nodejs/node-gyp/commit/ec15a3e5012004172713c11eebcc9d852d32d380))\n* fix typos discovered by codespell ([#2442](https://www.github.com/nodejs/node-gyp/issues/2442)) ([2d0ce55](https://www.github.com/nodejs/node-gyp/commit/2d0ce5595e232a3fc7c562cdf39efb77e2312cc1))\n* GitHub Actions Test on node: [12.x, 14.x, 16.x] ([#2439](https://www.github.com/nodejs/node-gyp/issues/2439)) ([b7bccdb](https://www.github.com/nodejs/node-gyp/commit/b7bccdb527d93b0bb0ce99713f083ce2985fe85c))\n\n\n### Doc\n\n* correct link to \"binding.gyp files out in the wild\" ([#2483](https://www.github.com/nodejs/node-gyp/issues/2483)) ([660dd7b](https://www.github.com/nodejs/node-gyp/commit/660dd7b2a822c184be8027b300e68be67b366772))\n* **wiki:** Add a link to the node-midi binding.gyp file. ([b354711](https://www.github.com/nodejs/node-gyp/commit/b3547115f6e356358138310e857c7f1ec627a8a7))\n* **wiki:** add bcrypt ([e199cfa](https://www.github.com/nodejs/node-gyp/commit/e199cfa8fc6161492d2a6ade2190510d0ebf7c0f))\n* **wiki:** Add helpful information ([4eda827](https://www.github.com/nodejs/node-gyp/commit/4eda8275c03dae6d2f5c40f3c1dbe930d84b0f2b))\n* **wiki:** Add node-canvas ([13a9553](https://www.github.com/nodejs/node-gyp/commit/13a955317b39caf98fd1f412d8d3f41599e979fd))\n* **wiki:** Add node-openvg-canvas and node-openvg. ([61f709e](https://www.github.com/nodejs/node-gyp/commit/61f709ec4d9f256a6467e9ff84430a48eeb629d1))\n* **wiki:** add one more example ([77f3632](https://www.github.com/nodejs/node-gyp/commit/77f363272930d3d4d24fd3973be22e6237128fcc))\n* **wiki:** add topcube, node-osmium, and node-osrm ([1a75d2b](https://www.github.com/nodejs/node-gyp/commit/1a75d2bf2f562ba50846893a516e111cfbb50885))\n* **wiki:** Added details for properly fixing ([3d4d9d5](https://www.github.com/nodejs/node-gyp/commit/3d4d9d52d6b5b49de06bb0bb5b68e2686d2b7ebd))\n* **wiki:** Added Ghostscript4JS ([bf4bed1](https://www.github.com/nodejs/node-gyp/commit/bf4bed1b96a7d22fba6f97f4552ad09f32ac3737))\n* **wiki:** added levelup ([1575bce](https://www.github.com/nodejs/node-gyp/commit/1575bce3a53db628bfb023fd6f3258fdf98c3195))\n* **wiki:** Added nk-mysql (nodamysql) ([5b4f2d0](https://www.github.com/nodejs/node-gyp/commit/5b4f2d0e1d5d3eadfd03aaf9c1668340f76c4bea))\n* **wiki:** Added nk-xrm-installer .gyp references, including .py scripts for providing complete reference to examples of fetching source via http, extracting, and moving files (as opposed to copying) ([ceb3088](https://www.github.com/nodejs/node-gyp/commit/ceb30885b74f6789374ef52267b84767be93ebe4))\n* **wiki:** Added tip about resolving frustrating LNK1181 error ([e64798d](https://www.github.com/nodejs/node-gyp/commit/e64798de8cac6031ad598a86d7599e81b4d20b17))\n* **wiki:** ADDED: Node.js binding to OpenCV ([e2dc777](https://www.github.com/nodejs/node-gyp/commit/e2dc77730b09d7ee8682d7713a7603a2d7aacabd))\n* **wiki:** Adding link to node-cryptopp's gyp file ([875adbe](https://www.github.com/nodejs/node-gyp/commit/875adbe2a4669fa5f2be0250ffbf98fb55e800fd))\n* **wiki:** Adding the sharp library to the list ([9dce0e4](https://www.github.com/nodejs/node-gyp/commit/9dce0e41650c3fa973e6135a79632d022c662a1d))\n* **wiki:** Adds node-fann ([23e3d48](https://www.github.com/nodejs/node-gyp/commit/23e3d485ed894ba7c631e9c062f5e366b50c416c))\n* **wiki:** Adds node-inotify and v8-profiler ([b6e542f](https://www.github.com/nodejs/node-gyp/commit/b6e542f644dbbfe22b88524ec500696e06ee4af7))\n* **wiki:** Bumping Python version from 2.3 to 2.7 as per the node-gyp readme ([55ebd6e](https://www.github.com/nodejs/node-gyp/commit/55ebd6ebacde975bf84f7bf4d8c66e64cc7cd0da))\n* **wiki:** C++ build tools version upgraded ([5b899b7](https://www.github.com/nodejs/node-gyp/commit/5b899b70db729c392ced7c98e8e17590c6499fc3))\n* **wiki:** change bcrypt url to binding.gyp file ([e11bdd8](https://www.github.com/nodejs/node-gyp/commit/e11bdd84de6144492d3eb327d67cbf2d62da1a76))\n* **wiki:** Clarification + direct link to VS2010 ([531c724](https://www.github.com/nodejs/node-gyp/commit/531c724561d947b5d870de8d52dd8c3c51c5ec2d))\n* **wiki:** Correcting the link to node-osmium ([fae7516](https://www.github.com/nodejs/node-gyp/commit/fae7516a1d2829b6e234eaded74fb112ebd79a05))\n* **wiki:** Created \"binding.gyp\" files out in the wild (markdown) ([d4fd143](https://www.github.com/nodejs/node-gyp/commit/d4fd14355bbe57f229f082f47bb2b3670868203f))\n* **wiki:** Created Common issues (markdown) ([a38299e](https://www.github.com/nodejs/node-gyp/commit/a38299ea340ceb0e732c6dc6a1b4760257644839))\n* **wiki:** Created Error: \"pre\" versions of node cannot be installed (markdown) ([98bc80d](https://www.github.com/nodejs/node-gyp/commit/98bc80d7a62ba70c881f3c39d94f804322e57852))\n* **wiki:** Created Linking to OpenSSL (markdown) ([c46d00d](https://www.github.com/nodejs/node-gyp/commit/c46d00d83bac5173dea8bbbb175a1a7de74fdaca))\n* **wiki:** Created Updating npm's bundled node gyp (markdown) ([e0ac8d1](https://www.github.com/nodejs/node-gyp/commit/e0ac8d15af46aadd1c220599e63199b154a514e6))\n* **wiki:** Created use of undeclared identifier 'TypedArray' (markdown) ([65ba711](https://www.github.com/nodejs/node-gyp/commit/65ba71139e9b7f64ac823e575ee9dbf17d937ce4))\n* **wiki:** Created Visual Studio 2010 Setup (markdown) ([5b80e83](https://www.github.com/nodejs/node-gyp/commit/5b80e834c8f79dda9fb2770a876ff3cf649c06f3))\n* **wiki:** Created Visual studio 2012 setup (markdown) ([becef31](https://www.github.com/nodejs/node-gyp/commit/becef316b6c46a33e783667720ee074a0141d1a5))\n* **wiki:** Destroyed Visual Studio 2010 Setup (markdown) ([93423b4](https://www.github.com/nodejs/node-gyp/commit/93423b43606de9664aeb79635825f5e9941ec9bc))\n* **wiki:** Destroyed Visual studio 2012 setup (markdown) ([3601508](https://www.github.com/nodejs/node-gyp/commit/3601508bb10fa05da0ddc7e70d57e4b4dd679657))\n* **wiki:** Different commands for Windows npm v6 vs. v7 ([0fce46b](https://www.github.com/nodejs/node-gyp/commit/0fce46b53340c85e8091cde347d5ed23a443c82f))\n* **wiki:** Drop  in favor of ([9285ff6](https://www.github.com/nodejs/node-gyp/commit/9285ff6e451c52c070a05f05f0a9602621d91d53))\n* **wiki:** Explicit link to Visual C++ 2010 Express ([378c363](https://www.github.com/nodejs/node-gyp/commit/378c3632f02c096ed819ec8f2611c65bef0c0554))\n* **wiki:** fix link to gyp file used to build libsqlite3 ([54db8d7](https://www.github.com/nodejs/node-gyp/commit/54db8d7ac33e3f98220960b5d86cfa18a75b53cb))\n* **wiki:** Fix link to node-zipfile ([92e49a8](https://www.github.com/nodejs/node-gyp/commit/92e49a858ed69cb4847a26a5676ab56ef5e2de33))\n* **wiki:** fixed node-serialport link ([954ee53](https://www.github.com/nodejs/node-gyp/commit/954ee530b3972d1db591fce32368e4e31b5a25d8))\n* **wiki:** I highly missing it in common issue as every windows biggner face that issue ([d617fae](https://www.github.com/nodejs/node-gyp/commit/d617faee29c40871ca5c8f93efd0ce929a40d541))\n* **wiki:** if ouns that the -h did not help. I founs on github that there was support for visual studio 2015, while i couldn't install node-red beacuse it kept telling me the key 2015 was missing. looking in he gyp python code i found the local file was bot up t dat with the github repo. updating took several efforts before i tried to drop the -g option. ([408b72f](https://www.github.com/nodejs/node-gyp/commit/408b72f561329408daeb17834436e381406efcc8))\n* **wiki:** If permissions error, please try  and then the command. ([ee8e1c1](https://www.github.com/nodejs/node-gyp/commit/ee8e1c1e5334096d58e0d6bca6c006f2ee9c88cb))\n* **wiki:** Improve Unix instructions ([c3e5487](https://www.github.com/nodejs/node-gyp/commit/c3e548736645b535ea5bce613d74ca3e98598243))\n* **wiki:** link to docs/ from README ([b52e487](https://www.github.com/nodejs/node-gyp/commit/b52e487eac1eb421573d1e67114a242eeff45a00))\n* **wiki:** Lower case L ([3aa2c6b](https://www.github.com/nodejs/node-gyp/commit/3aa2c6bdb07971b87505e32e32548d75264bd19f))\n* **wiki:** Make changes discussed in https://github.com/nodejs/node-gyp/issues/2416 ([1dcad87](https://www.github.com/nodejs/node-gyp/commit/1dcad873539027511a5f0243baf770ea90f6f4e2))\n* **wiki:** move wiki docs into doc/ ([f0a4835](https://www.github.com/nodejs/node-gyp/commit/f0a48355d86534ec3bdabcdb3ce3340fa2e17f39))\n* **wiki:** node-sass in the wild ([d310a73](https://www.github.com/nodejs/node-gyp/commit/d310a73d64d0065050377baac7047472f7424a1b))\n* **wiki:** node-srs was a 404 ([bbca21a](https://www.github.com/nodejs/node-gyp/commit/bbca21a1e1ede4c473aff365ca71989a5bda7b57))\n* **wiki:** Note: VS2010 seems to be no longer available!  VS2013 or nothing! ([7b5dcaf](https://www.github.com/nodejs/node-gyp/commit/7b5dcafafccdceae4b8f2b53ac9081a694b6ade8))\n* **wiki:** safer doc names, remove unnecessary TypedArray doc ([161c235](https://www.github.com/nodejs/node-gyp/commit/161c2353ef5b562f4acfb2fd77608fcbd0800fc0))\n* **wiki:** sorry, forgot to mention a specific windows version. ([d69dffc](https://www.github.com/nodejs/node-gyp/commit/d69dffc16c2b1e3c60dcb5d1c35a49270ba22a35))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([7444b47](https://www.github.com/nodejs/node-gyp/commit/7444b47a7caac1e14d1da474a7fcfcf88d328017))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([d766b74](https://www.github.com/nodejs/node-gyp/commit/d766b7427851e6c2edc02e2504a7be9be7e330c0))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([d319b0e](https://www.github.com/nodejs/node-gyp/commit/d319b0e98c7085de8e51bc5595eba4264b99a7d5))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([3c6692d](https://www.github.com/nodejs/node-gyp/commit/3c6692d538f0ce973869aa237118b7d2483feccd))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([93392d5](https://www.github.com/nodejs/node-gyp/commit/93392d559ce6f250b9c7fe8177e6c88603809dc1))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([8841158](https://www.github.com/nodejs/node-gyp/commit/88411588f300e9b7c00fe516ecd977a1feeeb15c))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([81bfa1f](https://www.github.com/nodejs/node-gyp/commit/81bfa1f1b63d522a9f8a9ae9ca0c7ae90fe75140))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([d1cd237](https://www.github.com/nodejs/node-gyp/commit/d1cd237bad06fa507adb354b9e2181a14dc63d24))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([3de9e17](https://www.github.com/nodejs/node-gyp/commit/3de9e17e0b8a387eafe7bd18d0ec1e3191d118e8))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([a9b7096](https://www.github.com/nodejs/node-gyp/commit/a9b70968fb956eab3b95672048b94350e1565ca3))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([3236069](https://www.github.com/nodejs/node-gyp/commit/3236069689e7e0eb15b324fce74ab58158956f98))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([1462755](https://www.github.com/nodejs/node-gyp/commit/14627556966e5d513bdb8e5208f0e1300f68991f))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([7ab1337](https://www.github.com/nodejs/node-gyp/commit/7ab133752a6c402bb96dcd3d671d73e03e9487ad))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([640895d](https://www.github.com/nodejs/node-gyp/commit/640895d36b7448c646a3b850c1e159106f83c724))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([ced8c96](https://www.github.com/nodejs/node-gyp/commit/ced8c968457f285ab8989c291d28173d7730833c))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([27b883a](https://www.github.com/nodejs/node-gyp/commit/27b883a350ad0db6b9130d7b996f35855ec34c7a))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([d29fb13](https://www.github.com/nodejs/node-gyp/commit/d29fb134f1c4b9dd729ba95f2979e69e0934809f))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([2765891](https://www.github.com/nodejs/node-gyp/commit/27658913e6220cf0371b4b73e25a0e4ab11108a1))\n* **wiki:** Updated \"binding.gyp\" files out in the wild (markdown) ([dc97766](https://www.github.com/nodejs/node-gyp/commit/dc9776648d432bca6775c176641f16da14522d4c))\n* **wiki:** Updated Error: \"pre\" versions of node cannot be installed (markdown) ([e9f8b33](https://www.github.com/nodejs/node-gyp/commit/e9f8b33d1f87d04f22cb09a814d7c55d0fa38446))\n* **wiki:** Updated Home (markdown) ([3407109](https://www.github.com/nodejs/node-gyp/commit/3407109325cf7ba1e925656b9eb75feffab0557c))\n* **wiki:** Updated Home (markdown) ([6e392bc](https://www.github.com/nodejs/node-gyp/commit/6e392bcdd3dd1691773e6e16e1dffc35931b81e0))\n* **wiki:** Updated Home (markdown) ([65efe32](https://www.github.com/nodejs/node-gyp/commit/65efe32ccb8d446ce569453364f922dd9d27c945))\n* **wiki:** Updated Home (markdown) ([ea28f09](https://www.github.com/nodejs/node-gyp/commit/ea28f0947af91fa638be355143f5df89d2e431c8))\n* **wiki:** Updated Home (markdown) ([0e37ff4](https://www.github.com/nodejs/node-gyp/commit/0e37ff48b306c12149661b375895741d3d710da7))\n* **wiki:** Updated Home (markdown) ([b398ef4](https://www.github.com/nodejs/node-gyp/commit/b398ef46f660d2b1506508550dadfb4c35639e4b))\n* **wiki:** Updated Linking to OpenSSL (markdown) ([8919028](https://www.github.com/nodejs/node-gyp/commit/8919028921fd304f08044098434f0dc6071fb7cf))\n* **wiki:** Updated Linking to OpenSSL (markdown) ([c00eb77](https://www.github.com/nodejs/node-gyp/commit/c00eb778fc7dc27e4dab3a9219035ea20458b33b))\n* **wiki:** Updated node-levelup to node-leveldown (broken links) ([59668bb](https://www.github.com/nodejs/node-gyp/commit/59668bb0b904feccf3c09afa2fd37378c77af967))\n* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([d314854](https://www.github.com/nodejs/node-gyp/commit/d31485415ef69d46effa6090c95698341965de1b))\n* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([11858b0](https://www.github.com/nodejs/node-gyp/commit/11858b0655d1eee00c62ad628e719d4378803d14))\n* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([33561e9](https://www.github.com/nodejs/node-gyp/commit/33561e9cbf5f4eb46111318503c77df2c6eb484a))\n* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([4a7f2d0](https://www.github.com/nodejs/node-gyp/commit/4a7f2d0d869a65c99a78504976567017edadf657))\n* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([979a706](https://www.github.com/nodejs/node-gyp/commit/979a7063b950c088a7f4896fc3a48e1d00dfd231))\n* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([e50e04d](https://www.github.com/nodejs/node-gyp/commit/e50e04d7b6a3754ea0aa11fe8cef491b3bc5bdd4))\n\n## [8.1.0](https://www.github.com/nodejs/node-gyp/compare/v8.0.0...v8.1.0) (2021-05-28)\n\n\n### Features\n\n* **gyp:** update gyp to v0.9.1 ([#2402](https://www.github.com/nodejs/node-gyp/issues/2402)) ([814b1b0](https://www.github.com/nodejs/node-gyp/commit/814b1b0eda102afb9fc87e81638a9cf5b650bb10))\n\n\n### Miscellaneous\n\n* add `release-please-action` for automated releases ([#2395](https://www.github.com/nodejs/node-gyp/issues/2395)) ([07e9d7c](https://www.github.com/nodejs/node-gyp/commit/07e9d7c7ee80ba119ea760c635f72fd8e7efe198))\n\n\n### Core\n\n* fail gracefully if we can't find the username ([#2375](https://www.github.com/nodejs/node-gyp/issues/2375)) ([fca4795](https://www.github.com/nodejs/node-gyp/commit/fca4795512c67dc8420aaa0d913b5b89a4b147f3))\n* log as yes/no whether build dir was created ([#2370](https://www.github.com/nodejs/node-gyp/issues/2370)) ([245dee5](https://www.github.com/nodejs/node-gyp/commit/245dee5b62581309946872ae253226ea3a42c0e3))\n\n\n### Doc\n\n* fix v8.0.0 release date ([4b83c3d](https://www.github.com/nodejs/node-gyp/commit/4b83c3de7300457919d53f26d96ea9ad6f6bedd8))\n* remove redundant version info ([#2403](https://www.github.com/nodejs/node-gyp/issues/2403)) ([1423670](https://www.github.com/nodejs/node-gyp/commit/14236709de64b100a424396b91a5115639daa0ef))\n* Update README.md Visual Studio Community page polski to auto ([#2371](https://www.github.com/nodejs/node-gyp/issues/2371)) ([1b4697a](https://www.github.com/nodejs/node-gyp/commit/1b4697abf69ef574a48faf832a7098f4c6c224a5))\n\n## v8.0.0 2021-04-03\n\n* [[`0d8a6f1b19`](https://github.com/nodejs/node-gyp/commit/0d8a6f1b19)] - **ci**: update actions/setup-node to v2 (#2302) (Sora Morimoto) [#2302](https://github.com/nodejs/node-gyp/pull/2302)\n* [[`15a5c7d45b`](https://github.com/nodejs/node-gyp/commit/15a5c7d45b)] - **ci**: migrate deprecated grammar (#2285) (Jiawen Geng) [#2285](https://github.com/nodejs/node-gyp/pull/2285)\n* [[`06ddde27f9`](https://github.com/nodejs/node-gyp/commit/06ddde27f9)] - **deps**: sync mutual dependencies with npm (DeeDeeG) [#2348](https://github.com/nodejs/node-gyp/pull/2348)\n* [[`a5fd1f41e3`](https://github.com/nodejs/node-gyp/commit/a5fd1f41e3)] - **doc**: add downloads badge (#2352) (Jiawen Geng) [#2352](https://github.com/nodejs/node-gyp/pull/2352)\n* [[`cc1cbce056`](https://github.com/nodejs/node-gyp/commit/cc1cbce056)] - **doc**: update macOS\\_Catalina.md (#2293) (iMrLopez) [#2293](https://github.com/nodejs/node-gyp/pull/2293)\n* [[`6287118fc4`](https://github.com/nodejs/node-gyp/commit/6287118fc4)] - **doc**: updated README.md to copy easily (#2281) (மனோஜ்குமார் பழனிச்சாமி) [#2281](https://github.com/nodejs/node-gyp/pull/2281)\n* [[`66c0f04467`](https://github.com/nodejs/node-gyp/commit/66c0f04467)] - **doc**: add missing `sudo` to Catalina doc (Karl Horky) [#2244](https://github.com/nodejs/node-gyp/pull/2244)\n* [[`0da2e0140d`](https://github.com/nodejs/node-gyp/commit/0da2e0140d)] - **gyp**: update gyp to v0.8.1 (#2355) (DeeDeeG) [#2355](https://github.com/nodejs/node-gyp/pull/2355)\n* [[`0093ec8646`](https://github.com/nodejs/node-gyp/commit/0093ec8646)] - **gyp**: Improve our flake8 linting tests (Christian Clauss) [#2356](https://github.com/nodejs/node-gyp/pull/2356)\n* [[`a78b584236`](https://github.com/nodejs/node-gyp/commit/a78b584236)] - **(SEMVER-MAJOR)** **gyp**: remove support for Python 2 (#2300) (Christian Clauss) [#2300](https://github.com/nodejs/node-gyp/pull/2300)\n* [[`c3c510d89e`](https://github.com/nodejs/node-gyp/commit/c3c510d89e)] - **gyp**: update gyp to v0.8.0 (#2318) (Christian Clauss) [#2318](https://github.com/nodejs/node-gyp/pull/2318)\n* [[`9e1397c52e`](https://github.com/nodejs/node-gyp/commit/9e1397c52e)] - **(SEMVER-MAJOR)** **gyp**: update gyp to v0.7.0 (#2284) (Jiawen Geng) [#2284](https://github.com/nodejs/node-gyp/pull/2284)\n* [[`1bd18f3e77`](https://github.com/nodejs/node-gyp/commit/1bd18f3e77)] - **(SEMVER-MAJOR)** **lib**: drop Python 2 support in find-python.js (#2333) (DeeDeeG) [#2333](https://github.com/nodejs/node-gyp/pull/2333)\n* [[`e81602ef55`](https://github.com/nodejs/node-gyp/commit/e81602ef55)] - **(SEMVER-MAJOR)** **lib**: migrate requests to fetch (#2220) (Matias Lopez) [#2220](https://github.com/nodejs/node-gyp/pull/2220)\n* [[`392b7760b4`](https://github.com/nodejs/node-gyp/commit/392b7760b4)] - **lib**: avoid changing process.config (#2322) (Michaël Zasso) [#2322](https://github.com/nodejs/node-gyp/pull/2322)\n\n## v7.1.2 2020-10-17\n\n* [[`096e3aded5`](https://github.com/nodejs/node-gyp/commit/096e3aded5)] - **gyp**: update gyp to 0.6.2 (Myles Borins) [#2241](https://github.com/nodejs/node-gyp/pull/2241)\n* [[`54f97cd243`](https://github.com/nodejs/node-gyp/commit/54f97cd243)] - **doc**: add cmd to reset `xcode-select` to initial state (Valera Rozuvan) [#2235](https://github.com/nodejs/node-gyp/pull/2235)\n\n## v7.1.1 2020-10-15\n\nThis release restores the location of shared library builds to the pre-v7\nlocation. In v7.0.0 until this release, shared library outputs were placed\nin a lib.target subdirectory inside the build/{Release,Debug} directory for\nbuilds using `make` (Linux, etc.). This is inconsistent with macOS (Xcode)\nbehavior and previous node-gyp behavior so has been reverted.\nWe consider this a bug-fix rather than semver-major change.\n\n* [[`18bf2d1d38`](https://github.com/nodejs/node-gyp/commit/18bf2d1d38)] - **deps**: update deps to match npm@7 (Rod Vagg) [#2240](https://github.com/nodejs/node-gyp/pull/2240)\n* [[`ee6a837cb7`](https://github.com/nodejs/node-gyp/commit/ee6a837cb7)] - **gyp**: update gyp to 0.6.1 (Rod Vagg) [#2238](https://github.com/nodejs/node-gyp/pull/2238)\n* [[`3e7f8ccafc`](https://github.com/nodejs/node-gyp/commit/3e7f8ccafc)] - **lib**: better log message when ps fails (Martin Midtgaard) [#2229](https://github.com/nodejs/node-gyp/pull/2229)\n* [[`7fb314339f`](https://github.com/nodejs/node-gyp/commit/7fb314339f)] - **test**: GitHub Actions: Test on Python 3.9 (Christian Clauss) [#2230](https://github.com/nodejs/node-gyp/pull/2230)\n* [[`754996b9ec`](https://github.com/nodejs/node-gyp/commit/754996b9ec)] - **doc**: replace status badges with new Actions badge (Rod Vagg) [#2218](https://github.com/nodejs/node-gyp/pull/2218)\n* [[`2317dc400c`](https://github.com/nodejs/node-gyp/commit/2317dc400c)] - **ci**: switch to GitHub Actions (Shelley Vohr) [#2210](https://github.com/nodejs/node-gyp/pull/2210)\n* [[`2cca9b74f7`](https://github.com/nodejs/node-gyp/commit/2cca9b74f7)] - **doc**: drop the --production flag for installing windows-build-tools (DeeDeeG) [#2206](https://github.com/nodejs/node-gyp/pull/2206)\n\n## v7.1.0 2020-08-12\n\n* [[`aaf33c3029`](https://github.com/nodejs/node-gyp/commit/aaf33c3029)] - **build**: add update-gyp script (Samuel Attard) [#2167](https://github.com/nodejs/node-gyp/pull/2167)\n* * [[`3baa4e4172`](https://github.com/nodejs/node-gyp/commit/3baa4e4172)] - **(SEMVER-MINOR)** **gyp**: update gyp to 0.4.0 (Samuel Attard) [#2165](https://github.com/nodejs/node-gyp/pull/2165)\n* * [[`f461d56c53`](https://github.com/nodejs/node-gyp/commit/f461d56c53)] - **(SEMVER-MINOR)** **build**: support apple silicon (arm64 darwin) builds (Samuel Attard) [#2165](https://github.com/nodejs/node-gyp/pull/2165)\n* * [[`ee6fa7d3bc`](https://github.com/nodejs/node-gyp/commit/ee6fa7d3bc)] - **docs**: note that node-gyp@7 should solve Catalina CLT issues (Rod Vagg) [#2156](https://github.com/nodejs/node-gyp/pull/2156)\n* * [[`4fc8ff179d`](https://github.com/nodejs/node-gyp/commit/4fc8ff179d)] - **doc**: silence curl for macOS Catalina acid test (Chia Wei Ong) [#2150](https://github.com/nodejs/node-gyp/pull/2150)\n* * [[`7857cb2eb1`](https://github.com/nodejs/node-gyp/commit/7857cb2eb1)] - **deps**: increase \"engines\" to \"node\" : \"\\>= 10.12.0\" (DeeDeeG) [#2153](https://github.com/nodejs/node-gyp/pull/2153)\n\n## v7.0.0 2020-06-03\n\n* [[`e18a61afc1`](https://github.com/nodejs/node-gyp/commit/e18a61afc1)] - **build**: shrink bloated addon binaries on windows (Shelley Vohr) [#2060](https://github.com/nodejs/node-gyp/pull/2060)\n* [[`4937722cf5`](https://github.com/nodejs/node-gyp/commit/4937722cf5)] - **(SEMVER-MAJOR)** **deps**: replace mkdirp with {recursive} mkdir (Rod Vagg) [#2123](https://github.com/nodejs/node-gyp/pull/2123)\n* [[`d45438a047`](https://github.com/nodejs/node-gyp/commit/d45438a047)] - **(SEMVER-MAJOR)** **deps**: update deps, match to npm@7 (Rod Vagg) [#2126](https://github.com/nodejs/node-gyp/pull/2126)\n* [[`ba4f34b7d6`](https://github.com/nodejs/node-gyp/commit/ba4f34b7d6)] - **doc**: update catalina xcode clt download link (Dario Vladovic) [#2133](https://github.com/nodejs/node-gyp/pull/2133)\n* [[`f7bfce96ed`](https://github.com/nodejs/node-gyp/commit/f7bfce96ed)] - **doc**: update acid test and introduce curl|bash test script (Dario Vladovic) [#2105](https://github.com/nodejs/node-gyp/pull/2105)\n* [[`e529f3309d`](https://github.com/nodejs/node-gyp/commit/e529f3309d)] - **doc**: update README to reflect upgrade to gyp-next (Ujjwal Sharma) [#2092](https://github.com/nodejs/node-gyp/pull/2092)\n* [[`9aed6286a3`](https://github.com/nodejs/node-gyp/commit/9aed6286a3)] - **doc**: give more attention to Catalina issues doc (Matheus Marchini) [#2134](https://github.com/nodejs/node-gyp/pull/2134)\n* [[`963f2a7b48`](https://github.com/nodejs/node-gyp/commit/963f2a7b48)] - **doc**: improve Catalina discoverability for search engines (Matheus Marchini) [#2135](https://github.com/nodejs/node-gyp/pull/2135)\n* [[`7b75af349b`](https://github.com/nodejs/node-gyp/commit/7b75af349b)] - **doc**: add macOS Catalina software update info (Karl Horky) [#2078](https://github.com/nodejs/node-gyp/pull/2078)\n* [[`4f23c7bee2`](https://github.com/nodejs/node-gyp/commit/4f23c7bee2)] - **doc**: update link to the code of conduct (#2073) (Michaël Zasso) [#2073](https://github.com/nodejs/node-gyp/pull/2073)\n* [[`473cfa283f`](https://github.com/nodejs/node-gyp/commit/473cfa283f)] - **doc**: note in README that Python 3.8 is supported (#2072) (Michaël Zasso) [#2072](https://github.com/nodejs/node-gyp/pull/2072)\n* [[`e7402b4a7c`](https://github.com/nodejs/node-gyp/commit/e7402b4a7c)] - **doc**: update catalina xcode cli tools download link (#2044) (Dario Vladović) [#2044](https://github.com/nodejs/node-gyp/pull/2044)\n* [[`35de45984f`](https://github.com/nodejs/node-gyp/commit/35de45984f)] - **doc**: update catalina xcode cli tools download link; formatting (Jonathan Hult) [#2034](https://github.com/nodejs/node-gyp/pull/2034)\n* [[`48642191f5`](https://github.com/nodejs/node-gyp/commit/48642191f5)] - **doc**: add download link for Command Line Tools for Xcode (Przemysław Bitkowski) [#2029](https://github.com/nodejs/node-gyp/pull/2029)\n* [[`ae5b150051`](https://github.com/nodejs/node-gyp/commit/ae5b150051)] - **doc**: Catalina suggestion: remove /Library/Developer/CommandLineTools (Christian Clauss) [#2022](https://github.com/nodejs/node-gyp/pull/2022)\n* [[`d1dea13fe4`](https://github.com/nodejs/node-gyp/commit/d1dea13fe4)] - **doc**: fix changelog 6.1.0 release year to be 2020 (Quentin Vernot) [#2021](https://github.com/nodejs/node-gyp/pull/2021)\n* [[`6356117b08`](https://github.com/nodejs/node-gyp/commit/6356117b08)] - **doc, bin**: stop suggesting opening  node-gyp issues (Bartosz Sosnowski) [#2096](https://github.com/nodejs/node-gyp/pull/2096)\n* [[`a6b76a8b48`](https://github.com/nodejs/node-gyp/commit/a6b76a8b48)] - **gyp**: update gyp to 0.2.1 (Ujjwal Sharma) [#2092](https://github.com/nodejs/node-gyp/pull/2092)\n* [[`ebc34ec823`](https://github.com/nodejs/node-gyp/commit/ebc34ec823)] - **gyp**: update gyp to 0.2.0 (Ujjwal Sharma) [#2092](https://github.com/nodejs/node-gyp/pull/2092)\n* [[`972780bde7`](https://github.com/nodejs/node-gyp/commit/972780bde7)] - **(SEMVER-MAJOR)** **gyp**: sync code base with nodejs repo (#1975) (Michaël Zasso) [#1975](https://github.com/nodejs/node-gyp/pull/1975)\n* [[`c255ffbf6a`](https://github.com/nodejs/node-gyp/commit/c255ffbf6a)] - **lib**: drop \"-2\" flag for \"py.exe\" launcher (DeeDeeG) [#2131](https://github.com/nodejs/node-gyp/pull/2131)\n* [[`1f7e1e93b5`](https://github.com/nodejs/node-gyp/commit/1f7e1e93b5)] - **lib**: ignore VS instances that cause COMExceptions (Andrew Casey) [#2018](https://github.com/nodejs/node-gyp/pull/2018)\n* [[`741ab096d5`](https://github.com/nodejs/node-gyp/commit/741ab096d5)] - **test**: remove support for EOL versions of Node.js (Shelley Vohr)\n* [[`ca86ef2539`](https://github.com/nodejs/node-gyp/commit/ca86ef2539)] - **test**: bump actions/checkout from v1 to v2 (BSKY) [#2063](https://github.com/nodejs/node-gyp/pull/2063)\n\n## v6.1.0 2020-01-08\n\n* [[`9a7dd16b76`](https://github.com/nodejs/node-gyp/commit/9a7dd16b76)] - **doc**: remove backticks from Python version list (Rod Vagg) [#2011](https://github.com/nodejs/node-gyp/pull/2011)\n* [[`26cd6eaea6`](https://github.com/nodejs/node-gyp/commit/26cd6eaea6)] - **doc**: add GitHub Actions badge (#1994) (Rod Vagg) [#1994](https://github.com/nodejs/node-gyp/pull/1994)\n* [[`312c12ef4f`](https://github.com/nodejs/node-gyp/commit/312c12ef4f)] - **doc**: update macOS\\_Catalina.md (#1992) (James Home) [#1992](https://github.com/nodejs/node-gyp/pull/1992)\n* [[`f7b6b6b77b`](https://github.com/nodejs/node-gyp/commit/f7b6b6b77b)] - **doc**: fix typo in README.md (#1985) (Suraneti Rodsuwan) [#1985](https://github.com/nodejs/node-gyp/pull/1985)\n* [[`6b8f2652dd`](https://github.com/nodejs/node-gyp/commit/6b8f2652dd)] - **doc**: add travis badge (Rod Vagg) [#1971](https://github.com/nodejs/node-gyp/pull/1971)\n* [[`20aa0b44f7`](https://github.com/nodejs/node-gyp/commit/20aa0b44f7)] - **doc**: macOS Catalina add two commands (Christian Clauss) [#1962](https://github.com/nodejs/node-gyp/pull/1962)\n* [[`14f2a07a39`](https://github.com/nodejs/node-gyp/commit/14f2a07a39)] - **gyp**: list(dict) so we can del dict(key) while iterating (Christian Clauss) [#2009](https://github.com/nodejs/node-gyp/pull/2009)\n* [[`f242ce4d2c`](https://github.com/nodejs/node-gyp/commit/f242ce4d2c)] - **lib**: compatibility with semver ≥ 7 (`new` for semver.Range) (Xavier Guimard) [#2006](https://github.com/nodejs/node-gyp/pull/2006)\n* [[`3bcba2a01a`](https://github.com/nodejs/node-gyp/commit/3bcba2a01a)] - **(SEMVER-MINOR)** **lib**: noproxy support, match proxy detection to `request` (Matias Lopez) [#1978](https://github.com/nodejs/node-gyp/pull/1978)\n* [[`470cc2178e`](https://github.com/nodejs/node-gyp/commit/470cc2178e)] - **test**: remove old docker test harness (#1993) (Rod Vagg) [#1993](https://github.com/nodejs/node-gyp/pull/1993)\n* [[`31ecc8421d`](https://github.com/nodejs/node-gyp/commit/31ecc8421d)] - **test**: add Windows to GitHub Actions testing (#1996) (Christian Clauss) [#1996](https://github.com/nodejs/node-gyp/pull/1996)\n* [[`5a729e86ee`](https://github.com/nodejs/node-gyp/commit/5a729e86ee)] - **test**: fix typo in header download test (#2001) (Richard Lau) [#2001](https://github.com/nodejs/node-gyp/pull/2001)\n* [[`345c70e56d`](https://github.com/nodejs/node-gyp/commit/345c70e56d)] - **test**: direct python invocation & simpler pyenv (Matias Lopez) [#1979](https://github.com/nodejs/node-gyp/pull/1979)\n* [[`d6a7e0e1fb`](https://github.com/nodejs/node-gyp/commit/d6a7e0e1fb)] - **test**: fix macOS Travis on Python 2.7 & 3.7 (Christian Clauss) [#1979](https://github.com/nodejs/node-gyp/pull/1979)\n* [[`5a64e9bd32`](https://github.com/nodejs/node-gyp/commit/5a64e9bd32)] - **test**: initial Github Actions with Ubuntu & macOS (Christian Clauss) [#1985](https://github.com/nodejs/node-gyp/pull/1985)\n* [[`04da736d38`](https://github.com/nodejs/node-gyp/commit/04da736d38)] - **test**: fix Python unittests (cclauss) [#1961](https://github.com/nodejs/node-gyp/pull/1961)\n* [[`0670e5189d`](https://github.com/nodejs/node-gyp/commit/0670e5189d)] - **test**: add header download test (Rod Vagg) [#1796](https://github.com/nodejs/node-gyp/pull/1796)\n* [[`c506a6a150`](https://github.com/nodejs/node-gyp/commit/c506a6a150)] - **test**: configure proper devDir for invoking configure() (Rod Vagg) [#1796](https://github.com/nodejs/node-gyp/pull/1796)\n\n## v6.0.1 2019-11-01\n\n* [[`8ec2e681d5`](https://github.com/nodejs/node-gyp/commit/8ec2e681d5)] - **doc**: add macOS\\_Catalina.md document (cclauss) [#1940](https://github.com/nodejs/node-gyp/pull/1940)\n* [[`1b11be63cc`](https://github.com/nodejs/node-gyp/commit/1b11be63cc)] - **gyp**: python3 fixes: utf8 decode, use of 'None' in eval (Wilfried Goesgens) [#1925](https://github.com/nodejs/node-gyp/pull/1925)\n* [[`c0282daa48`](https://github.com/nodejs/node-gyp/commit/c0282daa48)] - **gyp**: iteritems() -\\> items() in compile\\_commands\\_json.py (cclauss) [#1947](https://github.com/nodejs/node-gyp/pull/1947)\n* [[`d8e09a1b6a`](https://github.com/nodejs/node-gyp/commit/d8e09a1b6a)] - **gyp**: make cmake python3 compatible (gengjiawen) [#1944](https://github.com/nodejs/node-gyp/pull/1944)\n* [[`9c0f3404f0`](https://github.com/nodejs/node-gyp/commit/9c0f3404f0)] - **gyp**: fix TypeError in XcodeVersion() (Christian Clauss) [#1939](https://github.com/nodejs/node-gyp/pull/1939)\n* [[`bb2eb72a3f`](https://github.com/nodejs/node-gyp/commit/bb2eb72a3f)] - **gyp**: finish decode stdout on Python 3 (Christian Clauss) [#1937](https://github.com/nodejs/node-gyp/pull/1937)\n* [[`f0693413d9`](https://github.com/nodejs/node-gyp/commit/f0693413d9)] - **src,win**: allow 403 errors for arm64 node.lib (Richard Lau) [#1934](https://github.com/nodejs/node-gyp/pull/1934)\n* [[`c60c22de58`](https://github.com/nodejs/node-gyp/commit/c60c22de58)] - **deps**: update deps to roughly match current npm@6 (Rod Vagg) [#1920](https://github.com/nodejs/node-gyp/pull/1920)\n* [[`b91718eefc`](https://github.com/nodejs/node-gyp/commit/b91718eefc)] - **test**: upgrade Linux Travis CI to Python 3.8 (Christian Clauss) [#1923](https://github.com/nodejs/node-gyp/pull/1923)\n* [[`3538a317b6`](https://github.com/nodejs/node-gyp/commit/3538a317b6)] - **doc**: adjustments to the README.md for new users (Dan Pike) [#1919](https://github.com/nodejs/node-gyp/pull/1919)\n* [[`4fff8458c0`](https://github.com/nodejs/node-gyp/commit/4fff8458c0)] - **travis**: ignore failed `brew upgrade npm`, update xcode (Christian Clauss) [#1932](https://github.com/nodejs/node-gyp/pull/1932)\n* [[`60e4488f08`](https://github.com/nodejs/node-gyp/commit/60e4488f08)] - **build**: avoid bare exceptions in xcode\\_emulation.py (Christian Clauss) [#1932](https://github.com/nodejs/node-gyp/pull/1932)\n* [[`032db2a2d0`](https://github.com/nodejs/node-gyp/commit/032db2a2d0)] - **lib,install**: always download SHA sums on Windows (Sam Hughes) [#1926](https://github.com/nodejs/node-gyp/pull/1926)\n* [[`5a83630c33`](https://github.com/nodejs/node-gyp/commit/5a83630c33)] - **travis**: add Windows + Python 3.8 to the mix (Rod Vagg) [#1921](https://github.com/nodejs/node-gyp/pull/1921)\n\n## v6.0.0 2019-10-04\n\n* [[`dd0e97ef0b`](https://github.com/nodejs/node-gyp/commit/dd0e97ef0b)] - **(SEMVER-MAJOR)** **lib**: try to find `python` after `python3` (Sam Roberts) [#1907](https://github.com/nodejs/node-gyp/pull/1907)\n* [[`f60ed47d14`](https://github.com/nodejs/node-gyp/commit/f60ed47d14)] - **travis**: add Python 3.5 and 3.6 tests on Linux (Christian Clauss) [#1903](https://github.com/nodejs/node-gyp/pull/1903)\n* [[`c763ca1838`](https://github.com/nodejs/node-gyp/commit/c763ca1838)] - **(SEMVER-MAJOR)** **doc**: Declare that node-gyp is Python 3 compatible (cclauss) [#1811](https://github.com/nodejs/node-gyp/pull/1811)\n* [[`3d1c60ab81`](https://github.com/nodejs/node-gyp/commit/3d1c60ab81)] - **(SEMVER-MAJOR)** **lib**: accept Python 3 by default (João Reis) [#1844](https://github.com/nodejs/node-gyp/pull/1844)\n* [[`c6e3b65a23`](https://github.com/nodejs/node-gyp/commit/c6e3b65a23)] - **(SEMVER-MAJOR)** **lib**: raise the minimum Python version from 2.6 to 2.7 (cclauss) [#1818](https://github.com/nodejs/node-gyp/pull/1818)\n\n## v5.1.1 2020-05-25\n\n* [[`bdd3a79abe`](https://github.com/nodejs/node-gyp/commit/bdd3a79abe)] - **build**: shrink bloated addon binaries on windows (Shelley Vohr) [#2060](https://github.com/nodejs/node-gyp/pull/2060)\n* [[`1f2ba75bc0`](https://github.com/nodejs/node-gyp/commit/1f2ba75bc0)] - **doc**: add macOS Catalina software update info (Karl Horky) [#2078](https://github.com/nodejs/node-gyp/pull/2078)\n* [[`c106d915f5`](https://github.com/nodejs/node-gyp/commit/c106d915f5)] - **doc**: update catalina xcode cli tools download link (#2044) (Dario Vladović) [#2044](https://github.com/nodejs/node-gyp/pull/2044)\n* [[`9a6fea92e2`](https://github.com/nodejs/node-gyp/commit/9a6fea92e2)] - **doc**: update catalina xcode cli tools download link; formatting (Jonathan Hult) [#2034](https://github.com/nodejs/node-gyp/pull/2034)\n* [[`59b0b1add8`](https://github.com/nodejs/node-gyp/commit/59b0b1add8)] - **doc**: add download link for Command Line Tools for Xcode (Przemysław Bitkowski) [#2029](https://github.com/nodejs/node-gyp/pull/2029)\n* [[`bb8d0e7b10`](https://github.com/nodejs/node-gyp/commit/bb8d0e7b10)] - **doc**: Catalina suggestion: remove /Library/Developer/CommandLineTools (Christian Clauss) [#2022](https://github.com/nodejs/node-gyp/pull/2022)\n* [[`fb2e80d4e3`](https://github.com/nodejs/node-gyp/commit/fb2e80d4e3)] - **doc**: update link to the code of conduct (#2073) (Michaël Zasso) [#2073](https://github.com/nodejs/node-gyp/pull/2073)\n* [[`251d9c885c`](https://github.com/nodejs/node-gyp/commit/251d9c885c)] - **doc**: note in README that Python 3.8 is supported (#2072) (Michaël Zasso) [#2072](https://github.com/nodejs/node-gyp/pull/2072)\n* [[`2b6fc3c8d6`](https://github.com/nodejs/node-gyp/commit/2b6fc3c8d6)] - **doc, bin**: stop suggesting opening  node-gyp issues (Bartosz Sosnowski) [#2096](https://github.com/nodejs/node-gyp/pull/2096)\n* [[`a876ae58ad`](https://github.com/nodejs/node-gyp/commit/a876ae58ad)] - **test**: bump actions/checkout from v1 to v2 (BSKY) [#2063](https://github.com/nodejs/node-gyp/pull/2063)\n\n## v5.1.0 2020-02-05\n\n* [[`f37a8b40d0`](https://github.com/nodejs/node-gyp/commit/f37a8b40d0)] - **doc**: add GitHub Actions badge (#1994) (Rod Vagg) [#1994](https://github.com/nodejs/node-gyp/pull/1994)\n* [[`cb3f6aae5e`](https://github.com/nodejs/node-gyp/commit/cb3f6aae5e)] - **doc**: update macOS\\_Catalina.md (#1992) (James Home) [#1992](https://github.com/nodejs/node-gyp/pull/1992)\n* [[`0607596a4c`](https://github.com/nodejs/node-gyp/commit/0607596a4c)] - **doc**: fix typo in README.md (#1985) (Suraneti Rodsuwan) [#1985](https://github.com/nodejs/node-gyp/pull/1985)\n* [[`0d5a415a14`](https://github.com/nodejs/node-gyp/commit/0d5a415a14)] - **doc**: add travis badge (Rod Vagg) [#1971](https://github.com/nodejs/node-gyp/pull/1971)\n* [[`103740cd95`](https://github.com/nodejs/node-gyp/commit/103740cd95)] - **gyp**: list(dict) so we can del dict(key) while iterating (Christian Clauss) [#2009](https://github.com/nodejs/node-gyp/pull/2009)\n* [[`278dcddbdd`](https://github.com/nodejs/node-gyp/commit/278dcddbdd)] - **lib**: ignore VS instances that cause COMExceptions (Andrew Casey) [#2018](https://github.com/nodejs/node-gyp/pull/2018)\n* [[`1694907bbf`](https://github.com/nodejs/node-gyp/commit/1694907bbf)] - **lib**: compatibility with semver ≥ 7 (`new` for semver.Range) (Xavier Guimard) [#2006](https://github.com/nodejs/node-gyp/pull/2006)\n* [[`a3f1143514`](https://github.com/nodejs/node-gyp/commit/a3f1143514)] - **(SEMVER-MINOR)** **lib**: noproxy support, match proxy detection to `request` (Matias Lopez) [#1978](https://github.com/nodejs/node-gyp/pull/1978)\n* [[`52365819c7`](https://github.com/nodejs/node-gyp/commit/52365819c7)] - **test**: remove old docker test harness (#1993) (Rod Vagg) [#1993](https://github.com/nodejs/node-gyp/pull/1993)\n* [[`bc509c511d`](https://github.com/nodejs/node-gyp/commit/bc509c511d)] - **test**: add Windows to GitHub Actions testing (#1996) (Christian Clauss) [#1996](https://github.com/nodejs/node-gyp/pull/1996)\n* [[`91ee26dd48`](https://github.com/nodejs/node-gyp/commit/91ee26dd48)] - **test**: fix typo in header download test (#2001) (Richard Lau) [#2001](https://github.com/nodejs/node-gyp/pull/2001)\n* [[`0923f344c9`](https://github.com/nodejs/node-gyp/commit/0923f344c9)] - **test**: direct python invocation & simpler pyenv (Matias Lopez) [#1979](https://github.com/nodejs/node-gyp/pull/1979)\n* [[`32c8744b34`](https://github.com/nodejs/node-gyp/commit/32c8744b34)] - **test**: fix macOS Travis on Python 2.7 & 3.7 (Christian Clauss) [#1979](https://github.com/nodejs/node-gyp/pull/1979)\n* [[`fd4b1351e4`](https://github.com/nodejs/node-gyp/commit/fd4b1351e4)] - **test**: initial Github Actions with Ubuntu & macOS (Christian Clauss) [#1985](https://github.com/nodejs/node-gyp/pull/1985)\n\n## v5.0.7 2019-12-16\n\nRepublish of v5.0.6 with unnecessary tarball removed from pack file.\n\n## v5.0.6 2019-12-16\n\n* [[`cdec00286f`](https://github.com/nodejs/node-gyp/commit/cdec00286f)] - **doc**: adjustments to the README.md for new users (Dan Pike) [#1919](https://github.com/nodejs/node-gyp/pull/1919)\n* [[`b7c8233ef2`](https://github.com/nodejs/node-gyp/commit/b7c8233ef2)] - **test**: fix Python unittests (cclauss) [#1961](https://github.com/nodejs/node-gyp/pull/1961)\n* [[`e12b00ab0a`](https://github.com/nodejs/node-gyp/commit/e12b00ab0a)] - **doc**: macOS Catalina add two commands (Christian Clauss) [#1962](https://github.com/nodejs/node-gyp/pull/1962)\n* [[`70b9890c0d`](https://github.com/nodejs/node-gyp/commit/70b9890c0d)] - **test**: add header download test (Rod Vagg) [#1796](https://github.com/nodejs/node-gyp/pull/1796)\n* [[`4029fa8629`](https://github.com/nodejs/node-gyp/commit/4029fa8629)] - **test**: configure proper devDir for invoking configure() (Rod Vagg) [#1796](https://github.com/nodejs/node-gyp/pull/1796)\n* [[`fe8b02cc8b`](https://github.com/nodejs/node-gyp/commit/fe8b02cc8b)] - **doc**: add macOS\\_Catalina.md document (cclauss) [#1940](https://github.com/nodejs/node-gyp/pull/1940)\n* [[`8ea47ce365`](https://github.com/nodejs/node-gyp/commit/8ea47ce365)] - **gyp**: python3 fixes: utf8 decode, use of 'None' in eval (Wilfried Goesgens) [#1925](https://github.com/nodejs/node-gyp/pull/1925)\n* [[`c7229716ba`](https://github.com/nodejs/node-gyp/commit/c7229716ba)] - **gyp**: iteritems() -\\> items() in compile\\_commands\\_json.py (cclauss) [#1947](https://github.com/nodejs/node-gyp/pull/1947)\n* [[`2a18b2a0f8`](https://github.com/nodejs/node-gyp/commit/2a18b2a0f8)] - **gyp**: make cmake python3 compatible (gengjiawen) [#1944](https://github.com/nodejs/node-gyp/pull/1944)\n* [[`70f391e844`](https://github.com/nodejs/node-gyp/commit/70f391e844)] - **gyp**: fix TypeError in XcodeVersion() (Christian Clauss) [#1939](https://github.com/nodejs/node-gyp/pull/1939)\n* [[`9f4f0fa34e`](https://github.com/nodejs/node-gyp/commit/9f4f0fa34e)] - **gyp**: finish decode stdout on Python 3 (Christian Clauss) [#1937](https://github.com/nodejs/node-gyp/pull/1937)\n* [[`7cf507906d`](https://github.com/nodejs/node-gyp/commit/7cf507906d)] - **src,win**: allow 403 errors for arm64 node.lib (Richard Lau) [#1934](https://github.com/nodejs/node-gyp/pull/1934)\n* [[`ad0d182c01`](https://github.com/nodejs/node-gyp/commit/ad0d182c01)] - **deps**: update deps to roughly match current npm@6 (Rod Vagg) [#1920](https://github.com/nodejs/node-gyp/pull/1920)\n* [[`1553081ed6`](https://github.com/nodejs/node-gyp/commit/1553081ed6)] - **test**: upgrade Linux Travis CI to Python 3.8 (Christian Clauss) [#1923](https://github.com/nodejs/node-gyp/pull/1923)\n* [[`0705cae9aa`](https://github.com/nodejs/node-gyp/commit/0705cae9aa)] - **travis**: ignore failed `brew upgrade npm`, update xcode (Christian Clauss) [#1932](https://github.com/nodejs/node-gyp/pull/1932)\n* [[`7bfdb6f5bf`](https://github.com/nodejs/node-gyp/commit/7bfdb6f5bf)] - **build**: avoid bare exceptions in xcode\\_emulation.py (Christian Clauss) [#1932](https://github.com/nodejs/node-gyp/pull/1932)\n* [[`7edf7658fa`](https://github.com/nodejs/node-gyp/commit/7edf7658fa)] - **lib,install**: always download SHA sums on Windows (Sam Hughes) [#1926](https://github.com/nodejs/node-gyp/pull/1926)\n* [[`69056d04fe`](https://github.com/nodejs/node-gyp/commit/69056d04fe)] - **travis**: add Windows + Python 3.8 to the mix (Rod Vagg) [#1921](https://github.com/nodejs/node-gyp/pull/1921)\n\n## v5.0.5 2019-10-04\n\n* [[`3891391746`](https://github.com/nodejs/node-gyp/commit/3891391746)] - **doc**: reconcile README with Python 3 compat changes (Rod Vagg) [#1911](https://github.com/nodejs/node-gyp/pull/1911)\n* [[`07f81f1920`](https://github.com/nodejs/node-gyp/commit/07f81f1920)] - **lib**: accept Python 3 after Python 2 (Sam Roberts) [#1910](https://github.com/nodejs/node-gyp/pull/1910)\n* [[`04ce59f4a2`](https://github.com/nodejs/node-gyp/commit/04ce59f4a2)] - **doc**: clarify Python configuration, etc (Sam Roberts) [#1908](https://github.com/nodejs/node-gyp/pull/1908)\n* [[`01c46ee3df`](https://github.com/nodejs/node-gyp/commit/01c46ee3df)] - **gyp**: add \\_\\_lt\\_\\_ to MSVSSolutionEntry (João Reis) [#1904](https://github.com/nodejs/node-gyp/pull/1904)\n* [[`735d961b99`](https://github.com/nodejs/node-gyp/commit/735d961b99)] - **win**: support VS 2017 Desktop Express (João Reis) [#1902](https://github.com/nodejs/node-gyp/pull/1902)\n* [[`3834156a92`](https://github.com/nodejs/node-gyp/commit/3834156a92)] - **test**: add Python 3.5 and 3.6 tests on Linux (cclauss) [#1909](https://github.com/nodejs/node-gyp/pull/1909)\n* [[`1196e990d8`](https://github.com/nodejs/node-gyp/commit/1196e990d8)] - **src**: update to standard@14 (Rod Vagg) [#1899](https://github.com/nodejs/node-gyp/pull/1899)\n* [[`53ee7dfe89`](https://github.com/nodejs/node-gyp/commit/53ee7dfe89)] - **gyp**: fix undefined name: cflags --\\> ldflags (Christian Clauss) [#1901](https://github.com/nodejs/node-gyp/pull/1901)\n* [[`5871dcf6c9`](https://github.com/nodejs/node-gyp/commit/5871dcf6c9)] - **src,win**: add support for fetching arm64 node.lib (Richard Townsend) [#1875](https://github.com/nodejs/node-gyp/pull/1875)\n\n## v5.0.4 2019-09-27\n\n* [[`1236869ffc`](https://github.com/nodejs/node-gyp/commit/1236869ffc)] - **gyp**: modify XcodeVersion() to convert \"4.2\" to \"0420\" and \"10.0\" to \"1000\" (Christian Clauss) [#1895](https://github.com/nodejs/node-gyp/pull/1895)\n* [[`36638afe48`](https://github.com/nodejs/node-gyp/commit/36638afe48)] - **gyp**: more decode stdout on Python 3 (cclauss) [#1894](https://github.com/nodejs/node-gyp/pull/1894)\n* [[`f753c167c5`](https://github.com/nodejs/node-gyp/commit/f753c167c5)] - **gyp**: decode stdout on Python 3 (cclauss) [#1890](https://github.com/nodejs/node-gyp/pull/1890)\n* [[`60a4083523`](https://github.com/nodejs/node-gyp/commit/60a4083523)] - **doc**: update xcode install instructions to match Node's BUILDING (Nhan Khong) [#1884](https://github.com/nodejs/node-gyp/pull/1884)\n* [[`19dbc9ac32`](https://github.com/nodejs/node-gyp/commit/19dbc9ac32)] - **deps**: update tar to 4.4.12 (Matheus Marchini) [#1889](https://github.com/nodejs/node-gyp/pull/1889)\n* [[`5f3ed92181`](https://github.com/nodejs/node-gyp/commit/5f3ed92181)] - **bin**: fix the usage instructions (Halit Ogunc) [#1888](https://github.com/nodejs/node-gyp/pull/1888)\n* [[`aab118edf1`](https://github.com/nodejs/node-gyp/commit/aab118edf1)] - **lib**: adding keep-alive header to download requests (Milad Farazmand) [#1863](https://github.com/nodejs/node-gyp/pull/1863)\n* [[`1186e89326`](https://github.com/nodejs/node-gyp/commit/1186e89326)] - **lib**: ignore non-critical os.userInfo() failures (Rod Vagg) [#1835](https://github.com/nodejs/node-gyp/pull/1835)\n* [[`785e527c3d`](https://github.com/nodejs/node-gyp/commit/785e527c3d)] - **doc**: fix missing argument for setting python path (lagorsse) [#1802](https://github.com/nodejs/node-gyp/pull/1802)\n* [[`a97615196c`](https://github.com/nodejs/node-gyp/commit/a97615196c)] - **gyp**: rm semicolons (Python != JavaScript) (MattIPv4) [#1858](https://github.com/nodejs/node-gyp/pull/1858)\n* [[`06019bac24`](https://github.com/nodejs/node-gyp/commit/06019bac24)] - **gyp**: assorted typo fixes (XhmikosR) [#1853](https://github.com/nodejs/node-gyp/pull/1853)\n* [[`3f4972c1ca`](https://github.com/nodejs/node-gyp/commit/3f4972c1ca)] - **gyp**: use \"is\" when comparing to None (Vladyslav Burzakovskyy) [#1860](https://github.com/nodejs/node-gyp/pull/1860)\n* [[`1cb4708073`](https://github.com/nodejs/node-gyp/commit/1cb4708073)] - **src,win**: improve unmanaged handling (Peter Sabath) [#1852](https://github.com/nodejs/node-gyp/pull/1852)\n* [[`5553cd910e`](https://github.com/nodejs/node-gyp/commit/5553cd910e)] - **gyp**: improve Windows+Cygwin compatibility (Jose Quijada) [#1817](https://github.com/nodejs/node-gyp/pull/1817)\n* [[`8bcb1fbb43`](https://github.com/nodejs/node-gyp/commit/8bcb1fbb43)] - **gyp**: Python 3 Windows fixes (João Reis) [#1843](https://github.com/nodejs/node-gyp/pull/1843)\n* [[`2e24d0a326`](https://github.com/nodejs/node-gyp/commit/2e24d0a326)] - **test**: accept Python 3 in test-find-python.js (João Reis) [#1843](https://github.com/nodejs/node-gyp/pull/1843)\n* [[`1267b4dc1c`](https://github.com/nodejs/node-gyp/commit/1267b4dc1c)] - **build**: add test run Python 3.7 on macOS (Christian Clauss) [#1843](https://github.com/nodejs/node-gyp/pull/1843)\n* [[`da1b031aa3`](https://github.com/nodejs/node-gyp/commit/da1b031aa3)] - **build**: import StringIO on Python 2 and Python 3 (Christian Clauss) [#1836](https://github.com/nodejs/node-gyp/pull/1836)\n* [[`fa0ed4aa42`](https://github.com/nodejs/node-gyp/commit/fa0ed4aa42)] - **build**: more Python 3 compat, replace compile with ast (cclauss) [#1820](https://github.com/nodejs/node-gyp/pull/1820)\n* [[`18d5c7c9d0`](https://github.com/nodejs/node-gyp/commit/18d5c7c9d0)] - **win,src**: update win\\_delay\\_load\\_hook.cc to work with /clr (Ivan Petrovic) [#1819](https://github.com/nodejs/node-gyp/pull/1819)\n\n## v5.0.3 2019-07-17\n\n* [[`66ad305775`](https://github.com/nodejs/node-gyp/commit/66ad305775)] - **python**: accept Python 3 conditionally (João Reis) [#1815](https://github.com/nodejs/node-gyp/pull/1815)\n* [[`7e7fce3fed`](https://github.com/nodejs/node-gyp/commit/7e7fce3fed)] - **python**: move Python detection to its own file (João Reis) [#1815](https://github.com/nodejs/node-gyp/pull/1815)\n* [[`e40c99e283`](https://github.com/nodejs/node-gyp/commit/e40c99e283)] - **src**: implement standard.js linting (Rod Vagg) [#1794](https://github.com/nodejs/node-gyp/pull/1794)\n* [[`bb92c761a9`](https://github.com/nodejs/node-gyp/commit/bb92c761a9)] - **test**: add Node.js 6 on Windows to Travis CI (João Reis) [#1812](https://github.com/nodejs/node-gyp/pull/1812)\n* [[`7fd924079f`](https://github.com/nodejs/node-gyp/commit/7fd924079f)] - **test**: increase tap timeout (João Reis) [#1812](https://github.com/nodejs/node-gyp/pull/1812)\n* [[`7e8127068f`](https://github.com/nodejs/node-gyp/commit/7e8127068f)] - **test**: cover supported node versions with travis (Rod Vagg) [#1809](https://github.com/nodejs/node-gyp/pull/1809)\n* [[`24109148df`](https://github.com/nodejs/node-gyp/commit/24109148df)] - **test**: downgrade to tap@^12 for continued Node 6 support (Rod Vagg) [#1808](https://github.com/nodejs/node-gyp/pull/1808)\n* [[`656117cc4a`](https://github.com/nodejs/node-gyp/commit/656117cc4a)] - **win**: make VS path match case-insensitive (João Reis) [#1806](https://github.com/nodejs/node-gyp/pull/1806)\n\n## v5.0.2 2019-06-27\n\n* [[`2761afbf73`](https://github.com/nodejs/node-gyp/commit/2761afbf73)] - **build,test**: add duplicate symbol test (Gabriel Schulhof) [#1689](https://github.com/nodejs/node-gyp/pull/1689)\n* [[`82f129d6de`](https://github.com/nodejs/node-gyp/commit/82f129d6de)] - **gyp**: replace optparse to argparse (KiYugadgeter) [#1591](https://github.com/nodejs/node-gyp/pull/1591)\n* [[`afaaa29c61`](https://github.com/nodejs/node-gyp/commit/afaaa29c61)] - **gyp**: remove from \\_\\_future\\_\\_ import with\\_statement (cclauss) [#1799](https://github.com/nodejs/node-gyp/pull/1799)\n* [[`a991f633d6`](https://github.com/nodejs/node-gyp/commit/a991f633d6)] - **gyp**: fix the remaining Python 3 issues (cclauss) [#1793](https://github.com/nodejs/node-gyp/pull/1793)\n* [[`f952b08f84`](https://github.com/nodejs/node-gyp/commit/f952b08f84)] - **gyp**: move from \\_\\_future\\_\\_ import to the top of the file (cclauss) [#1789](https://github.com/nodejs/node-gyp/pull/1789)\n* [[`4f4a677dfa`](https://github.com/nodejs/node-gyp/commit/4f4a677dfa)] - **gyp**: use different default compiler for z/OS (Shuowang (Wayne) Zhang) [#1768](https://github.com/nodejs/node-gyp/pull/1768)\n* [[`03683f09d6`](https://github.com/nodejs/node-gyp/commit/03683f09d6)] - **lib**: code de-duplication (Pavel Medvedev) [#965](https://github.com/nodejs/node-gyp/pull/965)\n* [[`611bc3c89f`](https://github.com/nodejs/node-gyp/commit/611bc3c89f)] - **lib**: add .json suffix for explicit require (Rod Vagg) [#1787](https://github.com/nodejs/node-gyp/pull/1787)\n* [[`d3478d7b0b`](https://github.com/nodejs/node-gyp/commit/d3478d7b0b)] - **meta**: add to .gitignore (Refael Ackermann) [#1573](https://github.com/nodejs/node-gyp/pull/1573)\n* [[`7a9a038e9e`](https://github.com/nodejs/node-gyp/commit/7a9a038e9e)] - **test**: add parallel test runs on macOS and Windows (cclauss) [#1800](https://github.com/nodejs/node-gyp/pull/1800)\n* [[`7dd7f2b2a2`](https://github.com/nodejs/node-gyp/commit/7dd7f2b2a2)] - **test**: fix Python syntax error in test-adding.js (cclauss) [#1793](https://github.com/nodejs/node-gyp/pull/1793)\n* [[`395f843de0`](https://github.com/nodejs/node-gyp/commit/395f843de0)] - **test**: replace self-signed cert with 'localhost' (Rod Vagg) [#1795](https://github.com/nodejs/node-gyp/pull/1795)\n* [[`a52c6eb9e8`](https://github.com/nodejs/node-gyp/commit/a52c6eb9e8)] - **test**: migrate from tape to tap (Rod Vagg) [#1795](https://github.com/nodejs/node-gyp/pull/1795)\n* [[`ec2eb44a30`](https://github.com/nodejs/node-gyp/commit/ec2eb44a30)] - **test**: use Nan in duplicate\\_symbols (Gabriel Schulhof) [#1689](https://github.com/nodejs/node-gyp/pull/1689)\n* [[`1597c84aad`](https://github.com/nodejs/node-gyp/commit/1597c84aad)] - **test**: use Travis CI to run tests on every pull request (cclauss) [#1752](https://github.com/nodejs/node-gyp/pull/1752)\n* [[`dd9bf929ac`](https://github.com/nodejs/node-gyp/commit/dd9bf929ac)] - **zos**: update compiler options (Shuowang (Wayne) Zhang) [#1768](https://github.com/nodejs/node-gyp/pull/1768)\n\n## v5.0.1 2019-06-20\n\n* [[`e3861722ed`](https://github.com/nodejs/node-gyp/commit/e3861722ed)] - **doc**: document --jobs max (David Sanders) [#1770](https://github.com/nodejs/node-gyp/pull/1770)\n* [[`1cfdb28886`](https://github.com/nodejs/node-gyp/commit/1cfdb28886)] - **lib**: reintroduce support for iojs file naming for releases \\>= 1 && \\< 4 (Samuel Attard) [#1777](https://github.com/nodejs/node-gyp/pull/1777)\n\n## v5.0.0 2019-06-13\n\n* [[`8a83972743`](https://github.com/nodejs/node-gyp/commit/8a83972743)] - **(SEMVER-MAJOR)** **bin**: follow XDG OS conventions for storing data (Selwyn) [#1570](https://github.com/nodejs/node-gyp/pull/1570)\n* [[`9e46872ea3`](https://github.com/nodejs/node-gyp/commit/9e46872ea3)] - **bin,lib**: remove extra comments/lines/spaces (Jon Moss) [#1508](https://github.com/nodejs/node-gyp/pull/1508)\n* [[`8098ebdeb4`](https://github.com/nodejs/node-gyp/commit/8098ebdeb4)] - **deps**: replace `osenv` dependency with native `os` (Selwyn)\n* [[`f83b457e03`](https://github.com/nodejs/node-gyp/commit/f83b457e03)] - **deps**: bump request to 2.8.7, fixes heok/hawk issues (Rohit Hazra) [#1492](https://github.com/nodejs/node-gyp/pull/1492)\n* [[`323cee7323`](https://github.com/nodejs/node-gyp/commit/323cee7323)] - **deps**: pin `request` version range (Refael Ackermann) [#1300](https://github.com/nodejs/node-gyp/pull/1300)\n* [[`c515912d08`](https://github.com/nodejs/node-gyp/commit/c515912d08)] - **doc**: improve issue template (Bartosz Sosnowski) [#1618](https://github.com/nodejs/node-gyp/pull/1618)\n* [[`cca2d66727`](https://github.com/nodejs/node-gyp/commit/cca2d66727)] - **doc**: python info needs own header (Taylor D. Lee) [#1245](https://github.com/nodejs/node-gyp/pull/1245)\n* [[`3e64c780f5`](https://github.com/nodejs/node-gyp/commit/3e64c780f5)] - **doc**: lint README.md (Jon Moss) [#1498](https://github.com/nodejs/node-gyp/pull/1498)\n* [[`a20faedc91`](https://github.com/nodejs/node-gyp/commit/a20faedc91)] - **(SEMVER-MAJOR)** **gyp**: enable MARMASM items only on new VS versions (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)\n* [[`721eb691cf`](https://github.com/nodejs/node-gyp/commit/721eb691cf)] - **gyp**: teach MSVS generator about MARMASM Items (Jon Kunkee) [#1679](https://github.com/nodejs/node-gyp/pull/1679)\n* [[`91744bfecc`](https://github.com/nodejs/node-gyp/commit/91744bfecc)] - **gyp**: add support for Windows on Arm (Richard Townsend) [#1739](https://github.com/nodejs/node-gyp/pull/1739)\n* [[`a6e0a6c7ed`](https://github.com/nodejs/node-gyp/commit/a6e0a6c7ed)] - **gyp**: move compile\\_commands\\_json (Paul Maréchal) [#1661](https://github.com/nodejs/node-gyp/pull/1661)\n* [[`92e8b52cee`](https://github.com/nodejs/node-gyp/commit/92e8b52cee)] - **gyp**: fix target --\\> self.target (cclauss)\n* [[`febdfa2137`](https://github.com/nodejs/node-gyp/commit/febdfa2137)] - **gyp**: fix sntex error (cclauss) [#1333](https://github.com/nodejs/node-gyp/pull/1333)\n* [[`588d333c14`](https://github.com/nodejs/node-gyp/commit/588d333c14)] - **gyp**: \\_winreg module was renamed to winreg in Python 3. (Craig Rodrigues)\n* [[`98226d198c`](https://github.com/nodejs/node-gyp/commit/98226d198c)] - **gyp**: replace basestring with str, but only on Python 3. (Craig Rodrigues)\n* [[`7535e4478e`](https://github.com/nodejs/node-gyp/commit/7535e4478e)] - **gyp**: replace deprecated functions (Craig Rodrigues)\n* [[`2040cd21cc`](https://github.com/nodejs/node-gyp/commit/2040cd21cc)] - **gyp**: use print as a function, as specified in PEP 3105. (Craig Rodrigues)\n* [[`abef93ded5`](https://github.com/nodejs/node-gyp/commit/abef93ded5)] - **gyp**: get ready for python 3 (cclauss)\n* [[`43031fadcb`](https://github.com/nodejs/node-gyp/commit/43031fadcb)] - **python**: clean-up detection (João Reis) [#1582](https://github.com/nodejs/node-gyp/pull/1582)\n* [[`49ab79d221`](https://github.com/nodejs/node-gyp/commit/49ab79d221)] - **python**: more informative error (Refael Ackermann) [#1269](https://github.com/nodejs/node-gyp/pull/1269)\n* [[`997bc3c748`](https://github.com/nodejs/node-gyp/commit/997bc3c748)] - **readme**: add ARM64 info to MSVC setup instructions (Jon Kunkee) [#1655](https://github.com/nodejs/node-gyp/pull/1655)\n* [[`788e767179`](https://github.com/nodejs/node-gyp/commit/788e767179)] - **test**: remove unused variable (João Reis)\n* [[`6f5a408934`](https://github.com/nodejs/node-gyp/commit/6f5a408934)] - **tools**: fix usage of inherited -fPIC and -fPIE (Jens) [#1340](https://github.com/nodejs/node-gyp/pull/1340)\n* [[`0efb8fb34b`](https://github.com/nodejs/node-gyp/commit/0efb8fb34b)] - **(SEMVER-MAJOR)** **win**: support running in VS Command Prompt (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)\n* [[`360ddbdf3a`](https://github.com/nodejs/node-gyp/commit/360ddbdf3a)] - **(SEMVER-MAJOR)** **win**: add support for Visual Studio 2019 (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)\n* [[`8f43f68275`](https://github.com/nodejs/node-gyp/commit/8f43f68275)] - **(SEMVER-MAJOR)** **win**: detect all VS versions in node-gyp (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)\n* [[`7fe4095974`](https://github.com/nodejs/node-gyp/commit/7fe4095974)] - **(SEMVER-MAJOR)** **win**: generic Visual Studio 2017 detection (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)\n* [[`7a71d68bce`](https://github.com/nodejs/node-gyp/commit/7a71d68bce)] - **win**: use msbuild from the configure stage (Bartosz Sosnowski) [#1654](https://github.com/nodejs/node-gyp/pull/1654)\n* [[`d3b21220a0`](https://github.com/nodejs/node-gyp/commit/d3b21220a0)] - **win**: fix delay-load hook for electron 4 (Andy Dill)\n* [[`81f3a92338`](https://github.com/nodejs/node-gyp/commit/81f3a92338)] - Update list of Node.js versions to test against. (Ben Noordhuis) [#1670](https://github.com/nodejs/node-gyp/pull/1670)\n* [[`4748f6ab75`](https://github.com/nodejs/node-gyp/commit/4748f6ab75)] - Remove deprecated compatibility code. (Ben Noordhuis) [#1670](https://github.com/nodejs/node-gyp/pull/1670)\n* [[`45e3221fd4`](https://github.com/nodejs/node-gyp/commit/45e3221fd4)] - Remove an outdated workaround for Python 2.4 (cclauss) [#1650](https://github.com/nodejs/node-gyp/pull/1650)\n* [[`721dc7d314`](https://github.com/nodejs/node-gyp/commit/721dc7d314)] - Add ARM64 to MSBuild /Platform logic (Jon Kunkee) [#1655](https://github.com/nodejs/node-gyp/pull/1655)\n* [[`a5b7410497`](https://github.com/nodejs/node-gyp/commit/a5b7410497)] - Add ESLint no-unused-vars rule (Jon Moss) [#1497](https://github.com/nodejs/node-gyp/pull/1497)\n\n## v4.0.0 2019-04-24\n\n* [[`ceed5cbe10`](https://github.com/nodejs/node-gyp/commit/ceed5cbe10)] - **deps**: updated tar package version to 4.4.8 (Pobegaylo Maksim) [#1713](https://github.com/nodejs/node-gyp/pull/1713)\n* [[`374519e066`](https://github.com/nodejs/node-gyp/commit/374519e066)] - **(SEMVER-MAJOR)** Upgrade to tar v3 (isaacs) [#1212](https://github.com/nodejs/node-gyp/pull/1212)\n* [[`e6699d13cd`](https://github.com/nodejs/node-gyp/commit/e6699d13cd)] - **test**: fix addon test for Node.js 12 and V8 7.4 (Richard Lau) [#1705](https://github.com/nodejs/node-gyp/pull/1705)\n* [[`0c6bf530a0`](https://github.com/nodejs/node-gyp/commit/0c6bf530a0)] - **lib**: use print() for python version detection (GreenAddress) [#1534](https://github.com/nodejs/node-gyp/pull/1534)\n\n## v3.8.0 2018-08-09\n\n* [[`c5929cb4fe`](https://github.com/nodejs/node-gyp/commit/c5929cb4fe)] - **doc**: update Xcode preferences tab name. (Ivan Daniluk) [#1330](https://github.com/nodejs/node-gyp/pull/1330)\n* [[`8b488da8b9`](https://github.com/nodejs/node-gyp/commit/8b488da8b9)] - **doc**: update link to commit guidelines (Jonas Hermsmeier) [#1456](https://github.com/nodejs/node-gyp/pull/1456)\n* [[`b4fe8c16f9`](https://github.com/nodejs/node-gyp/commit/b4fe8c16f9)] - **doc**: fix visual studio links (Bartosz Sosnowski) [#1490](https://github.com/nodejs/node-gyp/pull/1490)\n* [[`536759c7e9`](https://github.com/nodejs/node-gyp/commit/536759c7e9)] - **configure**: use sys.version\\_info to get python version (Yang Guo) [#1504](https://github.com/nodejs/node-gyp/pull/1504)\n* [[`94c39c604e`](https://github.com/nodejs/node-gyp/commit/94c39c604e)] - **gyp**: fix ninja build failure (GYP patch) (Daniel Bevenius) [nodejs/node#12484](https://github.com/nodejs/node/pull/12484)\n* [[`e8ea74e0fa`](https://github.com/nodejs/node-gyp/commit/e8ea74e0fa)] - **tools**: patch gyp to avoid xcrun errors (Ujjwal Sharma) [nodejs/node#21520](https://github.com/nodejs/node/pull/21520)\n* [[`ea9aff44f2`](https://github.com/nodejs/node-gyp/commit/ea9aff44f2)] - **tools**: fix \"the the\" typos in comments (Masashi Hirano) [nodejs/node#20716](https://github.com/nodejs/node/pull/20716)\n* [[`207e5aa4fd`](https://github.com/nodejs/node-gyp/commit/207e5aa4fd)] - **gyp**: implement LD/LDXX for ninja and FIPS (Sam Roberts)\n* [[`b416c5f4b7`](https://github.com/nodejs/node-gyp/commit/b416c5f4b7)] - **gyp**: enable cctest to use objects (gyp part) (Daniel Bevenius) [nodejs/node#12450](https://github.com/nodejs/node/pull/12450)\n* [[`40692d016b`](https://github.com/nodejs/node-gyp/commit/40692d016b)] - **gyp**: add compile\\_commands.json gyp generator (Ben Noordhuis) [nodejs/node#12450](https://github.com/nodejs/node/pull/12450)\n* [[`fc3c4e2b10`](https://github.com/nodejs/node-gyp/commit/fc3c4e2b10)] - **gyp**: float gyp patch for long filenames (Anna Henningsen) [nodejs/node#7963](https://github.com/nodejs/node/pull/7963)\n* [[`8aedbfdef6`](https://github.com/nodejs/node-gyp/commit/8aedbfdef6)] - **gyp**: backport GYP fix to fix AIX shared suffix (Stewart Addison)\n* [[`6cd84b84fc`](https://github.com/nodejs/node-gyp/commit/6cd84b84fc)] - **test**: formatting and minor fixes for execFileSync replacement (Rod Vagg) [#1521](https://github.com/nodejs/node-gyp/pull/1521)\n* [[`60e421363f`](https://github.com/nodejs/node-gyp/commit/60e421363f)] - **test**: added test/processExecSync.js for when execFileSync is not available. (Rohit Hazra) [#1492](https://github.com/nodejs/node-gyp/pull/1492)\n* [[`969447c5bd`](https://github.com/nodejs/node-gyp/commit/969447c5bd)] - **deps**: bump request to 2.8.7, fixes heok/hawk issues (Rohit Hazra) [#1492](https://github.com/nodejs/node-gyp/pull/1492)\n* [[`340403ccfe`](https://github.com/nodejs/node-gyp/commit/340403ccfe)] - **win**: improve parsing of SDK version (Alessandro Vergani) [#1516](https://github.com/nodejs/node-gyp/pull/1516)\n\n## v3.7.0 2018-06-08\n\n* [[`84cea7b30d`](https://github.com/nodejs/node-gyp/commit/84cea7b30d)] - Remove unused gyp test scripts. (Ben Noordhuis) [#1458](https://github.com/nodejs/node-gyp/pull/1458)\n* [[`0540e4ec63`](https://github.com/nodejs/node-gyp/commit/0540e4ec63)] - **gyp**: escape spaces in filenames in make generator (Jeff Senn) [#1436](https://github.com/nodejs/node-gyp/pull/1436)\n* [[`88fc6fa0ec`](https://github.com/nodejs/node-gyp/commit/88fc6fa0ec)] - Drop dependency on minimatch. (Brian Woodward) [#1158](https://github.com/nodejs/node-gyp/pull/1158)\n* [[`1e203c5148`](https://github.com/nodejs/node-gyp/commit/1e203c5148)] - Fix include path when pointing to Node.js source (Richard Lau) [#1055](https://github.com/nodejs/node-gyp/pull/1055)\n* [[`53d8cb967c`](https://github.com/nodejs/node-gyp/commit/53d8cb967c)] - Prefix build targets with /t: on Windows (Natalie Wolfe) [#1164](https://github.com/nodejs/node-gyp/pull/1164)\n* [[`53a5f8ff38`](https://github.com/nodejs/node-gyp/commit/53a5f8ff38)] - **gyp**: add support for .mm files to msvs generator (Julien Racle) [#1167](https://github.com/nodejs/node-gyp/pull/1167)\n* [[`dd8561e528`](https://github.com/nodejs/node-gyp/commit/dd8561e528)] - **zos**: don't use universal-new-lines mode (John Barboza) [#1451](https://github.com/nodejs/node-gyp/pull/1451)\n* [[`e5a69010ed`](https://github.com/nodejs/node-gyp/commit/e5a69010ed)] - **zos**: add search locations for libnode.x (John Barboza) [#1451](https://github.com/nodejs/node-gyp/pull/1451)\n* [[`79febace53`](https://github.com/nodejs/node-gyp/commit/79febace53)] - **doc**: update macOS information in README (Josh Parnham) [#1323](https://github.com/nodejs/node-gyp/pull/1323)\n* [[`9425448945`](https://github.com/nodejs/node-gyp/commit/9425448945)] - **gyp**: don't print xcodebuild not found errors (Gibson Fahnestock) [#1370](https://github.com/nodejs/node-gyp/pull/1370)\n* [[`6f1286f5b2`](https://github.com/nodejs/node-gyp/commit/6f1286f5b2)] - Fix infinite install loop. (Ben Noordhuis) [#1384](https://github.com/nodejs/node-gyp/pull/1384)\n* [[`2580b9139e`](https://github.com/nodejs/node-gyp/commit/2580b9139e)] - Update `--nodedir` description in README. (Ben Noordhuis) [#1372](https://github.com/nodejs/node-gyp/pull/1372)\n* [[`a61360391a`](https://github.com/nodejs/node-gyp/commit/a61360391a)] - Update README with another way to install on windows (JeffAtDeere) [#1352](https://github.com/nodejs/node-gyp/pull/1352)\n* [[`47496bf6dc`](https://github.com/nodejs/node-gyp/commit/47496bf6dc)] - Fix IndexError when parsing GYP files. (Ben Noordhuis) [#1267](https://github.com/nodejs/node-gyp/pull/1267)\n* [[`b2024dee7b`](https://github.com/nodejs/node-gyp/commit/b2024dee7b)] - **zos**: support platform (John Barboza) [#1276](https://github.com/nodejs/node-gyp/pull/1276)\n* [[`90d86512f4`](https://github.com/nodejs/node-gyp/commit/90d86512f4)] - **win**: run PS with `-NoProfile` (Refael Ackermann) [#1292](https://github.com/nodejs/node-gyp/pull/1292)\n* [[`2da5f86ef7`](https://github.com/nodejs/node-gyp/commit/2da5f86ef7)] - **doc**: add github PR and Issue templates (Gibson Fahnestock) [#1228](https://github.com/nodejs/node-gyp/pull/1228)\n* [[`a46a770d68`](https://github.com/nodejs/node-gyp/commit/a46a770d68)] - **doc**: update proposed DCO and CoC (Mikeal Rogers) [#1229](https://github.com/nodejs/node-gyp/pull/1229)\n* [[`7e803d58e0`](https://github.com/nodejs/node-gyp/commit/7e803d58e0)] - **doc**: headerify the Install instructions (Nick Schonning) [#1225](https://github.com/nodejs/node-gyp/pull/1225)\n* [[`f27599193a`](https://github.com/nodejs/node-gyp/commit/f27599193a)] - **gyp**: update xml string encoding conversion (Liu Chao) [#1203](https://github.com/nodejs/node-gyp/pull/1203)\n* [[`0a07e481f7`](https://github.com/nodejs/node-gyp/commit/0a07e481f7)] - **configure**: don't set ensure if tarball is set (Gibson Fahnestock) [#1220](https://github.com/nodejs/node-gyp/pull/1220)\n\n## v3.6.3 2018-06-08\n\n* [[`90cd2e8da9`](https://github.com/nodejs/node-gyp/commit/90cd2e8da9)] - **gyp**: fix regex to match multi-digit versions (Jonas Hermsmeier) [#1455](https://github.com/nodejs/node-gyp/pull/1455)\n* [[`7900122337`](https://github.com/nodejs/node-gyp/commit/7900122337)] - deps: pin `request` version range (Refael Ackerman) [#1300](https://github.com/nodejs/node-gyp/pull/1300)\n\n## v3.6.2 2017-06-01\n\n* [[`72afdd62cd`](https://github.com/nodejs/node-gyp/commit/72afdd62cd)] - **build**: rename copyNodeLib() to doBuild() (Liu Chao) [#1206](https://github.com/nodejs/node-gyp/pull/1206)\n* [[`bad903ac70`](https://github.com/nodejs/node-gyp/commit/bad903ac70)] - **win**: more robust parsing of SDK version (Refael Ackermann) [#1198](https://github.com/nodejs/node-gyp/pull/1198)\n* [[`241752f381`](https://github.com/nodejs/node-gyp/commit/241752f381)] - Log dist-url. (Ben Noordhuis) [#1170](https://github.com/nodejs/node-gyp/pull/1170)\n* [[`386746c7d1`](https://github.com/nodejs/node-gyp/commit/386746c7d1)] - **configure**: use full path in node_lib_file GYP var (Pavel Medvedev) [#964](https://github.com/nodejs/node-gyp/pull/964)\n* [[`0913b2dd99`](https://github.com/nodejs/node-gyp/commit/0913b2dd99)] - **build, win**: use target_arch to link with node.lib (Pavel Medvedev) [#964](https://github.com/nodejs/node-gyp/pull/964)\n* [[`c307b302f7`](https://github.com/nodejs/node-gyp/commit/c307b302f7)] - **doc**: blorb about setting `npm_config_OPTION_NAME` (Refael Ackermann) [#1185](https://github.com/nodejs/node-gyp/pull/1185)\n\n## v3.6.1 2017-04-30\n\n* [[`49801716c2`](https://github.com/nodejs/node-gyp/commit/49801716c2)] - **test**: fix test-find-python on v0.10.x buildbot. (Ben Noordhuis) [#1172](https://github.com/nodejs/node-gyp/pull/1172)\n* [[`a83a3801fc`](https://github.com/nodejs/node-gyp/commit/a83a3801fc)] - **test**: fix test/test-configure-python on AIX (Richard Lau) [#1131](https://github.com/nodejs/node-gyp/pull/1131)\n* [[`8a767145c9`](https://github.com/nodejs/node-gyp/commit/8a767145c9)] - **gyp**: Revert quote_cmd workaround (Kunal Pathak) [#1153](https://github.com/nodejs/node-gyp/pull/1153)\n* [[`c09cf7671e`](https://github.com/nodejs/node-gyp/commit/c09cf7671e)] - **doc**: add a note for using `configure` on Windows (Vse Mozhet Byt) [#1152](https://github.com/nodejs/node-gyp/pull/1152)\n* [[`da9cb5f411`](https://github.com/nodejs/node-gyp/commit/da9cb5f411)] - Delete superfluous .patch files. (Ben Noordhuis) [#1122](https://github.com/nodejs/node-gyp/pull/1122)\n\n## v3.6.0 2017-03-16\n\n* [[`ae141e1906`](https://github.com/nodejs/node-gyp/commit/ae141e1906)] - **win**: find and setup for VS2017 (Refael Ackermann) [#1130](https://github.com/nodejs/node-gyp/pull/1130)\n* [[`ec5fc36a80`](https://github.com/nodejs/node-gyp/commit/ec5fc36a80)] - Add support to build node.js with chakracore for ARM. (Kunal Pathak) [#873](https://github.com/nodejs/node-gyp/pull/873)\n* [[`a04ea3051a`](https://github.com/nodejs/node-gyp/commit/a04ea3051a)] - Add support to build node.js with chakracore. (Kunal Pathak) [#873](https://github.com/nodejs/node-gyp/pull/873)\n* [[`93d7fa83c8`](https://github.com/nodejs/node-gyp/commit/93d7fa83c8)] - Upgrade semver dependency. (Ben Noordhuis) [#1107](https://github.com/nodejs/node-gyp/pull/1107)\n* [[`ff9a6fadfd`](https://github.com/nodejs/node-gyp/commit/ff9a6fadfd)] - Update link of gyp as Google code is shutting down (Peter Dave Hello) [#1061](https://github.com/nodejs/node-gyp/pull/1061)\n\n## v3.5.0 2017-01-10\n\n* [[`762d19a39e`](https://github.com/nodejs/node-gyp/commit/762d19a39e)] - \\[doc\\] merge History.md and CHANGELOG.md (Rod Vagg)\n* [[`80fc5c3d31`](https://github.com/nodejs/node-gyp/commit/80fc5c3d31)] - Fix deprecated dependency warning (Simone Primarosa) [#1069](https://github.com/nodejs/node-gyp/pull/1069)\n* [[`05c44944fd`](https://github.com/nodejs/node-gyp/commit/05c44944fd)] - Open the build file with universal-newlines mode (Guy Margalit) [#1053](https://github.com/nodejs/node-gyp/pull/1053)\n* [[`37ae7be114`](https://github.com/nodejs/node-gyp/commit/37ae7be114)] - Try python launcher when stock python is python 3. (Ben Noordhuis) [#992](https://github.com/nodejs/node-gyp/pull/992)\n* [[`e3778d9907`](https://github.com/nodejs/node-gyp/commit/e3778d9907)] - Add lots of findPython() tests. (Ben Noordhuis) [#992](https://github.com/nodejs/node-gyp/pull/992)\n* [[`afc766adf6`](https://github.com/nodejs/node-gyp/commit/afc766adf6)] - Unset executable bit for .bat files (Pavel Medvedev) [#969](https://github.com/nodejs/node-gyp/pull/969)\n* [[`ddac348991`](https://github.com/nodejs/node-gyp/commit/ddac348991)] - Use push on PYTHONPATH and add tests (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990)\n* [[`b182a19042`](https://github.com/nodejs/node-gyp/commit/b182a19042)] - ***Revert*** \"add \"path-array\" dep\" (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990)\n* [[`7c08b85c5a`](https://github.com/nodejs/node-gyp/commit/7c08b85c5a)] - ***Revert*** \"**configure**: use \"path-array\" for PYTHONPATH\" (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990)\n* [[`9c8d275526`](https://github.com/nodejs/node-gyp/commit/9c8d275526)] - Add --devdir flag. (Ben Noordhuis) [#916](https://github.com/nodejs/node-gyp/pull/916)\n* [[`f6eab1f9e4`](https://github.com/nodejs/node-gyp/commit/f6eab1f9e4)] - **doc**: add windows-build-tools to readme (Felix Rieseberg) [#970](https://github.com/nodejs/node-gyp/pull/970)\n\n## v3.4.0 2016-06-28\n\n* [[`ce5fd04e94`](https://github.com/nodejs/node-gyp/commit/ce5fd04e94)] - **deps**: update minimatch version (delphiactual) [#961](https://github.com/nodejs/node-gyp/pull/961)\n* [[`77383ddd85`](https://github.com/nodejs/node-gyp/commit/77383ddd85)] - Replace fs.accessSync call to fs.statSync (Richard Lau) [#955](https://github.com/nodejs/node-gyp/pull/955)\n* [[`0dba4bda57`](https://github.com/nodejs/node-gyp/commit/0dba4bda57)] - **test**: add simple addon test (Richard Lau) [#955](https://github.com/nodejs/node-gyp/pull/955)\n* [[`c4344b3889`](https://github.com/nodejs/node-gyp/commit/c4344b3889)] - **doc**: add --target option to README (Gibson Fahnestock) [#958](https://github.com/nodejs/node-gyp/pull/958)\n* [[`cc778e9215`](https://github.com/nodejs/node-gyp/commit/cc778e9215)] - Override BUILDING_UV_SHARED, BUILDING_V8_SHARED. (Ben Noordhuis) [#915](https://github.com/nodejs/node-gyp/pull/915)\n* [[`af35b2ad32`](https://github.com/nodejs/node-gyp/commit/af35b2ad32)] - Move VC++ Build Tools to Build Tools landing page. (Andrew Pardoe) [#953](https://github.com/nodejs/node-gyp/pull/953)\n* [[`f31482e226`](https://github.com/nodejs/node-gyp/commit/f31482e226)] - **win**: work around __pfnDliNotifyHook2 type change (Alexis Campailla) [#952](https://github.com/nodejs/node-gyp/pull/952)\n* [[`3df8222fa5`](https://github.com/nodejs/node-gyp/commit/3df8222fa5)] - Allow for npmlog@3.x (Rebecca Turner) [#950](https://github.com/nodejs/node-gyp/pull/950)\n* [[`a4fa07b390`](https://github.com/nodejs/node-gyp/commit/a4fa07b390)] - More verbose error on locating msbuild.exe failure. (Mateusz Jaworski) [#930](https://github.com/nodejs/node-gyp/pull/930)\n* [[`4ee31329e0`](https://github.com/nodejs/node-gyp/commit/4ee31329e0)] - **doc**: add command options to README.md (Gibson Fahnestock) [#937](https://github.com/nodejs/node-gyp/pull/937)\n* [[`c8c7ca86b9`](https://github.com/nodejs/node-gyp/commit/c8c7ca86b9)] - Add --silent option for zero output. (Gibson Fahnestock) [#937](https://github.com/nodejs/node-gyp/pull/937)\n* [[`ac29d23a7c`](https://github.com/nodejs/node-gyp/commit/ac29d23a7c)] - Upgrade to glob@7.0.3. (Ben Noordhuis) [#943](https://github.com/nodejs/node-gyp/pull/943)\n* [[`15fd56be3d`](https://github.com/nodejs/node-gyp/commit/15fd56be3d)] - Enable V8 deprecation warnings for native modules (Matt Loring) [#920](https://github.com/nodejs/node-gyp/pull/920)\n* [[`7f1c1b960c`](https://github.com/nodejs/node-gyp/commit/7f1c1b960c)] - **gyp**: improvements for android generator (Robert Chiras) [#935](https://github.com/nodejs/node-gyp/pull/935)\n* [[`088082766c`](https://github.com/nodejs/node-gyp/commit/088082766c)] - Update Windows install instructions (Sara Itani) [#867](https://github.com/nodejs/node-gyp/pull/867)\n* [[`625c1515f9`](https://github.com/nodejs/node-gyp/commit/625c1515f9)] - **gyp**: inherit CC/CXX for CC/CXX.host (Johan Bergström) [#908](https://github.com/nodejs/node-gyp/pull/908)\n* [[`3bcb1720e4`](https://github.com/nodejs/node-gyp/commit/3bcb1720e4)] - Add support for the Python launcher on Windows (Patrick Westerhoff) [#894](https://github.com/nodejs/node-gyp/pull/894\n\n## v3.3.1 2016-03-04\n\n* [[`a981ef847a`](https://github.com/nodejs/node-gyp/commit/a981ef847a)] - **gyp**: fix android generator (Robert Chiras) [#889](https://github.com/nodejs/node-gyp/pull/889)\n\n## v3.3.0 2016-02-16\n\n* [[`818d854a4d`](https://github.com/nodejs/node-gyp/commit/818d854a4d)] - Introduce NODEJS_ORG_MIRROR and IOJS_ORG_MIRROR (Rod Vagg) [#878](https://github.com/nodejs/node-gyp/pull/878)\n* [[`d1e4cc4b62`](https://github.com/nodejs/node-gyp/commit/d1e4cc4b62)] - **(SEMVER-MINOR)** Download headers tarball for ~0.12.10 || ~0.10.42 (Rod Vagg) [#877](https://github.com/nodejs/node-gyp/pull/877)\n* [[`6e28ad1bea`](https://github.com/nodejs/node-gyp/commit/6e28ad1bea)] - Allow for npmlog@2.x (Rebecca Turner) [#861](https://github.com/nodejs/node-gyp/pull/861)\n* [[`07371e5812`](https://github.com/nodejs/node-gyp/commit/07371e5812)] - Use -fPIC for NetBSD. (Marcin Cieślak) [#856](https://github.com/nodejs/node-gyp/pull/856)\n* [[`8c4b0ffa50`](https://github.com/nodejs/node-gyp/commit/8c4b0ffa50)] - **(SEMVER-MINOR)** Add --cafile command line option. (Ben Noordhuis) [#837](https://github.com/nodejs/node-gyp/pull/837)\n* [[`b3ad43498e`](https://github.com/nodejs/node-gyp/commit/b3ad43498e)] - **(SEMVER-MINOR)** Make download() function testable. (Ben Noordhuis) [#837](https://github.com/nodejs/node-gyp/pull/837)\n\n## v3.2.1 2015-12-03\n\n* [[`ab89b477c4`](https://github.com/nodejs/node-gyp/commit/ab89b477c4)] - Upgrade gyp to b3cef02. (Ben Noordhuis) [#831](https://github.com/nodejs/node-gyp/pull/831)\n* [[`90078ecb17`](https://github.com/nodejs/node-gyp/commit/90078ecb17)] - Define WIN32_LEAN_AND_MEAN conditionally. (Ben Noordhuis) [#824](https://github.com/nodejs/node-gyp/pull/824)\n\n## v3.2.0 2015-11-25\n\n* [[`268f1ca4c7`](https://github.com/nodejs/node-gyp/commit/268f1ca4c7)] - Use result of `which` when searching for python. (Refael Ackermann) [#668](https://github.com/nodejs/node-gyp/pull/668)\n* [[`817ed9bd78`](https://github.com/nodejs/node-gyp/commit/817ed9bd78)] - Add test for python executable search logic. (Ben Noordhuis) [#756](https://github.com/nodejs/node-gyp/pull/756)\n* [[`0e2dfda1f3`](https://github.com/nodejs/node-gyp/commit/0e2dfda1f3)] - Fix test/test-options when run through `npm test`. (Ben Noordhuis) [#755](https://github.com/nodejs/node-gyp/pull/755)\n* [[`9bfa0876b4`](https://github.com/nodejs/node-gyp/commit/9bfa0876b4)] - Add support for AIX (Michael Dawson) [#753](https://github.com/nodejs/node-gyp/pull/753)\n* [[`a8d441a0a2`](https://github.com/nodejs/node-gyp/commit/a8d441a0a2)] - Update README for Windows 10 support. (Jason Williams) [#766](https://github.com/nodejs/node-gyp/pull/766)\n* [[`d1d6015276`](https://github.com/nodejs/node-gyp/commit/d1d6015276)] - Update broken links and switch to HTTPS. (andrew morton)\n\n## v3.1.0 2015-11-14\n\n* [[`9049241f91`](https://github.com/nodejs/node-gyp/commit/9049241f91)] - **gyp**: don't use links at all, just copy the files instead (Nathan Zadoks)\n* [[`8ef90348d1`](https://github.com/nodejs/node-gyp/commit/8ef90348d1)] - **gyp**: apply https://codereview.chromium.org/11361103/ (Nathan Rajlich)\n* [[`a2ed0df84e`](https://github.com/nodejs/node-gyp/commit/a2ed0df84e)] - **gyp**: always install into $PRODUCT_DIR (Nathan Rajlich)\n* [[`cc8b2fa83e`](https://github.com/nodejs/node-gyp/commit/cc8b2fa83e)] - Update gyp to b3cef02. (Imran Iqbal) [#781](https://github.com/nodejs/node-gyp/pull/781)\n* [[`f5d86eb84e`](https://github.com/nodejs/node-gyp/commit/f5d86eb84e)] - Update to tar@2.0.0. (Edgar Muentes) [#797](https://github.com/nodejs/node-gyp/pull/797)\n* [[`2ac7de02c4`](https://github.com/nodejs/node-gyp/commit/2ac7de02c4)] - Fix infinite loop with zero-length options. (Ben Noordhuis) [#745](https://github.com/nodejs/node-gyp/pull/745)\n* [[`101bed639b`](https://github.com/nodejs/node-gyp/commit/101bed639b)] - This platform value came from debian package, and now the value (Jérémy Lal) [#738](https://github.com/nodejs/node-gyp/pull/738)\n\n## v3.0.3 2015-09-14\n\n* [[`ad827cda30`](https://github.com/nodejs/node-gyp/commit/ad827cda30)] - tarballUrl global and && when checking for iojs (Lars-Magnus Skog) [#729](https://github.com/nodejs/node-gyp/pull/729)\n\n## v3.0.2 2015-09-12\n\n* [[`6e8c3bf3c6`](https://github.com/nodejs/node-gyp/commit/6e8c3bf3c6)] - add back support for passing additional cmdline args (Rod Vagg) [#723](https://github.com/nodejs/node-gyp/pull/723)\n* [[`ff82f2f3b9`](https://github.com/nodejs/node-gyp/commit/ff82f2f3b9)] - fixed broken link in docs to Visual Studio 2013 download (simon-p-r) [#722](https://github.com/nodejs/node-gyp/pull/722)\n\n## v3.0.1 2015-09-08\n\n* [[`846337e36b`](https://github.com/nodejs/node-gyp/commit/846337e36b)] - normalise versions for target == this comparison (Rod Vagg) [#716](https://github.com/nodejs/node-gyp/pull/716)\n\n## v3.0.0 2015-09-08\n\n* [[`9720d0373c`](https://github.com/nodejs/node-gyp/commit/9720d0373c)] - remove node_modules from tree (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711)\n* [[`6dcf220db7`](https://github.com/nodejs/node-gyp/commit/6dcf220db7)] - test version major directly, don't use semver.satisfies() (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711)\n* [[`938dd18d1c`](https://github.com/nodejs/node-gyp/commit/938dd18d1c)] - refactor for clarity, fix dist-url, add env var dist-url functionality (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711)\n* [[`9e9df66a06`](https://github.com/nodejs/node-gyp/commit/9e9df66a06)] - use process.release, make aware of io.js & node v4 differences (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711)\n* [[`1ea7ed01f4`](https://github.com/nodejs/node-gyp/commit/1ea7ed01f4)] - **deps**: update graceful-fs dependency to the latest (Sakthipriyan Vairamani) [#714](https://github.com/nodejs/node-gyp/pull/714)\n* [[`0fbc387b35`](https://github.com/nodejs/node-gyp/commit/0fbc387b35)] - Update repository URLs. (Ben Noordhuis) [#715](https://github.com/nodejs/node-gyp/pull/715)\n* [[`bbedb8868b`](https://github.com/nodejs/node-gyp/commit/bbedb8868b)] - **(SEMVER-MAJOR)** **win**: enable delay-load hook by default (Jeremiah Senkpiel) [#708](https://github.com/nodejs/node-gyp/pull/708)\n* [[`85ed107565`](https://github.com/nodejs/node-gyp/commit/85ed107565)] - Merge pull request #664 from othiym23/othiym23/allow-semver-5 (Nathan Rajlich)\n* [[`0c720d234c`](https://github.com/nodejs/node-gyp/commit/0c720d234c)] - allow semver@5 (Forrest L Norvell)\n\n## 2.0.2 / 2015-07-14\n\n  * Use HTTPS for dist url (#656, @SonicHedgehog)\n  * Merge pull request #648 from nevosegal/master\n  * Merge pull request #650 from magic890/patch-1\n  * Updated Installation section on README\n  * Updated link to gyp user documentation\n  * Fix download error message spelling (#643, @tomxtobin)\n  * Merge pull request #637 from lygstate/master\n  * Set NODE_GYP_DIR for addon.gypi to setting absolute path for\n    src/win_delay_load_hook.c, and fixes of the long relative path issue on Win32.\n    Fixes #636 (#637, @lygstate).\n\n## 2.0.1 / 2015-05-28\n\n  * configure: try/catch the semver range.test() call\n  * README: update for visual studio 2013 (#510, @samccone)\n\n## 2.0.0 / 2015-05-24\n\n  * configure: check for python2 executable by default, fallback to python\n  * configure: don't clobber existing $PYTHONPATH\n  * configure: use \"path-array\" for PYTHONPATH\n  * gyp: fix for non-acsii userprofile name on Windows\n  * gyp: always install into $PRODUCT_DIR\n  * gyp: apply https://codereview.chromium.org/11361103/\n  * gyp: don't use links at all, just copy the files instead\n  * gyp: update gyp to e1c8fcf7\n  * Updated README.md with updated Windows build info\n  * Show URL when a download fails\n  * package: add a \"license\" field\n  * move HMODULE m declaration to top\n  * Only add \"-undefined dynamic_lookup\" to loadable_module targets\n  * win: optionally allow node.exe/iojs.exe to be renamed\n  * Avoid downloading shasums if using tarPath\n  * Add target name preprocessor define: `NODE_GYP_MODULE_NAME`\n  * Show better error message in case of bad network settings\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Code of Conduct\n\n* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)\n* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/master/Moderation-Policy.md)\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to node-gyp\n\n## Making changes to gyp-next\n\nChanges in the subfolder `gyp/` should be submitted to the\n[`gyp-next`][] repository first. The `gyp/` folder is regularly\nsynced from [`gyp-next`][] with GitHub Actions workflow\n[`update-gyp-next.yml`](.github/workflows/update-gyp-next.yml),\nand any changes in this folder would be overridden by the workflow.\n\n## Code of Conduct\n\nPlease read the\n[Code of Conduct](https://github.com/nodejs/admin/blob/main/CODE_OF_CONDUCT.md)\nwhich explains the minimum behavior expectations for node-gyp contributors.\n\n<a id=\"developers-certificate-of-origin\"></a>\n## Developer's Certificate of Origin 1.1\n\nBy making a contribution to this project, I certify that:\n\n* (a) The contribution was created in whole or in part by me and I\n  have the right to submit it under the open source license\n  indicated in the file; or\n\n* (b) The contribution is based upon previous work that, to the best\n  of my knowledge, is covered under an appropriate open source\n  license and I have the right under that license to submit that\n  work with modifications, whether created in whole or in part\n  by me, under the same open source license (unless I am\n  permitted to submit under a different license), as indicated\n  in the file; or\n\n* (c) The contribution was provided directly to me by some other\n  person who certified (a), (b) or (c) and I have not modified\n  it.\n\n* (d) I understand and agree that this project and the contribution\n  are public and that a record of the contribution (including all\n  personal information I submit with it, including my sign-off) is\n  maintained indefinitely and may be redistributed consistent with\n  this project or the open source license(s) involved.\n\n[`gyp-next`]: https://github.com/nodejs/gyp-next\n"
  },
  {
    "path": "LICENSE",
    "content": "(The MIT License)\n\nCopyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# `node-gyp` - Node.js native addon build tool\n\n[![Build Status](https://github.com/nodejs/node-gyp/workflows/Tests/badge.svg?branch=main)](https://github.com/nodejs/node-gyp/actions?query=workflow%3ATests+branch%3Amain)\n![npm](https://img.shields.io/npm/dm/node-gyp)\n\n`node-gyp` is a cross-platform command-line tool written in Node.js for\ncompiling native addon modules for Node.js. It contains a vendored copy of the\n[gyp-next](https://github.com/nodejs/gyp-next) project that was previously used\nby the Chromium team and extended to support the development of Node.js native\naddons.\n\nNote that `node-gyp` is _not_ used to build Node.js itself.\n\nAll current and LTS target versions of Node.js are supported. Depending on what version of Node.js is actually installed on your system\n`node-gyp` downloads the necessary development files or headers for the target version. List of stable Node.js versions can be found on [Node.js website](https://nodejs.org/en/about/previous-releases).\n\n## Features\n\n * The same build commands work on any of the supported platforms\n * Supports the targeting of different versions of Node.js\n\n## Installation\n\n> [!Important]\n> Python >= v3.12 requires `node-gyp` >= v10\n\nYou can install `node-gyp` using `npm`:\n\n``` bash\nnpm install -g node-gyp\n```\n\nDepending on your operating system, you will need to install:\n\n### On Unix\n\n   * [A supported version of Python](https://devguide.python.org/versions/)\n   * `make`\n   * A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)\n\n### On macOS\n\n   * [A supported version of Python](https://devguide.python.org/versions/)\n   * `Xcode Command Line Tools` which will install `clang`, `clang++`, and `make`.\n     * Install the `Xcode Command Line Tools` standalone by running `xcode-select --install`. -- OR --\n     * Alternatively, if you already have the [full Xcode installed](https://developer.apple.com/xcode/download/), you can install the Command Line Tools under the menu `Xcode -> Open Developer Tool -> More Developer Tools...`.\n\n\n### On Windows\n\nInstall tools with [Chocolatey](https://chocolatey.org):\n``` bash\nchoco install python visualstudio2022-workload-vctools -y\n```\n\nOr install and configure Python and Visual Studio tools manually:\n\n  * Follow the instructions in [Using Python on Windows](https://docs.python.org/3/using/windows.html) to install\n    the current [version of Python](https://www.python.org/downloads/).\n\n   * Install Visual C++ Build Environment: For Visual Studio 2019 or later, use the `Desktop development with C++` workload from [Visual Studio Community](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community).  For a version older than Visual Studio 2019, install [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools) with the `Visual C++ build tools` option.\n\n   To target native ARM64 Node.js on Windows on ARM, add the components \"Visual C++ compilers and libraries for ARM64\" and \"Visual C++ ATL for ARM64\".\n\n   To use the native ARM64 C++ compiler on Windows on ARM, ensure that you have Visual Studio 2022 [17.4 or later](https://devblogs.microsoft.com/visualstudio/arm64-visual-studio-is-officially-here/) installed.\n\nIt's advised to install the following PowerShell module: [VSSetup](https://github.com/microsoft/vssetup.powershell) using `Install-Module VSSetup -Scope CurrentUser`.\nThis will make Visual Studio detection logic use a more flexible and accessible method, avoiding PowerShell's `ConstrainedLanguage` mode.\n\n### Configuring Python Dependency\n\n`node-gyp` requires that you have installed a [supported version of Python](https://devguide.python.org/versions/).\nIf you have multiple versions of Python installed, you can identify which version\n`node-gyp` should use in one of the following ways:\n\n1. by setting the `--python` command-line option, e.g.:\n\n``` bash\nnode-gyp <command> --python /path/to/executable/python\n```\n\n2. If `node-gyp` is called by way of `npm`, *and* you have multiple versions of\nPython installed, then you can set the `npm_config_python` environment variable\nto the appropriate path:\n``` bash\nexport npm_config_python=/path/to/executable/python\n```\n&nbsp;&nbsp;&nbsp;&nbsp;Or on Windows:\n```console\npy --list-paths  # To see the installed Python versions\nset npm_config_python=C:\\path\\to\\python.exe  # CMD\n$Env:npm_config_python=\"C:\\path\\to\\python.exe\"  # PowerShell\n```\n\n3. If the `PYTHON` environment variable is set to the path of a Python executable,\nthen that version will be used if it is a supported version.\n\n4. If the `NODE_GYP_FORCE_PYTHON` environment variable is set to the path of a\nPython executable, it will be used instead of any of the other configured or\nbuilt-in Python search paths. If it's not a compatible version, no further\nsearching will be done.\n\n### Build for Third Party Node.js Runtimes\n\nWhen building modules for third-party Node.js runtimes like Electron, which have\ndifferent build configurations from the official Node.js distribution, you\nshould use `--dist-url` or `--nodedir` flags to specify the headers of the\nruntime to build for.\n\nAlso when `--dist-url` or `--nodedir` flags are passed, node-gyp will use the\n`config.gypi` shipped in the headers distribution to generate build\nconfigurations, which is different from the default mode that would use the\n`process.config` object of the running Node.js instance.\n\nSome old versions of Electron shipped malformed `config.gypi` in their headers\ndistributions, and you might need to pass `--force-process-config` to node-gyp\nto work around configuration errors.\n\n## How to Use\n\nTo compile your native addon first go to its root directory:\n\n``` bash\ncd my_node_addon\n```\n\nThe next step is to generate the appropriate project build files for the current\nplatform. Use `configure` for that:\n\n``` bash\nnode-gyp configure\n```\n\nAuto-detection fails for Visual C++ Build Tools 2015, so `--msvs_version=2015`\nneeds to be added (not needed when run by npm as configured above):\n``` bash\nnode-gyp configure --msvs_version=2015\n```\n\n__Note__: The `configure` step looks for a `binding.gyp` file in the current\ndirectory to process. See below for instructions on creating a `binding.gyp` file.\n\nNow you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file\n(on Windows) in the `build/` directory. Next, invoke the `build` command:\n\n``` bash\nnode-gyp build\n```\n\nNow you have your compiled `.node` bindings file! The compiled bindings end up\nin `build/Debug/` or `build/Release/`, depending on the build mode. At this point,\nyou can require the `.node` file with Node.js and run your tests!\n\n__Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or\n`-d`) switch when running either the `configure`, `build` or `rebuild` commands.\n\n## The `binding.gyp` file\n\nA `binding.gyp` file describes the configuration to build your module, in a\nJSON-like format. This file gets placed in the root of your package, alongside\n`package.json`.\n\nA barebones `gyp` file appropriate for building a Node.js addon could look like:\n\n```python\n{\n  \"targets\": [\n    {\n      \"target_name\": \"binding\",\n      \"sources\": [ \"src/binding.cc\" ]\n    }\n  ]\n}\n```\n\n## Further reading\n\nThe **[docs](./docs/)** directory contains additional documentation on specific node-gyp topics that may be useful if you are experiencing problems installing or building addons using node-gyp.\n\nSome additional resources for Node.js native addons and writing `gyp` configuration files:\n\n * [\"Going Native\" a nodeschool.io tutorial](http://nodeschool.io/#goingnative)\n * [\"Hello World\" node addon example](https://github.com/nodejs/node/tree/main/test/addons/hello-world)\n * [gyp user documentation](https://gyp.gsrc.io/docs/UserDocumentation.md)\n * [gyp input format reference](https://gyp.gsrc.io/docs/InputFormatReference.md)\n * [*\"binding.gyp\" files out in the wild* wiki page](./docs/binding.gyp-files-in-the-wild.md)\n\n## Commands\n\n`node-gyp` responds to the following commands:\n\n| **Command**   | **Description**\n|:--------------|:---------------------------------------------------------------\n| `help`        | Shows the help dialog\n| `build`       | Invokes `make`/`msbuild.exe` and builds the native addon\n| `clean`       | Removes the `build` directory if it exists\n| `configure`   | Generates project build files for the current platform\n| `rebuild`     | Runs `clean`, `configure` and `build` all in a row\n| `install`     | Installs Node.js header files for the given version\n| `list`        | Lists the currently installed Node.js header versions\n| `remove`      | Removes the Node.js header files for the given version\n\n\n## Command Options\n\n`node-gyp` accepts the following command options:\n\n| **Command**                       | **Description**\n|:----------------------------------|:------------------------------------------\n| `-j n`, `--jobs n`                | Run `make` in parallel. The value `max` will use all available CPU cores\n| `--target=v6.2.1`                 | Node.js version to build for (default is `process.version`)\n| `--silly`, `--loglevel=silly`     | Log all progress to console\n| `--verbose`, `--loglevel=verbose` | Log most progress to console\n| `--silent`, `--loglevel=silent`   | Don't log anything to console\n| `debug`, `--debug`                | Make Debug build (default is `Release`)\n| `--release`, `--no-debug`         | Make Release build\n| `-C $dir`, `--directory=$dir`     | Run command in different directory\n| `--make=$make`                    | Override `make` command (e.g. `gmake`)\n| `--thin=yes`                      | Enable thin static libraries\n| `--arch=$arch`                    | Set target architecture (e.g. ia32)\n| `--tarball=$path`                 | Get headers from a local tarball\n| `--devdir=$path`                  | SDK download directory (default is OS cache directory)\n| `--ensure`                        | Don't reinstall headers if already present\n| `--dist-url=$url`                 | Download header tarball from custom URL\n| `--proxy=$url`                    | Set HTTP(S) proxy for downloading header tarball\n| `--noproxy=$urls`                 | Set urls to ignore proxies when downloading header tarball\n| `--cafile=$cafile`                | Override default CA chain (to download tarball)\n| `--nodedir=$path`                 | Set the path to the node source code\n| `--python=$path`                  | Set path to the Python binary\n| `--msvs_version=$version`         | Set Visual Studio version (Windows only)\n| `--solution=$solution`            | Set Visual Studio Solution version (Windows only)\n| `--force-process-config`          | Force using runtime's `process.config` object to generate `config.gypi` file\n\n## Configuration\n\n### package.json\n\nUse the `config` object in your package.json with each key in the form `node_gyp_OPTION_NAME`. Any of the command\noptions listed above can be set (dashes in option names should be replaced by underscores).\n\nFor example, to set `devdir` equal to `/tmp/.gyp`, your package.json would contain this:\n\n```json\n{\n  \"config\": {\n    \"node_gyp_devdir\": \"/tmp/.gyp\"\n  }\n}\n```\n\n### Environment variables\n\nUse the form `npm_package_config_node_gyp_OPTION_NAME` for any of the command options listed\nabove (dashes in option names should be replaced by underscores).\n\nFor example, to set `devdir` equal to `/tmp/.gyp`, you would:\n\nRun this on Unix:\n\n```bash\nexport npm_package_config_node_gyp_devdir=/tmp/.gyp\n```\n\nOr this on Windows:\n\n```console\nset npm_package_config_node_gyp_devdir=c:\\temp\\.gyp\n```\n\nNote that in versions of npm before v11 it was possible to use the prefix `npm_config_` for\nenvironment variables. This was deprecated in npm@11 and will be removed in npm@12 so it\nis recommended to convert your environment variables to the above format.\n\n### `npm` configuration for npm versions before v9\n\nUse the form `OPTION_NAME` for any of the command options listed above.\n\nFor example, to set `devdir` equal to `/tmp/.gyp`, you would run:\n\n```bash\nnpm config set [--global] devdir /tmp/.gyp\n```\n\n**Note:** Configuration set via `npm` will only be used when `node-gyp`\nis run via `npm`, not when `node-gyp` is run directly.\n\n## License\n\n`node-gyp` is available under the MIT license. See the [LICENSE\nfile](LICENSE) for details.\n"
  },
  {
    "path": "SECURITY.md",
    "content": "If you believe you have found a security issue in the software in this\nrepository, please consult https://github.com/nodejs/node/blob/HEAD/SECURITY.md."
  },
  {
    "path": "addon.gypi",
    "content": "{\n  'variables' : {\n    'node_engine_include_dir%': 'deps/v8/include',\n    'node_host_binary%': 'node',\n    'node_with_ltcg%': 'true',\n  },\n  'target_defaults': {\n    'type': 'loadable_module',\n    'win_delay_load_hook': 'true',\n    'product_prefix': '',\n\n    'conditions': [\n      [ 'node_engine==\"chakracore\"', {\n        'variables': {\n          'node_engine_include_dir%': 'deps/chakrashim/include'\n        },\n      }]\n    ],\n\n    'include_dirs': [\n      '<(node_root_dir)/include/node',\n      '<(node_root_dir)/src',\n      '<(node_root_dir)/deps/openssl/config',\n      '<(node_root_dir)/deps/openssl/openssl/include',\n      '<(node_root_dir)/deps/uv/include',\n      '<(node_root_dir)/deps/zlib',\n      '<(node_root_dir)/<(node_engine_include_dir)'\n    ],\n    'defines!': [\n      'BUILDING_UV_SHARED=1',  # Inherited from common.gypi.\n      'BUILDING_V8_SHARED=1',  # Inherited from common.gypi.\n    ],\n    'defines': [\n      'NODE_GYP_MODULE_NAME=>(_target_name)',\n      'USING_UV_SHARED=1',\n      'USING_V8_SHARED=1',\n      # Warn when using deprecated V8 APIs.\n      'V8_DEPRECATION_WARNINGS=1'\n    ],\n\n    'target_conditions': [\n      ['_type==\"loadable_module\"', {\n        'product_extension': 'node',\n        'defines': [\n          'BUILDING_NODE_EXTENSION'\n        ],\n        'xcode_settings': {\n          'OTHER_LDFLAGS': [\n            '-undefined dynamic_lookup'\n          ],\n        },\n      }],\n\n      ['_type==\"static_library\"', {\n        # set to `1` to *disable* the -T thin archive 'ld' flag.\n        # older linkers don't support this flag.\n        'standalone_static_library': '<(standalone_static_library)'\n      }],\n\n      ['_type!=\"executable\"', {\n        'conditions': [\n          [ 'OS==\"android\"', {\n            'cflags!': [ '-fPIE' ],\n          }]\n        ]\n      }],\n\n      ['_win_delay_load_hook==\"true\"', {\n        # If the addon specifies `'win_delay_load_hook': 'true'` in its\n        # binding.gyp, link a delay-load hook into the DLL. This hook ensures\n        # that the addon will work regardless of whether the node/iojs binary\n        # is named node.exe, iojs.exe, or something else.\n        'conditions': [\n          [ 'OS==\"win\"', {\n            'defines': [ 'HOST_BINARY=\\\"<(node_host_binary)<(EXECUTABLE_SUFFIX)\\\"', ],\n            'sources': [\n              '<(node_gyp_dir)/src/win_delay_load_hook.cc',\n            ],\n            'msvs_settings': {\n              'VCLinkerTool': {\n                'DelayLoadDLLs': [ '<(node_host_binary)<(EXECUTABLE_SUFFIX)' ],\n                # Don't print a linker warning when no imports from either .exe\n                # are used.\n                'AdditionalOptions': [ '/ignore:4199' ],\n              },\n            },\n          }],\n        ],\n      }],\n    ],\n\n    'conditions': [\n      [ 'OS==\"mac\"', {\n        'defines': [\n          '_DARWIN_USE_64_BIT_INODE=1'\n        ],\n        'xcode_settings': {\n          'DYLIB_INSTALL_NAME_BASE': '@rpath'\n        },\n      }],\n      [ 'OS==\"aix\"', {\n        'ldflags': [\n          '-Wl,-bimport:<(node_exp_file)'\n        ],\n      }],\n      [ 'OS==\"os400\"', {\n        'ldflags': [\n          '-Wl,-bimport:<(node_exp_file)'\n        ],\n      }],\n      [ 'OS==\"zos\"', {\n        'conditions': [\n          [ '\"<!(echo $CC)\" != \"clang\" and \\\n             \"<!(echo $CC)\" != \"ibm-clang64\" and \\\n             \"<!(echo $CC)\" != \"ibm-clang\"', {\n            'cflags': [\n              '-q64',\n              '-Wc,DLL',\n              '-qlonglong',\n              '-qenum=int',\n              '-qxclang=-fexec-charset=ISO8859-1'\n            ],\n            'ldflags': [\n              '-q64',\n              '<(node_exp_file)',\n            ],\n          }, {\n            'cflags': [\n              '-m64',\n            ],\n            'ldflags': [\n              '-m64',\n              '<(node_exp_file)',\n            ],\n          }],\n        ],\n        'defines': [\n          '_ALL_SOURCE',\n          'MAP_FAILED=-1',\n          '_UNIX03_SOURCE',\n        ],\n      }],\n      [ 'OS==\"win\"', {\n        'conditions': [\n          ['node_engine==\"chakracore\"', {\n            'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],\n            'libraries': [ '<@(node_engine_libs)' ],\n          }],\n          ['node_with_ltcg==\"true\"', {\n            'msvs_settings': {\n              'VCCLCompilerTool': {\n                'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG\n              },\n              'VCLibrarianTool': {\n                'AdditionalOptions': [\n                  '/LTCG:INCREMENTAL', # incremental link-time code generation\n                ]\n              },\n              'VCLinkerTool': {\n                'OptimizeReferences': 2, # /OPT:REF\n                'EnableCOMDATFolding': 2, # /OPT:ICF\n                'LinkIncremental': 1, # disable incremental linking\n                'AdditionalOptions': [\n                  '/LTCG:INCREMENTAL', # incremental link-time code generation\n                ]\n              }\n            }\n          }]\n        ],\n        'libraries': [\n          '-lkernel32.lib',\n          '-luser32.lib',\n          '-lgdi32.lib',\n          '-lwinspool.lib',\n          '-lcomdlg32.lib',\n          '-ladvapi32.lib',\n          '-lshell32.lib',\n          '-lole32.lib',\n          '-loleaut32.lib',\n          '-luuid.lib',\n          '-lodbc32.lib',\n          '-ldelayimp.lib',\n          '-l\"<(node_lib_file)\"'\n        ],\n        'msvs_disabled_warnings': [\n          # warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'\n          # needs to have dll-interface to be used by\n          # clients of class 'node::ObjectWrap'\n          4251\n        ],\n      }, {\n        # OS!=\"win\"\n        'defines': [\n          '_LARGEFILE_SOURCE',\n          '_FILE_OFFSET_BITS=64'\n        ],\n      }],\n      [ 'OS in \"freebsd openbsd netbsd solaris android openharmony\" or \\\n         (OS==\"linux\" and target_arch!=\"ia32\")', {\n        'cflags': [ '-fPIC' ],\n      }],\n    ]\n  }\n}\n"
  },
  {
    "path": "bin/node-gyp.js",
    "content": "#!/usr/bin/env node\n\n'use strict'\n\nprocess.title = 'node-gyp'\n\nconst envPaths = require('env-paths')\nconst gyp = require('../')\nconst log = require('../lib/log')\nconst os = require('os')\n\n/**\n * Process and execute the selected commands.\n */\n\nconst prog = gyp()\nlet completed = false\nprog.parseArgv(process.argv)\nprog.devDir = prog.opts.devdir\n\nconst homeDir = os.homedir()\nif (prog.devDir) {\n  prog.devDir = prog.devDir.replace(/^~/, homeDir)\n} else if (homeDir) {\n  prog.devDir = envPaths('node-gyp', { suffix: '' }).cache\n} else {\n  throw new Error(\n    \"node-gyp requires that the user's home directory is specified \" +\n    'in either of the environmental variables HOME or USERPROFILE. ' +\n    'Overide with: --devdir /path/to/.node-gyp')\n}\n\nif (prog.todo.length === 0) {\n  if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {\n    log.stdout('v%s', prog.version)\n  } else {\n    log.stdout('%s', prog.usage())\n  }\n  process.exit(0)\n}\n\nlog.info('it worked if it ends with', 'ok')\nlog.verbose('cli', process.argv)\nlog.info('using', 'node-gyp@%s', prog.version)\nlog.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch)\n\n/**\n * Change dir if -C/--directory was passed.\n */\n\nconst dir = prog.opts.directory\nif (dir) {\n  const fs = require('fs')\n  try {\n    const stat = fs.statSync(dir)\n    if (stat.isDirectory()) {\n      log.info('chdir', dir)\n      process.chdir(dir)\n    } else {\n      log.warn('chdir', dir + ' is not a directory')\n    }\n  } catch (e) {\n    if (e.code === 'ENOENT') {\n      log.warn('chdir', dir + ' is not a directory')\n    } else {\n      log.warn('chdir', 'error during chdir() \"%s\"', e.message)\n    }\n  }\n}\n\nasync function run () {\n  const command = prog.todo.shift()\n  if (!command) {\n    // done!\n    completed = true\n    log.info('ok')\n    return\n  }\n\n  try {\n    const args = await prog.commands[command.name](command.args) ?? []\n\n    if (command.name === 'list') {\n      if (args.length) {\n        args.forEach((version) => log.stdout(version))\n      } else {\n        log.stdout('No node development files installed. Use `node-gyp install` to install a version.')\n      }\n    } else if (args.length >= 1) {\n      log.stdout(...args.slice(1))\n    }\n\n    // now run the next command in the queue\n    return run()\n  } catch (err) {\n    log.error(command.name + ' error')\n    log.error('stack', err.stack)\n    errorMessage()\n    log.error('not ok')\n    return process.exit(1)\n  }\n}\n\nprocess.on('exit', function (code) {\n  if (!completed && !code) {\n    log.error('Completion callback never invoked!')\n    issueMessage()\n    process.exit(6)\n  }\n})\n\nprocess.on('uncaughtException', function (err) {\n  log.error('UNCAUGHT EXCEPTION')\n  log.error('stack', err.stack)\n  issueMessage()\n  process.exit(7)\n})\n\nfunction errorMessage () {\n  // copied from npm's lib/utils/error-handler.js\n  const os = require('os')\n  log.error('System', os.type() + ' ' + os.release())\n  log.error('command', process.argv\n    .map(JSON.stringify).join(' '))\n  log.error('cwd', process.cwd())\n  log.error('node -v', process.version)\n  log.error('node-gyp -v', 'v' + prog.package.version)\n  // print the npm package version\n  for (const env of ['npm_package_name', 'npm_package_version']) {\n    const value = process.env[env]\n    if (value != null) {\n      log.error(`$${env}`, value)\n    }\n  }\n}\n\nfunction issueMessage () {\n  errorMessage()\n  log.error('', ['Node-gyp failed to build your package.',\n    'Try to update npm and/or node-gyp and if it does not help file an issue with the package author.'\n  ].join('\\n'))\n}\n\n// start running the given commands!\nrun()\n"
  },
  {
    "path": "docs/Error-pre-versions-of-node-cannot-be-installed.md",
    "content": "When using `node-gyp` you might see an error like this when attempting to compile/install a node.js native addon:\n\n```\n$ npm install bcrypt\nnpm http GET https://registry.npmjs.org/bcrypt/0.7.5\nnpm http 304 https://registry.npmjs.org/bcrypt/0.7.5\nnpm http GET https://registry.npmjs.org/bindings/1.0.0\nnpm http 304 https://registry.npmjs.org/bindings/1.0.0\n\n> bcrypt@0.7.5 install /home/ubuntu/public/song-swap/node_modules/bcrypt\n> node-gyp rebuild\n\ngyp ERR! configure error\ngyp ERR! stack Error: \"pre\" versions of node cannot be installed, use the --nodedir flag instead\ngyp ERR! stack     at install (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:69:16)\ngyp ERR! stack     at Object.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:56:37)\ngyp ERR! stack     at getNodeDir (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:219:20)\ngyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:105:9\ngyp ERR! stack     at ChildProcess.exithandler (child_process.js:630:7)\ngyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)\ngyp ERR! stack     at maybeClose (child_process.js:730:16)\ngyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:5)\ngyp ERR! System Linux 3.5.0-21-generic\ngyp ERR! command \"node\" \"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"\ngyp ERR! cwd /home/ubuntu/public/song-swap/node_modules/bcrypt\ngyp ERR! node -v v0.11.2-pre\ngyp ERR! node-gyp -v v0.9.5\ngyp ERR! not ok\nnpm ERR! bcrypt@0.7.5 install: `node-gyp rebuild`\nnpm ERR! `sh \"-c\" \"node-gyp rebuild\"` failed with 1\nnpm ERR!\nnpm ERR! Failed at the bcrypt@0.7.5 install script.\nnpm ERR! This is most likely a problem with the bcrypt package,\nnpm ERR! not with npm itself.\nnpm ERR! Tell the author that this fails on your system:\nnpm ERR!     node-gyp rebuild\nnpm ERR! You can get their info via:\nnpm ERR!     npm owner ls bcrypt\nnpm ERR! There is likely additional logging output above.\n\nnpm ERR! System Linux 3.5.0-21-generic\nnpm ERR! command \"/usr/local/bin/node\" \"/usr/local/bin/npm\" \"install\" \"bcrypt\"\nnpm ERR! cwd /home/ubuntu/public/song-swap\nnpm ERR! node -v v0.11.2-pre\nnpm ERR! npm -v 1.2.18\nnpm ERR! code ELIFECYCLE\nnpm ERR!\nnpm ERR! Additional logging details can be found in:\nnpm ERR!     /home/ubuntu/public/song-swap/npm-debug.log\nnpm ERR! not ok code 0\n```\n\nThe main error here is:\n\n```\nError: \"pre\" versions of node cannot be installed, use the --nodedir flag instead\n```\n\nThis error is caused when you attempt to compile a native addon using a version of node.js with `-pre` at the end of the version number:\n\n``` bash\n$ node -v\nv0.10.4-pre\n```\n\n## How to avoid (the short answer)\n\nTo avoid this error completely just use a stable release of node.js. i.e. `v0.10.4`, and __not__ `v0.10.4-pre`.\n\n## How to fix (the long answer)\n\nThis error happens because `node-gyp` does not know what header files were used to compile your \"pre\" version of node, and therefore it needs you to specify the node source code directory path using the `--nodedir` flag.\n\nFor example, if I compiled my development (\"pre\") version of node.js using the source code in `/Users/nrajlich/node`, then I could invoke `node-gyp` like:\n\n``` bash\n$ node-gyp rebuild --nodedir=/Users/nrajlich/node\n```\n\nOr install an native addon through `npm` like:\n\n``` bash\n$ npm install bcrypt --nodedir=/Users/nrajlich/node\n```\n\n### Always use `--nodedir`\n\n__Note:__ This is for advanced users who use `-pre` versions of node more often than tagged releases.\n\nIf you're invoking `node-gyp` through `npm`, then you can leverage `npm`'s configuration system and not have to specify the `--nodedir` flag all the time:\n\n``` bash\n$ npm config set nodedir /Users/nrajlich/node\n```"
  },
  {
    "path": "docs/Force-npm-to-use-global-node-gyp.md",
    "content": "# Force npm to use global installed node-gyp\n\n**Note: These instructions only work with npm 6 or older. For a solution that works with npm 8 (or older), see [Updating-npm-bundled-node-gyp.md](Updating-npm-bundled-node-gyp.md).**\n\n[Many issues](https://github.com/nodejs/node-gyp/labels/ERR%21%20node-gyp%20-v%20%3C%3D%20v5.1.0) are opened by users who are\nnot running a [current version of node-gyp](https://github.com/nodejs/node-gyp/releases).\n\nnpm bundles its own, internal, copy of node-gyp located at `npm/node_modules`, within npm's private dependencies which are separate from *globally* accessible packages. Therefore this internal copy of node-gyp is independent from any globally installed copy of node-gyp that\nmay have been installed via `npm install -g node-gyp`.\n\nSo npm's internal copy of node-gyp **isn't** stored inside *global* `node_modules` and thus isn't available for use as a standalone package. npm uses it's *internal* copy of `node-gyp` to automatically build native addons.\n\nWhen you install a _new_ version of node-gyp outside of npm, it'll go into your *global* `node_modules`, but not under the `npm/node_modules` (where internal copy of node-gyp is stored). So it will get into your `$PATH` and you will be able to use this globally installed version (**but not internal node-gyp of npm**) as any other globally installed package.\n\nThe catch is that npm **won't** use global version unless you tell it to, it'll keep on using the **internal one**. You need to instruct it to by setting the `node_gyp` config variable (which goes into your `~/.npmrc`). You do this by running the `npm config set` command as below. Then npm will use the command in the path you supply whenever it needs to build a native addon.\n\n**Important**: You also need to remember to unset this when you upgrade npm with a newer version of node-gyp, or you have to manually keep your globally installed node-gyp to date. See \"Undo\" below.\n\n## Linux and macOS\n```\nnpm install --global node-gyp@latest\nnpm config set node_gyp $(npm prefix -g)/lib/node_modules/node-gyp/bin/node-gyp.js\n```\n\n`sudo` may be required for the first command if you get a permission error.\n\n## Windows\n\n### Windows Command Prompt\n```\nnpm install --global node-gyp@latest\nfor /f \"delims=\" %P in ('npm prefix -g') do npm config set node_gyp \"%P\\node_modules\\node-gyp\\bin\\node-gyp.js\"\n```\n\n### Powershell\n```\nnpm install --global node-gyp@latest\nnpm prefix -g | % {npm config set node_gyp \"$_\\node_modules\\node-gyp\\bin\\node-gyp.js\"}\n```\n\n## Undo\n**Beware** if you don't unset the `node_gyp` config option, npm will continue to use the globally installed version of node-gyp rather than the one it ships with, which may end up being newer.\n\n```\nnpm config delete node_gyp\nnpm uninstall --global node-gyp\n```\n"
  },
  {
    "path": "docs/Home.md",
    "content": "Welcome to the node-gyp wiki!\n\n * [[\"binding.gyp\" files out in the wild]]\n * [[Linking to OpenSSL]]\n * [[Common Issues]]\n * [[Updating npm's bundled node-gyp]]\n * [[Error: \"pre\" versions of node cannot be installed]]\n"
  },
  {
    "path": "docs/Linking-to-OpenSSL.md",
    "content": "A handful of native addons require linking to OpenSSL in one way or another. This introduces a small challenge since node will sometimes bundle OpenSSL statically (the default for node >= v0.8.x), or sometimes dynamically link to the system OpenSSL (default for node <= v0.6.x).\n\nGood native addons should account for both scenarios. It's recommended that you use the `binding.gyp` file provided below as a starting-point for any addon that needs to use OpenSSL:\n\n``` python\n{\n  'variables': {\n    # node v0.6.x doesn't give us its build variables,\n    # but on Unix it was only possible to use the system OpenSSL library,\n    # so default the variable to \"true\", v0.8.x node and up will overwrite it.\n    'node_shared_openssl%': 'true'\n  },\n  'targets': [\n    {\n      'target_name': 'binding',\n      'sources': [\n        'src/binding.cc'\n      ],\n      'conditions': [\n        ['node_shared_openssl==\"false\"', {\n          # so when \"node_shared_openssl\" is \"false\", then OpenSSL has been\n          # bundled into the node executable. So we need to include the same\n          # header files that were used when building node.\n          'include_dirs': [\n            '<(node_root_dir)/deps/openssl/openssl/include'\n          ],\n          \"conditions\" : [\n            [\"target_arch=='ia32'\", {\n              \"include_dirs\": [ \"<(node_root_dir)/deps/openssl/config/piii\" ]\n            }],\n            [\"target_arch=='x64'\", {\n              \"include_dirs\": [ \"<(node_root_dir)/deps/openssl/config/k8\" ]\n            }],\n            [\"target_arch=='arm'\", {\n              \"include_dirs\": [ \"<(node_root_dir)/deps/openssl/config/arm\" ]\n            }]\n          ]\n        }]\n      ]\n    }\n  ]\n}\n```\n\nThis ensures that when OpenSSL is statically linked into `node` then, the bundled OpenSSL headers are included, but when the system OpenSSL is in use, then only those headers will be used.\n\n## Windows?\n\nAs you can see this baseline `binding.gyp` file only accounts for the Unix scenario. Currently on Windows the situation is a little less ideal. On Windows, OpenSSL is _always_ statically compiled into the `node` executable, so ideally it would be possible to use that copy of OpenSSL when building native addons.\n\nUnfortunately it doesn't seem like that is possible at the moment, as there would need to be tweaks made to the generated `node.lib` file to include the openssl glue functions, or a new `openssl.lib` file would need to be created during the node build. I'm not sure which is the easiest/most feasible.\n\nIn the meantime, one possible solution is using another copy of OpenSSL, which is what [`node-bcrypt`](https://github.com/ncb000gt/node.bcrypt.js) currently does. Adding something like this to your `binding.gyp` file's `\"conditions\"` block would enable this:\n\n``` python\n    [ 'OS==\"win\"', {\n      'conditions': [\n        # \"openssl_root\" is the directory on Windows of the OpenSSL files.\n        # Check the \"target_arch\" variable to set good default values for\n        # both 64-bit and 32-bit builds of the module.\n        ['target_arch==\"x64\"', {\n          'variables': {\n            'openssl_root%': 'C:/OpenSSL-Win64'\n          },\n        }, {\n          'variables': {\n            'openssl_root%': 'C:/OpenSSL-Win32'\n          },\n        }],\n      ],\n      'libraries': [ \n        '-l<(openssl_root)/lib/libeay32.lib',\n      ],\n      'include_dirs': [\n        '<(openssl_root)/include',\n      ],\n    }]\n```\n\nNow you can direct your users to install OpenSSL on Windows from here (be sure to tell them to install the 64-bit version if they're compiling against a 64-bit version of node): http://slproweb.com/products/Win32OpenSSL.html\n\nAlso note that both `node-gyp` and `npm` allow you to overwrite that default `openssl_root` variable on the command line:\n\n``` bash\n$ node-gyp rebuild --openssl-root=\"C:\\Users\\Nathan\\Desktop\\openssl\"\n```"
  },
  {
    "path": "docs/README.md",
    "content": "## Versions of `node-gyp` that are earlier than v11.x.x\n\nPlease look thru your error log for the string `gyp info using node-gyp@` and if that version number is less than the [current release of node-gyp](https://github.com/nodejs/node-gyp/releases) then __please upgrade__ using [these instructions](https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md) and then try your command again.\n\n## `node-sass` is deprecated\n\nPlease be aware that the package [`node-sass` is deprecated](https://github.com/sass/node-sass#node-sass) so you should actively seek alternatives.  You can try:\n```\nnpm uninstall node-sass\nnpm install sass --save\n# or ...\nnpm install --global node-sass@latest\n```\n`node-sass` projects _may_ work by downgrading to Node.js v14 but [that release is end-of-life](https://github.com/nodejs/release#release-schedule).\n\nIn any case, please avoid opening new `node-sass` issues on this repo because we [cannot help much](https://github.com/nodejs/node-gyp/issues?q=is%3Aissue+label%3A%22Node+Sass+--%3E+Dart+Sass%22).\n\n## `ffi-napi` is no longer maintained\n\n* node-ffi-napi/node-ffi-napi#269\n\nThere are a couple of workarounds (https://koffi.dev or `node-ffi-rs`) on that issue but using `ffi-napi` or its forks has proven problematic on modern versions of operating systems, Node.js, node-gyp, and Python.\n\nIn any case, please avoid opening new `ffi-napi` issues on this repo because we [cannot help much](https://github.com/nodejs/node-gyp/issues?q=label%3Affi-napi).\n"
  },
  {
    "path": "docs/Updating-npm-bundled-node-gyp.md",
    "content": "# Updating the npm-bundled version of node-gyp\n\n**Note: These instructions are (only) tested and known to work with npm 8 and older.**\n\n**Note: These instructions will be undone if you reinstall or upgrade npm or node! For a more permanent (and simpler) solution, see [Force-npm-to-use-global-node-gyp.md](Force-npm-to-use-global-node-gyp.md). (npm 6 or older only!)**\n\n[Many issues](https://github.com/nodejs/node-gyp/issues?q=label%3A\"ERR!+node-gyp+-v+<%3D+v9.x.x\") are opened by users who are\nnot running a [current version of node-gyp](https://github.com/nodejs/node-gyp/releases).\n\n`npm` bundles its own, internal, copy of `node-gyp`. This internal copy is independent of any globally installed copy of node-gyp that\nmay have been installed via `npm install -g node-gyp`.\n\nThis means that while `node-gyp` doesn't get installed into your `$PATH` by default, npm still keeps its own copy to invoke when you\nattempt to `npm install` a native add-on.\n\nSometimes, you may need to update npm's internal node-gyp to a newer version than what is installed. A simple `npm install -g node-gyp`\n_won't_ do the trick since npm will continue to use its internal copy over the global one.\n\nSo instead:\n\n## Version of npm\n\nWe need to start by knowing your version of `npm`:\n```bash\nnpm --version\n```\n\n## Linux, macOS, Solaris, etc.\n\nUnix is easy. Just run the following command.\n\nIf your npm is version ___7 or higher___, do:\n```bash\n$ npm explore npm/node_modules/@npmcli/run-script -g -- npm_config_global=false npm install node-gyp@latest\n```\n\nElse if your npm is version ___less than 7___, do:\n```bash\n$ npm explore npm/node_modules/npm-lifecycle -g -- npm install node-gyp@latest\n```\n\nIf the command fails with a permissions error, please try `sudo` and then the command.\n\n## Windows\n\nWindows is a bit trickier, since `npm` might be installed in the \"Program Files\" directory, which needs admin privileges to modify current Windows. Therefore, run the following commands __inside a `cmd.exe` started with \"Run as Administrator\"__:\n\nFirst, we need to find the location of `node`. If you don't already know the location that `node.exe` got installed to, then run:\n```bash\n$ where node\n```\n\nNow `cd` to the directory that `node.exe` is contained in e.g.:\n```bash\n$ cd \"C:\\Program Files\\nodejs\"\n```\n\nIf your npm version is ___7 or higher___, do:\n```bash\ncd node_modules\\npm\\node_modules\\@npmcli\\run-script\n```\n\nElse if your npm version is ___less than 7___, do:\n```bash\ncd node_modules\\npm\\node_modules\\npm-lifecycle\n```\n\nFinish by running:\n```bash\n$ npm install node-gyp@latest\n```\n"
  },
  {
    "path": "docs/binding.gyp-files-in-the-wild.md",
    "content": "This page contains links to some examples of existing `binding.gyp` files that other node modules are using. Take a look at them for inspiration.\n\nTo add to this page, just add the link to the project's `binding.gyp` file below:\n\n * [ons](https://github.com/XadillaX/aliyun-ons/blob/master/binding.gyp)\n * [thmclrx](https://github.com/XadillaX/thmclrx/blob/master/binding.gyp)\n * [libxmljs](https://github.com/polotek/libxmljs/blob/master/binding.gyp)\n * [node-buffertools](https://github.com/bnoordhuis/node-buffertools/blob/master/binding.gyp)\n * [node-canvas](https://github.com/LearnBoost/node-canvas/blob/master/binding.gyp)\n * [node-ffi](https://github.com/rbranson/node-ffi/blob/master/binding.gyp) + [libffi](https://github.com/rbranson/node-ffi/blob/master/deps/libffi/libffi.gyp)\n * [node-time](https://github.com/TooTallNate/node-time/blob/master/binding.gyp)\n * [node-sass](https://github.com/sass/node-sass/blob/master/binding.gyp) + [libsass](https://github.com/sass/node-sass/blob/master/src/libsass.gyp)\n * [node-serialport](https://github.com/voodootikigod/node-serialport/blob/master/binding.gyp)\n * [node-weak](https://github.com/TooTallNate/node-weak/blob/master/binding.gyp)\n * [pty.js](https://github.com/chjj/pty.js/blob/master/binding.gyp)\n * [ref](https://github.com/TooTallNate/ref/blob/master/binding.gyp)\n * [appjs](https://github.com/milani/appjs/blob/master/binding.gyp)\n * [nwm](https://github.com/mixu/nwm/blob/master/binding.gyp)\n * [bcrypt](https://github.com/ncb000gt/node.bcrypt.js/blob/master/binding.gyp)\n * [nk-mysql](https://github.com/mmod/nodamysql/blob/master/binding.gyp)\n * [nk-xrm-installer](https://github.com/mmod/nk-xrm-installer/blob/master/binding.gyp) + [includable.gypi](https://github.com/mmod/nk-xrm-installer/blob/master/includable.gypi) + [unpack.py](https://github.com/mmod/nk-xrm-installer/blob/master/unpack.py) + [disburse.py](https://github.com/mmod/nk-xrm-installer/blob/master/disburse.py)   \n   <sub>.py files above provide complete reference for examples of fetching source via http, extracting, and moving files.</sub>\n * [node-memwatch](https://github.com/lloyd/node-memwatch/blob/master/binding.gyp)\n * [node-ip2location](https://github.com/bolgovr/node-ip2location/blob/master/binding.gyp)\n * [node-midi](https://github.com/justinlatimer/node-midi/blob/master/binding.gyp)\n * [node-sqlite3](https://github.com/developmentseed/node-sqlite3/blob/master/binding.gyp) + [libsqlite3](https://github.com/developmentseed/node-sqlite3/blob/master/deps/sqlite3.gyp)\n * [node-zipfile](https://github.com/mapbox/node-zipfile/blob/master/binding.gyp)\n * [node-mapnik](https://github.com/mapnik/node-mapnik/blob/master/binding.gyp)\n * [node-inotify](https://github.com/c4milo/node-inotify/blob/master/binding.gyp)\n * [v8-profiler](https://github.com/c4milo/v8-profiler/blob/master/binding.gyp)\n * [airtunes](https://github.com/radioline/node_airtunes/blob/master/binding.gyp)\n * [node-fann](https://github.com/c4milo/node-fann/blob/master/binding.gyp)\n * [node-talib](https://github.com/oransel/node-talib/blob/master/binding.gyp)\n * [node-leveldown](https://github.com/rvagg/node-leveldown/blob/master/binding.gyp) + [leveldb.gyp](https://github.com/rvagg/node-leveldown/blob/master/deps/leveldb/leveldb.gyp) + [snappy.gyp](https://github.com/rvagg/node-leveldown/blob/master/deps/snappy/snappy.gyp)\n * [node-expat](https://github.com/astro/node-expat/blob/master/binding.gyp) + [libexpat](https://github.com/astro/node-expat/blob/master/deps/libexpat/libexpat.gyp)\n * [node-openvg-canvas](https://github.com/luismreis/node-openvg-canvas/blob/master/binding.gyp) + [node-openvg](https://github.com/luismreis/node-openvg/blob/master/binding.gyp)\n * [node-cryptopp](https://github.com/BatikhSouri/node-cryptopp/blob/master/binding.gyp)\n * [topcube](https://github.com/creationix/topcube/blob/master/binding.gyp)\n * [node-osmium](https://github.com/osmcode/node-osmium/blob/master/binding.gyp)\n * [node-osrm](https://github.com/DennisOSRM/node-osrm)\n * [node-oracle](https://github.com/joeferner/node-oracle/blob/master/binding.gyp)\n * [node-oracledb](https://github.com/oracle/node-oracledb/blob/main/binding.gyp)\n * [node-process-list](https://github.com/ReklatsMasters/node-process-list/blob/master/binding.gyp)\n * [node-nanomsg](https://github.com/nickdesaulniers/node-nanomsg/blob/master/binding.gyp)\n * [Ghostscript4JS](https://github.com/NickNaso/ghostscript4js/blob/master/binding.gyp)\n * [nodecv](https://github.com/xudafeng/nodecv/blob/master/binding.gyp)\n * [magick-cli](https://github.com/NickNaso/magick-cli/blob/master/binding.gyp)\n * [sharp](https://github.com/lovell/sharp/blob/master/binding.gyp)\n * [krb5](https://github.com/adaltas/node-krb5/blob/master/binding.gyp)\n * [node-heapdump](https://github.com/bnoordhuis/node-heapdump/blob/master/binding.gyp)\n"
  },
  {
    "path": "eslint.config.js",
    "content": "'use strict'\n\nmodule.exports = require('neostandard')({})\n"
  },
  {
    "path": "gyp/.github/dependabot.yml",
    "content": "# Keep GitHub Actions up to date with Dependabot...\n# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot\nversion: 2\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    groups:\n      GitHub_Actions:\n        patterns:\n          - \"*\"  # Group all Actions updates into a single larger pull request\n    schedule:\n      interval: weekly\n  - package-ecosystem: \"pip\"\n    directory: \"/\"\n    groups:\n      pip:\n        patterns:\n          - \"*\"  # Group all pip updates into a single larger pull request\n    schedule:\n      interval: weekly\n"
  },
  {
    "path": "gyp/.github/workflows/node-gyp.yml",
    "content": "name: node-gyp integration\non:\n  push:\n  pull_request:\n  workflow_dispatch:\n\njobs:\n  node-gyp-integration:\n    strategy:\n      fail-fast: false\n      matrix:\n        os: [macos-latest, ubuntu-latest, windows-latest]\n        python-version: [\"3.10\", \"3.12\", \"3.14\"]\n        include:\n          - os: macos-15-intel  # macOS on Intel\n            python-version: \"3.14\"\n          - os: ubuntu-24.04-arm  # Ubuntu on ARM\n            python-version: \"3.14\"\n          - os: windows-11-arm  # Windows on ARM\n            python-version: \"3.14\"\n    runs-on: ${{ matrix.os }}\n    steps:\n      - name: Clone gyp-next\n        uses: actions/checkout@v6\n        with:\n          path: gyp-next\n      - name: Clone nodejs/node-gyp\n        uses: actions/checkout@v6\n        with:\n          repository: nodejs/node-gyp\n          path: node-gyp\n      - uses: actions/setup-node@v6\n        with:\n          node-version: \"lts/*\"\n      - uses: actions/setup-python@v6\n        with:\n          python-version: ${{ matrix.python-version }}\n          allow-prereleases: true\n      - name: Install Python dependencies\n        run: |\n          cd gyp-next\n          python -m pip install --upgrade pip\n          pip install --editable .\n          pip uninstall -y gyp-next\n      - name: Install Node.js dependencies\n        run: |\n          cd node-gyp\n          npm install --no-progress\n      - name: Replace gyp in node-gyp\n        shell: bash\n        run: |\n          rm -rf node-gyp/gyp\n          cp -r gyp-next node-gyp/gyp\n      - name: Run tests (macOS or Linux)\n        if: runner.os != 'Windows'\n        run: |\n          cd node-gyp\n          npm test --python=\"${pythonLocation}/python\"\n      - name: Run tests (Windows)\n        if: runner.os == 'Windows'\n        shell: pwsh\n        run: |\n          cd node-gyp\n          npm run test --python=\"${env:pythonLocation}\\\\python.exe\"\n"
  },
  {
    "path": "gyp/.github/workflows/nodejs.yml",
    "content": "name: Node.js integration\non:\n  push:\n  pull_request:\n  workflow_dispatch:\n\njobs:\n  nodejs-integration:\n    strategy:\n      fail-fast: false\n      matrix:\n        os: [macos-latest, ubuntu-latest, windows-latest]\n        python-version: [\"3.10\", \"3.12\", \"3.14\"]\n        include:\n          - os: macos-15-intel  # macOS on Intel\n            python-version: \"3.14\"\n          - os: ubuntu-24.04-arm  # Ubuntu on ARM\n            python-version: \"3.14\"\n          - os: windows-11-arm  # Windows on ARM\n            python-version: \"3.14\"\n\n    runs-on: ${{ matrix.os }}\n    steps:\n      - name: Clone gyp-next\n        uses: actions/checkout@v6\n        with:\n          path: gyp-next\n      - name: Clone nodejs/node\n        uses: actions/checkout@v6\n        with:\n          repository: nodejs/node\n          path: node\n      - uses: actions/setup-python@v6\n        with:\n          python-version: ${{ matrix.python-version }}\n          allow-prereleases: true\n      - name: Replace gyp in Node.js\n        shell: bash\n        run: |\n          rm -rf node/tools/gyp\n          cp -r gyp-next node/tools/gyp\n\n      # macOS and Linux\n      - name: Run configure\n        if: runner.os != 'Windows'\n        run: |\n          cd node\n          ./configure\n\n      # Windows\n      - name: Install deps\n        if: runner.os == 'Windows'\n        run: choco install nasm\n      - name: Run configure\n        if: runner.os == 'Windows'\n        run: |\n          cd node\n          ./vcbuild.bat nobuild\n"
  },
  {
    "path": "gyp/.github/workflows/python_tests.yml",
    "content": "# TODO: Enable os: windows-latest\n# TODO: Enable pytest --doctest-modules\n\nname: Python_tests\non:\n  push:\n  pull_request:\n  workflow_dispatch:\n\njobs:\n  Python_tests:\n    runs-on: ${{ matrix.os }}\n    strategy:\n      fail-fast: false\n      max-parallel: 5\n      matrix:\n        os: [macos-15-intel, macos-latest, ubuntu-latest] # , windows-latest]\n        python-version: [\"3.8\", \"3.9\", \"3.10\", \"3.11\", \"3.12\", \"3.13\", \"3.14\"]\n        include:\n          - os: macos-26\n            python-version: 3.x\n    steps:\n      - uses: actions/checkout@v6\n      - name: Set up Python ${{ matrix.python-version }}\n        uses: actions/setup-python@v6\n        with:\n          python-version: ${{ matrix.python-version }}\n          allow-prereleases: true\n      - uses: seanmiddleditch/gha-setup-ninja@v6\n      - name: Install dependencies\n        run: |\n          python -m pip install --upgrade pip\n          pip install --editable \".[dev]\"\n      - run: ./gyp -V && ./gyp --version && gyp -V && gyp --version\n      - name: Lint with ruff  # See pyproject.toml for settings\n        uses: astral-sh/ruff-action@v3\n      - run: ruff format --check --diff\n      - name: Test with pytest  # See pyproject.toml for settings\n        run: pytest\n      # - name: Run doctests with pytest\n      #   run: pytest --doctest-modules\n      - name: Test CLI commands on a pipx install\n        run: |\n          pipx run --no-cache --spec ./ gyp --help\n          pipx run --no-cache --spec ./ gyp --version\n"
  },
  {
    "path": "gyp/.github/workflows/release-please.yml",
    "content": "on:\n  push:\n    branches:\n      - main\n\nname: release-please\njobs:\n  release-please:\n    runs-on: ubuntu-latest\n    outputs:\n      release_created: ${{ steps.release.outputs.release_created }}\n      tag_name: ${{ steps.release.outputs.tag_name }}\n    permissions:\n      contents: write\n      pull-requests: write\n    steps:\n      - uses: google-github-actions/release-please-action@v4\n        id: release\n\n  build:\n    name: Build distribution\n    needs:\n      - release-please\n    if: ${{ needs.release-please.outputs.release_created }}  # only publish on release\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v6\n    - name: Build a binary wheel and a source tarball\n      run: pipx run build\n    - name: Store the distribution packages\n      uses: actions/upload-artifact@v6\n      with:\n        name: python-package-distributions\n        path: dist/\n\n  publish-to-pypi:\n    name: >-\n      Publish Python distribution to PyPI\n    needs:\n      - release-please\n      - build\n    if: ${{ needs.release-please.outputs.release_created }}  # only publish on release\n    runs-on: ubuntu-latest\n    environment:\n      name: pypi\n      url: https://pypi.org/p/gyp-next\n    permissions:\n      id-token: write # IMPORTANT: mandatory for trusted publishing\n    steps:\n    - name: Download all the dists\n      uses: actions/download-artifact@v7\n      with:\n        name: python-package-distributions\n        path: dist/\n    - name: Publish distribution to PyPI\n      uses: pypa/gh-action-pypi-publish@release/v1\n\n  github-release:\n    name: >-\n      Publish Python distribution to GitHub Release\n    needs:\n      - release-please\n      - build\n    if: ${{ needs.release-please.outputs.release_created }}  # only publish on release\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write # IMPORTANT: mandatory for making GitHub Releases\n      id-token: write # IMPORTANT: mandatory for sigstore\n    steps:\n    - name: Download all the dists\n      uses: actions/download-artifact@v7\n      with:\n        name: python-package-distributions\n        path: dist/\n    - name: Sign the dists with Sigstore\n      uses: sigstore/gh-action-sigstore-python@v3.2.0\n      with:\n        inputs: >-\n          ./dist/*.tar.gz\n          ./dist/*.whl\n    - name: Upload artifact signatures to GitHub Release\n      env:\n        GITHUB_TOKEN: ${{ github.token }}\n      # Upload to GitHub Release using the `gh` CLI.\n      # `dist/` contains the built packages, and the\n      # sigstore-produced signatures and certificates.\n      run: >-\n        gh release upload\n        ${{ needs.release-please.outputs.tag_name }} dist/**\n        --repo '${{ github.repository }}'\n"
  },
  {
    "path": "gyp/.gitignore",
    "content": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\npip-wheel-metadata/\nshare/python-wheels/\n*.egg-info/\n.installed.cfg\n*.egg\nMANIFEST\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.nox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*.cover\n*.py,cover\n.hypothesis/\n.pytest_cache/\ncover/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\nlocal_settings.py\ndb.sqlite3\ndb.sqlite3-journal\n\n# Flask stuff:\ninstance/\n.webassets-cache\n\n# Scrapy stuff:\n.scrapy\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\n.pybuilder/\ntarget/\n\n# Jupyter Notebook\n.ipynb_checkpoints\n\n# IPython\nprofile_default/\nipython_config.py\n\n# pyenv\n#   For a library or package, you might want to ignore these files since the code is\n#   intended to run in multiple environments; otherwise, check them in:\n# .python-version\n\n# pipenv\n#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.\n#   However, in case of collaboration, if having platform-specific dependencies or dependencies\n#   having no cross-platform support, pipenv may install dependencies that don't work, or not\n#   install all needed dependencies.\n#Pipfile.lock\n\n# PEP 582; used by e.g. github.com/David-OConnor/pyflow\n__pypackages__/\n\n# Celery stuff\ncelerybeat-schedule\ncelerybeat.pid\n\n# SageMath parsed files\n*.sage.py\n\n# Environments\n.env\n.venv\nenv/\nvenv/\nENV/\nenv.bak/\nvenv.bak/\n\n# Spyder project settings\n.spyderproject\n.spyproject\n\n# Rope project settings\n.ropeproject\n\n# mkdocs documentation\n/site\n\n# mypy\n.mypy_cache/\n.dmypy.json\ndmypy.json\n\n# Pyre type checker\n.pyre/\n\n# pytype static type analyzer\n.pytype/\n\n# Cython debug symbols\ncython_debug/\n\n# static files generated from Django application using `collectstatic`\nmedia\nstatic\n\ntest/fixtures/out\n*.actual\n"
  },
  {
    "path": "gyp/.release-please-manifest.json",
    "content": "{\n    \".\": \"0.21.1\"\n}\n"
  },
  {
    "path": "gyp/AUTHORS",
    "content": "# Names should be added to this file like so:\n# Name or Organization <email address>\n\nGoogle Inc. <*@google.com>\nBloomberg Finance L.P. <*@bloomberg.net>\nIBM Inc. <*@*.ibm.com>\nYandex LLC <*@yandex-team.ru>\n\nSteven Knight <knight@baldmt.com>\nRyan Norton <rnorton10@gmail.com>\nDavid J. Sankel <david@sankelsoftware.com>\nEric N. Vander Weele <ericvw@gmail.com>\nTom Freudenberg <th.freudenberg@gmail.com>\nJulien Brianceau <jbriance@cisco.com>\nRefael Ackermann <refack@gmail.com>\nUjjwal Sharma <ryzokuken@disroot.org>\nChristian Clauss <cclauss@me.com>\n"
  },
  {
    "path": "gyp/CHANGELOG.md",
    "content": "# Changelog\n\n## [0.21.1](https://github.com/nodejs/gyp-next/compare/v0.21.0...v0.21.1) (2026-01-24)\n\n\n### Bug Fixes\n\n* replace weak hash functions with SHA-256 ([#329](https://github.com/nodejs/gyp-next/issues/329)) ([958029e](https://github.com/nodejs/gyp-next/commit/958029e6e4969a871d15e78cd083bb102bebb381))\n\n## [0.21.0](https://github.com/nodejs/gyp-next/compare/v0.20.5...v0.21.0) (2025-11-04)\n\n\n### Features\n\n* add support for Visual Studio 2026 ([#319](https://github.com/nodejs/gyp-next/issues/319)) ([cb13bbc](https://github.com/nodejs/gyp-next/commit/cb13bbc4ab7a7d86b51221b39ebee4281e1d3e19))\n\n## [0.20.5](https://github.com/nodejs/gyp-next/compare/v0.20.4...v0.20.5) (2025-10-13)\n\n\n### Bug Fixes\n\n* Fix ruff v0.13.0 adds ruff rule RUF059 ([bd4491a](https://github.com/nodejs/gyp-next/commit/bd4491a3ba641eeb040b785bbce367f72c3baf19))\n* handle `None` case in xcode_emulation regexes ([#311](https://github.com/nodejs/gyp-next/issues/311)) ([b21ee31](https://github.com/nodejs/gyp-next/commit/b21ee3150eea9fc1a8811e910e5ba64f42e1fb77))\n\n## [0.20.4](https://github.com/nodejs/gyp-next/compare/v0.20.3...v0.20.4) (2025-08-25)\n\n\n### Bug Fixes\n\n* **cli:** remove duplicate usage ([#308](https://github.com/nodejs/gyp-next/issues/308)) ([0996f60](https://github.com/nodejs/gyp-next/commit/0996f60e9bc83ec9d7b31e39bebd23f8dc990130))\n* **docs:** Add running gyp via uv ([#306](https://github.com/nodejs/gyp-next/issues/306)) ([0e43f61](https://github.com/nodejs/gyp-next/commit/0e43f61da8154f9b460ccba9ce4c0a25d2383ac4))\n\n## [0.20.3](https://github.com/nodejs/gyp-next/compare/v0.20.2...v0.20.3) (2025-08-20)\n\n\n### Bug Fixes\n\n* compilation failure on the OpenHarmony platform ([#301](https://github.com/nodejs/gyp-next/issues/301)) ([0cf7a14](https://github.com/nodejs/gyp-next/commit/0cf7a142be06f686b8b42849791de902f177cf9f))\n* make xcode_emulation handle `xcodebuild` not in the `PATH` ([#303](https://github.com/nodejs/gyp-next/issues/303)) ([8224dee](https://github.com/nodejs/gyp-next/commit/8224deef984add7e7afe846cfb82c9d3fa6da1fb))\n\n## [0.20.2](https://github.com/nodejs/gyp-next/compare/v0.20.1...v0.20.2) (2025-06-22)\n\n\n### Bug Fixes\n\n* Python lint import-outside-top-level ruff rule PLC0415 ([#298](https://github.com/nodejs/gyp-next/issues/298)) ([34f4df6](https://github.com/nodejs/gyp-next/commit/34f4df614936ee6a056e47406ebbe7e3c1cb6540))\n\n## [0.20.1](https://github.com/nodejs/gyp-next/compare/v0.20.0...v0.20.1) (2025-06-06)\n\n\n### Bug Fixes\n\n* Ensure Consistent Order of build_files in WriteAutoRegenerationRule ([#293](https://github.com/nodejs/gyp-next/issues/293)) ([59b5903](https://github.com/nodejs/gyp-next/commit/59b59035f4ae63419343ffdafe0f0ff511ada17d))\n* ignore failure of `GetCompilerPredefines` ([#295](https://github.com/nodejs/gyp-next/issues/295)) ([0eaea29](https://github.com/nodejs/gyp-next/commit/0eaea297f0fbb0869597aa162f66f78eb2468fad))\n\n## [0.20.0](https://github.com/nodejs/gyp-next/compare/v0.19.1...v0.20.0) (2025-03-27)\n\n\n### ⚠ BREAKING CHANGES\n\n* resolve issue with relative paths during linking ([#284](https://github.com/nodejs/gyp-next/issues/284))\n\n### Bug Fixes\n\n* python lint  more ruff rules ([#291](https://github.com/nodejs/gyp-next/issues/291)) ([fabc78c](https://github.com/nodejs/gyp-next/commit/fabc78caffcf988365d970ced5a151f40525077e))\n* remove explicit installation of setuptools ([#278](https://github.com/nodejs/gyp-next/issues/278)) ([e476778](https://github.com/nodejs/gyp-next/commit/e4767782c70ca8427184694589d9f0ded5eeed22))\n* resolve issue with relative paths during linking ([#284](https://github.com/nodejs/gyp-next/issues/284)) ([a2d7439](https://github.com/nodejs/gyp-next/commit/a2d7439fbd3c03f01e1149fdbe682f754bc6cc7f))\n\n## [0.19.1](https://github.com/nodejs/gyp-next/compare/v0.19.0...v0.19.1) (2024-12-09)\n\n\n### Bug Fixes\n\n* fixup for break in EscapeForCString ([#274](https://github.com/nodejs/gyp-next/issues/274)) ([610f661](https://github.com/nodejs/gyp-next/commit/610f661da877a358c8b3cbc106b528fb1d0b8095))\n\n## [0.19.0](https://github.com/nodejs/gyp-next/compare/v0.18.3...v0.19.0) (2024-12-03)\n\n\n### Features\n\n* provide escaped version of `PRODUCT_DIR_ABS` ([#271](https://github.com/nodejs/gyp-next/issues/271)) ([3bf3b1c](https://github.com/nodejs/gyp-next/commit/3bf3b1cda26f16c645e0fdd5582ffbf49d9a2580))\n\n## [0.18.3](https://github.com/nodejs/gyp-next/compare/v0.18.2...v0.18.3) (2024-10-08)\n\n\n### Bug Fixes\n\n* enable pch for clang on windows ([#268](https://github.com/nodejs/gyp-next/issues/268)) ([cc5838c](https://github.com/nodejs/gyp-next/commit/cc5838c4e9260bf459d71de53fbb2eebd1a6f508))\n\n## [0.18.2](https://github.com/nodejs/gyp-next/compare/v0.18.1...v0.18.2) (2024-09-23)\n\n\n### Bug Fixes\n\n* do not assume that /usr/bin/env exists on macOS ([#216](https://github.com/nodejs/gyp-next/issues/216)) ([706d04a](https://github.com/nodejs/gyp-next/commit/706d04aba5bd18f311dc56f84720e99f64c73466))\n* fix E721 lint errors ([#206](https://github.com/nodejs/gyp-next/issues/206)) ([d1299a4](https://github.com/nodejs/gyp-next/commit/d1299a49d313eccabecf97ccb56fc033afad39ad))\n\n## [0.18.1](https://github.com/nodejs/gyp-next/compare/v0.18.0...v0.18.1) (2024-05-26)\n\n\n### Bug Fixes\n\n* **ci:** add Python 3.13 pre-release to test matrix ([#257](https://github.com/nodejs/gyp-next/issues/257)) ([8597203](https://github.com/nodejs/gyp-next/commit/8597203b687325c7516367135e026586279d0583))\n\n\n### Documentation\n\n* vendor docs from gyp.gsrc.io ([#254](https://github.com/nodejs/gyp-next/issues/254)) ([8d7ba6e](https://github.com/nodejs/gyp-next/commit/8d7ba6e784dedf1122a0456150c739d2a09ecf57))\n\n## [0.18.0](https://github.com/nodejs/gyp-next/compare/v0.17.0...v0.18.0) (2024-05-08)\n\n\n### Features\n\n* support language standard keys in msvs_settings ([#252](https://github.com/nodejs/gyp-next/issues/252)) ([322f6d5](https://github.com/nodejs/gyp-next/commit/322f6d5d5233967522f3e55c623a8e7d7281e024))\n\n## [0.17.0](https://github.com/nodejs/gyp-next/compare/v0.16.2...v0.17.0) (2024-04-29)\n\n\n### Features\n\n* generate compile_commands.json with ninja ([#228](https://github.com/nodejs/gyp-next/issues/228)) ([7b20b46](https://github.com/nodejs/gyp-next/commit/7b20b4673d8cf46ff61898eb19569007d55c854a))\n\n\n### Bug Fixes\n\n* failed to detect flavor if compiler path include white spaces ([#240](https://github.com/nodejs/gyp-next/issues/240)) ([f3b9753](https://github.com/nodejs/gyp-next/commit/f3b9753e7526377020e7d40e66b624db771cf84a))\n* support cross compiling for wasm with make generator ([#222](https://github.com/nodejs/gyp-next/issues/222)) ([de0e1c9](https://github.com/nodejs/gyp-next/commit/de0e1c9a5791d1bf4bc3103f878ab74814864ab4))\n* support empty dictionary keys in input ([#245](https://github.com/nodejs/gyp-next/issues/245)) ([178459f](https://github.com/nodejs/gyp-next/commit/178459ff343a2771d5f30f04467d2f032d6b3565))\n* update Ruff to 0.3.1 ([876ccaf](https://github.com/nodejs/gyp-next/commit/876ccaf5629e1b95e13aaa2b0eb6cbd08fa80593))\n\n## [0.16.2](https://github.com/nodejs/gyp-next/compare/v0.16.1...v0.16.2) (2024-03-07)\n\n\n### Bug Fixes\n\n* avoid quoting cflag name and parameter with space separator ([#223](https://github.com/nodejs/gyp-next/issues/223)) ([2b9703d](https://github.com/nodejs/gyp-next/commit/2b9703dbd5b3b8a935faf257c6103033b47bf8bf))\n\n## [0.16.1](https://github.com/nodejs/gyp-next/compare/v0.16.0...v0.16.1) (2023-10-25)\n\n\n### Bug Fixes\n\n* add quotes for command in msvs generator ([#217](https://github.com/nodejs/gyp-next/issues/217)) ([d3b7bcd](https://github.com/nodejs/gyp-next/commit/d3b7bcdec90d6c1b1affc15ece706e63007b7264))\n\n## [0.16.0](https://github.com/nodejs/gyp-next/compare/v0.15.1...v0.16.0) (2023-10-23)\n\n\n### Features\n\n* add VCToolsVersion for msvs ([#209](https://github.com/nodejs/gyp-next/issues/209)) ([0e35ab8](https://github.com/nodejs/gyp-next/commit/0e35ab812d890fb75cf89a19ea72bc93dd6ba186))\n\n## [0.15.1](https://github.com/nodejs/gyp-next/compare/v0.15.0...v0.15.1) (2023-09-08)\n\n\n### Bug Fixes\n\n* some Python lint issues ([#200](https://github.com/nodejs/gyp-next/issues/200)) ([d2dfe4e](https://github.com/nodejs/gyp-next/commit/d2dfe4e66b64c16b38bef984782db93d12674f05))\n* use generator_output as output_dir ([#191](https://github.com/nodejs/gyp-next/issues/191)) ([35ffeb1](https://github.com/nodejs/gyp-next/commit/35ffeb1da8ef3fc8311e2e812cff550568f7e8a2))\n\n## [0.15.0](https://github.com/nodejs/gyp-next/compare/v0.14.1...v0.15.0) (2023-03-30)\n\n\n### Features\n\n* **msvs:** add SpectreMitigation attribute ([#190](https://github.com/nodejs/gyp-next/issues/190)) ([853e464](https://github.com/nodejs/gyp-next/commit/853e4643b6737224a5aa0720a4108461a0230991))\n\n## [0.14.1](https://github.com/nodejs/gyp-next/compare/v0.14.0...v0.14.1) (2023-02-19)\n\n\n### Bug Fixes\n\n* flake8 extended-ignore ([#186](https://github.com/nodejs/gyp-next/issues/186)) ([c38493c](https://github.com/nodejs/gyp-next/commit/c38493c2556aa63b6dc40ab585c18aef5ca270d3))\n* No build_type in default_variables ([#183](https://github.com/nodejs/gyp-next/issues/183)) ([ac262fe](https://github.com/nodejs/gyp-next/commit/ac262fe82453c4e8dc47529338d157eb0b5ec0fb))\n\n\n### Documentation\n\n* README.md: Add pipx installation and run instructions ([#165](https://github.com/nodejs/gyp-next/issues/165)) ([4d28b15](https://github.com/nodejs/gyp-next/commit/4d28b155568dc35f11c7f86124d1dd42ba428bed))\n\n## [0.14.0](https://github.com/nodejs/gyp-next/compare/v0.13.0...v0.14.0) (2022-10-08)\n\n\n### Features\n\n* Add command line argument for `gyp --version` ([#164](https://github.com/nodejs/gyp-next/issues/164)) ([5c9f4d0](https://github.com/nodejs/gyp-next/commit/5c9f4d05678dd855e18ed2327219e5d18e5374db))\n* ninja build for iOS ([#174](https://github.com/nodejs/gyp-next/issues/174)) ([b6f2714](https://github.com/nodejs/gyp-next/commit/b6f271424e0033d7ed54d437706695af2ba7a1bf))\n* **zos:** support IBM Open XL C/C++ & PL/I compilers on z/OS ([#178](https://github.com/nodejs/gyp-next/issues/178)) ([43a7211](https://github.com/nodejs/gyp-next/commit/43a72110ae3fafb13c9625cc7a969624b27cda47))\n\n\n### Bug Fixes\n\n* lock windows env ([#163](https://github.com/nodejs/gyp-next/issues/163)) ([44bd0dd](https://github.com/nodejs/gyp-next/commit/44bd0ddc93ea0b5770a44dd326a2e4ae62c21442))\n* move configuration information into pyproject.toml ([#176](https://github.com/nodejs/gyp-next/issues/176)) ([d69d8ec](https://github.com/nodejs/gyp-next/commit/d69d8ece6dbff7af4f2ea073c9fd170baf8cb7f7))\n* node.js debugger adds stderr (but exit code is 0) -> shouldn't throw ([#179](https://github.com/nodejs/gyp-next/issues/179)) ([1a457d9](https://github.com/nodejs/gyp-next/commit/1a457d9ed08cfd30c9fa551bc5cf0d90fb583787))\n\n## [0.13.0](https://www.github.com/nodejs/gyp-next/compare/v0.12.1...v0.13.0) (2022-05-11)\n\n\n### Features\n\n* add PRODUCT_DIR_ABS variable ([#151](https://www.github.com/nodejs/gyp-next/issues/151)) ([80d2626](https://www.github.com/nodejs/gyp-next/commit/80d26263581db829b61b312a7bdb5cc791df7824))\n\n\n### Bug Fixes\n\n* execvp: printf: Argument list too long ([#147](https://www.github.com/nodejs/gyp-next/issues/147)) ([c4e14f3](https://www.github.com/nodejs/gyp-next/commit/c4e14f301673fadbac3ab7882d0b5f4d02530cb9))\n\n### [0.12.1](https://www.github.com/nodejs/gyp-next/compare/v0.12.0...v0.12.1) (2022-04-06)\n\n\n### Bug Fixes\n\n* **msvs:** avoid fixing path for arguments with \"=\" ([#143](https://www.github.com/nodejs/gyp-next/issues/143)) ([7e8f16e](https://www.github.com/nodejs/gyp-next/commit/7e8f16eb165e042e64bec98fa6c2a0232a42c26b))\n\n## [0.12.0](https://www.github.com/nodejs/gyp-next/compare/v0.11.0...v0.12.0) (2022-04-04)\n\n\n### Features\n\n* support building shared libraries on z/OS ([#137](https://www.github.com/nodejs/gyp-next/issues/137)) ([293bcfa](https://www.github.com/nodejs/gyp-next/commit/293bcfa4c25c6adb743377adafc45a80fee492c6))\n\n## [0.11.0](https://www.github.com/nodejs/gyp-next/compare/v0.10.1...v0.11.0) (2022-03-04)\n\n\n### Features\n\n* Add proper support for IBM i ([#140](https://www.github.com/nodejs/gyp-next/issues/140)) ([fdda4a3](https://www.github.com/nodejs/gyp-next/commit/fdda4a3038b8a7042ad960ce7a223687c24a21b1))\n\n### [0.10.1](https://www.github.com/nodejs/gyp-next/compare/v0.10.0...v0.10.1) (2021-11-24)\n\n\n### Bug Fixes\n\n* **make:** only generate makefile for multiple toolsets if requested ([#133](https://www.github.com/nodejs/gyp-next/issues/133)) ([f463a77](https://www.github.com/nodejs/gyp-next/commit/f463a77705973289ea38fec1b244c922ac438e26))\n\n## [0.10.0](https://www.github.com/nodejs/gyp-next/compare/v0.9.6...v0.10.0) (2021-08-26)\n\n\n### Features\n\n* **msvs:** add support for Visual Studio 2022 ([#124](https://www.github.com/nodejs/gyp-next/issues/124)) ([4bd9215](https://www.github.com/nodejs/gyp-next/commit/4bd9215c44d300f06e916aec1d6327c22b78272d))\n\n### [0.9.6](https://www.github.com/nodejs/gyp-next/compare/v0.9.5...v0.9.6) (2021-08-23)\n\n\n### Bug Fixes\n\n* align flake8 test ([#122](https://www.github.com/nodejs/gyp-next/issues/122)) ([f1faa8d](https://www.github.com/nodejs/gyp-next/commit/f1faa8d3081e1a47e917ff910892f00dff16cf8a))\n* **msvs:** fix paths again in action command arguments ([#121](https://www.github.com/nodejs/gyp-next/issues/121)) ([7159dfb](https://www.github.com/nodejs/gyp-next/commit/7159dfbc5758c9ec717e215f2c36daf482c846a1))\n\n### [0.9.5](https://www.github.com/nodejs/gyp-next/compare/v0.9.4...v0.9.5) (2021-08-18)\n\n\n### Bug Fixes\n\n* add python 3.6 to node-gyp integration test ([3462d4c](https://www.github.com/nodejs/gyp-next/commit/3462d4ce3c31cce747513dc7ca9760c81d57c60e))\n* revert for windows compatibility ([d078e7d](https://www.github.com/nodejs/gyp-next/commit/d078e7d7ae080ddae243188f6415f940376a7368))\n* support msvs_quote_cmd in ninja generator ([#117](https://www.github.com/nodejs/gyp-next/issues/117)) ([46486ac](https://www.github.com/nodejs/gyp-next/commit/46486ac6e9329529d51061e006a5b39631e46729))\n\n### [0.9.4](https://www.github.com/nodejs/gyp-next/compare/v0.9.3...v0.9.4) (2021-08-09)\n\n\n### Bug Fixes\n\n* .S is an extension for asm file on Windows ([#115](https://www.github.com/nodejs/gyp-next/issues/115)) ([d2fad44](https://www.github.com/nodejs/gyp-next/commit/d2fad44ef3a79ca8900f1307060153ded57053fc))\n\n### [0.9.3](https://www.github.com/nodejs/gyp-next/compare/v0.9.2...v0.9.3) (2021-07-07)\n\n\n### Bug Fixes\n\n* build failure with ninja and Python 3 on Windows ([#113](https://www.github.com/nodejs/gyp-next/issues/113)) ([c172d10](https://www.github.com/nodejs/gyp-next/commit/c172d105deff5db4244e583942215918fa80dd3c))\n\n### [0.9.2](https://www.github.com/nodejs/gyp-next/compare/v0.9.1...v0.9.2) (2021-05-21)\n\n\n### Bug Fixes\n\n* add support of utf8 encoding ([#105](https://www.github.com/nodejs/gyp-next/issues/105)) ([4d0f93c](https://www.github.com/nodejs/gyp-next/commit/4d0f93c249286d1f0c0f665f5fe7346119f98cf1))\n\n### [0.9.1](https://www.github.com/nodejs/gyp-next/compare/v0.9.0...v0.9.1) (2021-05-14)\n\n\n### Bug Fixes\n\n* py lint ([3b6a8ee](https://www.github.com/nodejs/gyp-next/commit/3b6a8ee7a66193a8a6867eba9e1d2b70bdf04402))\n\n## [0.9.0](https://www.github.com/nodejs/gyp-next/compare/v0.8.1...v0.9.0) (2021-05-13)\n\n\n### Features\n\n* use LDFLAGS_host for host toolset ([#98](https://www.github.com/nodejs/gyp-next/issues/98)) ([bea5c7b](https://www.github.com/nodejs/gyp-next/commit/bea5c7bd67d6ad32acbdce79767a5481c70675a2))\n\n\n### Bug Fixes\n\n* msvs.py: remove overindentation ([#102](https://www.github.com/nodejs/gyp-next/issues/102)) ([3f83e99](https://www.github.com/nodejs/gyp-next/commit/3f83e99056d004d9579ceb786e06b624ddc36529))\n* update gyp.el to change case to cl-case ([#93](https://www.github.com/nodejs/gyp-next/issues/93)) ([13d5b66](https://www.github.com/nodejs/gyp-next/commit/13d5b66aab35985af9c2fb1174fdc6e1c1407ecc))\n\n### [0.8.1](https://www.github.com/nodejs/gyp-next/compare/v0.8.0...v0.8.1) (2021-02-18)\n\n\n### Bug Fixes\n\n* update shebang lines from python to python3 ([#94](https://www.github.com/nodejs/gyp-next/issues/94)) ([a1b0d41](https://www.github.com/nodejs/gyp-next/commit/a1b0d4171a8049a4ab7a614202063dec332f2df4))\n\n## [0.8.0](https://www.github.com/nodejs/gyp-next/compare/v0.7.0...v0.8.0) (2021-01-15)\n\n\n### ⚠ BREAKING CHANGES\n\n* remove support for Python 2\n\n### Bug Fixes\n\n* revert posix build job ([#86](https://www.github.com/nodejs/gyp-next/issues/86)) ([39dc34f](https://www.github.com/nodejs/gyp-next/commit/39dc34f0799c074624005fb9bbccf6e028607f9d))\n\n\n### gyp\n\n* Remove support for Python 2 ([#88](https://www.github.com/nodejs/gyp-next/issues/88)) ([22e4654](https://www.github.com/nodejs/gyp-next/commit/22e465426fd892403c95534229af819a99c3f8dc))\n\n## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)\n\n\n### ⚠ BREAKING CHANGES\n\n* **msvs:** On Windows, arguments passed to the \"action\" commands are no longer transformed to replace slashes with backslashes.\n\n### Features\n\n* **xcode:** --cross-compiling overrides arch-specific settings ([973bae0](https://www.github.com/nodejs/gyp-next/commit/973bae0b7b08be7b680ecae9565fbd04b3e0787d))\n\n\n### Bug Fixes\n\n* **msvs:** do not fix paths in action command arguments ([fc22f83](https://www.github.com/nodejs/gyp-next/commit/fc22f8335e2016da4aae4f4233074bd651d2faea))\n* cmake on python 3 ([fd61f5f](https://www.github.com/nodejs/gyp-next/commit/fd61f5faa5275ec8fc98e3c7868c0dd46f109540))\n* ValueError: invalid mode: 'rU' while trying to load binding.gyp ([d0504e6](https://www.github.com/nodejs/gyp-next/commit/d0504e6700ce48f44957a4d5891b142a60be946f))\n* xcode cmake parsing ([eefe8d1](https://www.github.com/nodejs/gyp-next/commit/eefe8d10e99863bc4ac7e2ed32facd608d400d4b))\n\n### [0.6.2](https://www.github.com/nodejs/gyp-next/compare/v0.6.1...v0.6.2) (2020-10-16)\n\n\n### Bug Fixes\n\n* do not rewrite absolute paths to avoid long paths ([#74](https://www.github.com/nodejs/gyp-next/issues/74)) ([c2ccc1a](https://www.github.com/nodejs/gyp-next/commit/c2ccc1a81f7f94433a94f4d01a2e820db4c4331a))\n* only include MARMASM when toolset is target ([5a2794a](https://www.github.com/nodejs/gyp-next/commit/5a2794aefb58f0c00404ff042b61740bc8b8d5cd))\n\n### [0.6.1](https://github.com/nodejs/gyp-next/compare/v0.6.0...v0.6.1) (2020-10-14)\n\n\n### Bug Fixes\n\n* Correctly rename object files for absolute paths in MSVS generator.\n\n## [0.6.0](https://github.com/nodejs/gyp-next/compare/v0.5.0...v0.6.0) (2020-10-13)\n\n\n### Features\n\n* The Makefile generator will now output shared libraries directly to the product directory on all platforms (previously only macOS).\n\n## [0.5.0](https://github.com/nodejs/gyp-next/compare/v0.4.0...v0.5.0) (2020-09-30)\n\n\n### Features\n\n* Extended compile_commands_json generator to consider more file extensions than just `c` and `cc`. `cpp` and `cxx` are now supported.\n* Source files with duplicate basenames are now supported.\n\n### Removed\n\n* The `--no-duplicate-basename-check` option was removed.\n* The `msvs_enable_marmasm` configuration option was removed in favor of auto-inclusion of the \"marmasm\" sections for Windows on ARM.\n\n## [0.4.0](https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0) (2020-07-14)\n\n\n### Features\n\n* Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.\n\n### Bug Fixes\n\n* Fixed a bug on Solaris where copying archives failed.\n\n## [0.3.0](https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0) (2020-06-06)\n\n\n### Features\n\n* Added support for MSVC cross-compilation. This allows compilation on x64 for a Windows ARM target.\n\n### Bug Fixes\n\n* Fixed XCode CLT version detection on macOS Catalina.\n\n### [0.2.1](https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1) (2020-05-05)\n\n\n### Bug Fixes\n\n* Relicensed to Node.js contributors.\n* Fixed Windows bug introduced in v0.2.0.\n\n## [0.2.0](https://github.com/nodejs/gyp-next/releases/tag/v0.2.0) (2020-04-06)\n\nThis is the first release of this project, based on https://chromium.googlesource.com/external/gyp with changes made over the years in Node.js and node-gyp.\n"
  },
  {
    "path": "gyp/CODE_OF_CONDUCT.md",
    "content": "# Code of Conduct\n\n* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md)\n* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/HEAD/Moderation-Policy.md)\n"
  },
  {
    "path": "gyp/CONTRIBUTING.md",
    "content": "# Contributing to gyp-next\n\n## Start contributing\n\nRead the docs at [`./docs/Hacking.md`](./docs/Hacking.md) to get started.\n\n## Code of Conduct\n\nThis project is bound to the [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md).\n\n<a id=\"developers-certificate-of-origin\"></a>\n## Developer's Certificate of Origin 1.1\n\nBy making a contribution to this project, I certify that:\n\n* (a) The contribution was created in whole or in part by me and I\n  have the right to submit it under the open source license\n  indicated in the file; or\n\n* (b) The contribution is based upon previous work that, to the best\n  of my knowledge, is covered under an appropriate open source\n  license and I have the right under that license to submit that\n  work with modifications, whether created in whole or in part\n  by me, under the same open source license (unless I am\n  permitted to submit under a different license), as indicated\n  in the file; or\n\n* (c) The contribution was provided directly to me by some other\n  person who certified (a), (b) or (c) and I have not modified\n  it.\n\n* (d) I understand and agree that this project and the contribution\n  are public and that a record of the contribution (including all\n  personal information I submit with it, including my sign-off) is\n  maintained indefinitely and may be redistributed consistent with\n  this project or the open source license(s) involved.\n"
  },
  {
    "path": "gyp/LICENSE",
    "content": "Copyright (c) 2020 Node.js contributors. All rights reserved.\nCopyright (c) 2009 Google Inc. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n   * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n   * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n   * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "gyp/README.md",
    "content": "GYP can Generate Your Projects.\n===================================\n\nDocuments are available at [`./docs`](./docs).\n\n__gyp-next__ is [released](https://github.com/nodejs/gyp-next/releases) to the [__Python Packaging Index__](https://pypi.org/project/gyp-next) (PyPI) and can be installed with the command:\n* `python3 -m pip install gyp-next`\n\nWhen used as a command line utility, __gyp-next__ can also be installed with [pipx](https://pypa.github.io/pipx) or [uv](https://docs.astral.sh/uv):\n* `pipx install gyp-next ` # --or--\n* `uv tool install gyp-next`\n```\nInstalling to a new venv 'gyp-next'\n  installed package gyp-next 0.13.0, installed using Python 3.10.6\n  These apps are now globally available\n    - gyp\ndone! ✨ 🌟 ✨\n```\n\nOr to run __gyp-next__ directly without installing it:\n* `pipx run gyp-next --help ` # --or--\n* `uvx --from=gyp-next gyp --help`\n```\nNOTE: running app 'gyp' from 'gyp-next'\nusage: gyp [options ...] [build_file ...]\n\noptions:\n  -h, --help            show this help message and exit\n  --build CONFIGS       configuration for build after project generation\n  --check               check format of gyp files\n  [ ... ]\n```\n"
  },
  {
    "path": "gyp/data/ninja/build.ninja",
    "content": "rule cc\n  command = cc $in $out\n\nbuild my.out: cc my.in\n"
  },
  {
    "path": "gyp/data/win/large-pdb-shim.cc",
    "content": "// Copyright (c) 2013 Google Inc. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// This file is used to generate an empty .pdb -- with a 4KB pagesize -- that is\n// then used during the final link for modules that have large PDBs. Otherwise,\n// the linker will generate a pdb with a page size of 1KB, which imposes a limit\n// of 1GB on the .pdb. By generating an initial empty .pdb with the compiler\n// (rather than the linker), this limit is avoided. With this in place PDBs may\n// grow to 2GB.\n//\n// This file is referenced by the msvs_large_pdb mechanism in MSVSUtil.py.\n"
  },
  {
    "path": "gyp/docs/GypVsCMake.md",
    "content": "# vs. CMake\n\nGYP was originally created to generate native IDE project files (Visual Studio, Xcode) for building [Chromium](http://www.chromim.org).\n\nThe functionality of GYP is very similar to the [CMake](http://www.cmake.org)\nbuild tool.  Bradley Nelson wrote up the following description of why the team\ncreated GYP instead of using CMake.  The text below is copied from\nhttp://www.mail-archive.com/webkit-dev@lists.webkit.org/msg11029.html\n\n```\n\nRe: [webkit-dev] CMake as a build system?\nBradley Nelson\nMon, 19 Apr 2010 22:38:30 -0700\n\nHere's the innards of an email with a laundry list of stuff I came up with a\nwhile back on the gyp-developers list in response to Mike Craddick regarding\nwhat motivated gyp's development, since we were aware of cmake at the time\n(we'd even started a speculative port):\n\n\nI did an exploratory port of portions of Chromium to cmake (I think I got as\nfar as net, base, sandbox, and part of webkit).\nThere were a number of motivations, not all of which would apply to other\nprojects. Also, some of the design of gyp was informed by experience at\nGoogle with large projects built wholly from source, leading to features\nabsent from cmake, but not strictly required for Chromium.\n\n1. Ability to incrementally transition on Windows. It took us about 6 months\nto switch fully to gyp. Previous attempts to move to scons had taken a long\ntime and failed, due to the requirement to transition while in flight. For a\nsubstantial period of time, we had a hybrid of checked in vcproj and gyp generated\nvcproj. To this day we still have a good number of GUIDs pinned in the gyp files,\nbecause different parts of our release pipeline have leftover assumptions\nregarding manipulating the raw sln/vcprojs. This transition occurred from\nthe bottom up, largely because modules like base were easier to convert, and\nhad a lower churn rate. During early stages of the transition, the majority\nof the team wasn't even aware they were using gyp, as it integrated into\ntheir existing workflow, and only affected modules that had been converted.\n\n2. Generation of a more 'normal' vcproj file. Gyp attempts, particularly on\nWindows, to generate vcprojs which resemble hand generated projects. It\ndoesn't generate any Makefile type projects, but instead produces msvs\nCustom Build Steps and Custom Build Rules. This makes the resulting projects\neasier to understand from the IDE and avoids parts of the IDE that simply\ndon't function correctly if you use Makefile projects. Our early hope with\ngyp was to support the least common denominator of features present in each\nof the platform specific project file formats, rather than falling back on\ngenerated Makefiles/shell scripts to emulate some common abstraction. CMake by\ncomparison makes a good faith attempt to use native project features, but\nfalls back on generated scripts in order to preserve the same semantics on\neach platforms.\n\n3. Abstraction on the level of project settings, rather than command line\nflags. In gyp's syntax you can add nearly any option present in a hand\ngenerated xcode/vcproj file. This allows you to use abstractions built into\nthe IDEs rather than reverse engineering them possibly incorrectly for\nthings like: manifest generation, precompiled headers, bundle generation.\nWhen somebody wants to use a particular menu option from msvs, I'm able to\ndo a web search on the name of the setting from the IDE and provide them\nwith a gyp stanza that does the equivalent. In many cases, not all project\nfile constructs correspond to command line flags.\n\n4. Strong notion of module public/private interface. Gyp allows targets to\npublish a set of direct_dependent_settings, specifying things like\ninclude_dirs, defines, platforms specific settings, etc. This means that\nwhen module A depends on module B, it automatically acquires the right build\nsettings without module A being filled with assumptions/knowledge of exactly\nhow module B is built. Additionally, all of the transitive dependencies of\nmodule B are pulled in. This avoids their being a single top level view of\nthe project, rather each gyp file expresses knowledge about its immediate\nneighbors. This keep local knowledge local. CMake effectively has a large\nshared global namespace.\n\n5. Cross platform generation. CMake is not able to generate all project\nfiles on all platforms. For example xcode projects cannot be generated from\nwindows (cmake uses mac specific libraries to do project generation). This\nmeans that for instance generating a tarball containing pregenerated\nprojects for all platforms is hard with Cmake (requires distribution to\nseveral machine types).\n\n6. Gyp has rudimentary cross compile support. Currently we've added enough\nfunctionality to gyp to support x86 -> arm cross compiles. Last I checked\nthis functionality wasn't present in cmake. (This occurred later).\n\n\nThat being said there are a number of drawbacks currently to gyp:\n\n1. Because platform specific settings are expressed at the project file\nlevel (rather than the command line level). Settings which might otherwise\nbe shared in common between platforms (flags to gcc on mac/linux), end up\nbeing repeated twice. Though in fairness there is actually less sharing here\nthan you'd think. include_dirs and defines actually represent 90% of what\ncan be typically shared.\n\n2. CMake may be more mature, having been applied to a broader range of\nprojects. There a number of 'tool modules' for cmake, which are shared in a\ncommon community.\n\n3. gyp currently makes some nasty assumptions about the availability of\nchromium's hermetic copy of cygwin on windows. This causes you to either\nhave to special case a number of rules, or swallow this copy of cygwin as a\nbuild time dependency.\n\n4. CMake includes a fairly readable imperative language. Currently Gyp has a\nsomewhat poorly specified declarative language (variable expansion happens\nin sometimes weird and counter-intuitive ways). In fairness though, gyp assumes\nthat external python scripts can be used as an escape hatch. Also gyp avoids\na lot of the things you'd need imperative code for, by having a nice target\nsettings publication mechanism.\n\n5. (Feature/drawback depending on personal preference). Gyp's syntax is\nDEEPLY nested. It suffers from all of Lisp's advantages and drawbacks.\n\n-BradN\n```\n"
  },
  {
    "path": "gyp/docs/Hacking.md",
    "content": "# Hacking\n\n## Getting the sources\n\nGit is required to hack on anything, you can set up a git clone of GYP\nas follows:\n\n```\nmkdir foo\ncd foo\ngit clone git@github.com:nodejs/gyp-next.git\ncd gyp\n```\n\n(this will clone gyp underneath it into `foo/gyp`.\n`foo` can be any directory name you want. Once you've done that,\nyou can use the repo like anything other Git repo.\n\n## Testing your change\n\nGYP has a suite of tests which you can run with the provided test driver\nto make sure your changes aren't breaking anything important.\n\nYou run the test driver with e.g.\n\n``` sh\n$ python -m pip install --upgrade pip\n$ pip install --editable \".[dev]\"\n$ python -m pytest\n```\n\nSee [Testing](Testing.md) for more details on the test framework.\n\nNote that it can be handy to look at the project files output by the tests\nto diagnose problems. The easiest way to do that is by kindly asking the\ntest driver to leave the temporary directories it creates in-place.\nThis is done by setting the environment variable \"PRESERVE\", e.g.\n\n```\nset PRESERVE=all     # On Windows\nexport PRESERVE=all  # On saner platforms.\n```\n\n## Reviewing your change\n\nAll changes to GYP must be code reviewed before submission.\n"
  },
  {
    "path": "gyp/docs/InputFormatReference.md",
    "content": "# Input Format Reference\n\n## Primitive Types\n\nThe following primitive types are found within input files:\n\n  * String values, which may be represented by enclosing them in\n    `'single quotes'` or `\"double quotes\"`.  By convention, single\n    quotes are used.\n  * Integer values, which are represented in decimal without any special\n    decoration.  Integers are fairly rare in input files, but have a few\n    applications in boolean contexts, where the convention is to\n    represent true values with `1` and false with `0`.\n  * Lists, which are represented as a sequence of items separated by\n    commas (`,`) within square brackets (`[` and `]`).  A list may\n    contain any other primitive types, including other lists.\n    Generally, each item of a list must be of the same type as all other\n    items in the list, but in some cases (such as within `conditions`\n    sections), the list structure is more tightly specified.  A trailing\n    comma is permitted.\n\n    This example list contains three string values.\n\n      ```\n      [ 'Generate', 'Your', 'Projects', ]\n      ```\n\n  * Dictionaries, which map keys to values.  All keys are strings.\n    Values may be of any other primitive type, including other\n    dictionaries.  A dictionary is enclosed within curly braces (`{` and\n    `}`).  Keys precede values, separated by a colon (`:`).  Successive\n    dictionary entries are separated by commas (`,`).  A trailing comma\n    is permitted.  It is an error for keys to be duplicated within a\n    single dictionary as written in an input file, although keys may\n    replace other keys during [merging](#Merging).\n\n    This example dictionary maps each of three keys to different values.\n\n      ```\n      {\n        'inputs': ['version.c.in'],\n        'outputs': ['version.c'],\n        'process_outputs_as_sources': 1,\n      }\n      ```\n\n## Overall Structure\n\nA GYP input file is organized as structured data.  At the root scope of\neach `.gyp` or `.gypi` (include) file is a dictionary.  The keys and\nvalues of this dictionary, along with any descendants contained within\nthe values, provide the data contained within the file.  This data is\ngiven meaning by interpreting specific key names and their associated\nvalues in specific ways (see [Settings Keys](#Settings_Keys)).\n\n### Comments (#)\n\nWithin an input file, a comment is introduced by a pound sign (`#`) not\nwithin a string.  Any text following the pound sign, up until the end of\nthe line, is treated as a comment.\n\n#### Example\n\n```\n{\n  'school_supplies': [\n    'Marble composition book',\n    'Sharp #2 pencil',\n    'Safety scissors',  # You still shouldn't run with these\n  ],\n}\n```\n\nIn this example, the # in `'Sharp #2 pencil'` is not taken as\nintroducing a comment because it occurs within a string, but the text\nafter `'Safety scissors'` is treated as a comment having no impact on\nthe data within the file.\n\n## Merging\n\n### Merge Basics (=, ?, +)\n\nMany operations on GYP input files occurs by merging dictionary and list\nitems together.  During merge operations, it is important to recognize\nthe distinction between source and destination values.  Items from the\nsource value are merged into the destination, which leaves the source\nunchanged and the destination modified by the source.  A dictionary may\nonly be merged into another dictionary, and a list may only be merged\ninto another list.\n\n  * When merging a dictionary, for each key in the source:\n    * If the key does not exist in the destination dictionary, insert it\n      and copy the associated value directly.\n    * If the key does exist:\n      * If the associated value is a dictionary, perform the dictionary\n        merging procedure using the source's and destination's value\n        dictionaries.\n      * If the associated value is a list, perform the list merging\n        procedure using the source's and destination's value lists.\n      * If the associated value is a string or integer, the destination\n        value is replaced by the source value.\n  * When merging a list, merge according to the suffix appended to the\n    key name, if the list is a value within a dictionary.\n    * If the key ends with an equals sign (`=`), the policy is for the\n      source list to completely replace the destination list if it\n      exists.  _Mnemonic: `=` for assignment._\n    * If the key ends with a question mark (`?`), the policy is for the\n      source list to be set as the destination list only if the key is\n      not already present in the destination.  _Mnemonic: `?` for\n      conditional assignment_.\n    * If the key ends with a plus sign (`+`), the policy is for the\n      source list contents to be prepended to the destination list.\n      _Mnemonic: `+` for addition or concatenation._\n    * If the list key is undecorated, the policy is for the source list\n      contents to be appended to the destination list.  This is the\n      default list merge policy.\n\n#### Example\n\nSource dictionary:\n\n```\n{\n  'include_dirs+': [\n    'shared_stuff/public',\n  ],\n  'link_settings': {\n    'libraries': [\n      '-lshared_stuff',\n    ],\n  },\n  'test': 1,\n}\n```\n\nDestination dictionary:\n\n```\n{\n  'target_name': 'hello',\n  'sources': [\n    'kitty.cc',\n  ],\n  'include_dirs': [\n    'headers',\n  ],\n  'link_settings': {\n    'libraries': [\n      '-lm',\n    ],\n    'library_dirs': [\n      '/usr/lib',\n    ],\n  },\n  'test': 0,\n}\n```\n\nMerged dictionary:\n\n```\n{\n  'target_name': 'hello',\n  'sources': [\n    'kitty.cc',\n  ],\n  'include_dirs': [\n    'shared_stuff/public',  # Merged, list item prepended due to include_dirs+\n    'headers',\n  ],\n  'link_settings': {\n    'libraries': [\n      '-lm',\n      '-lshared_stuff',  # Merged, list item appended\n    ],\n    'library_dirs': [\n      '/usr/lib',\n    ],\n  },\n  'test': 1,  # Merged, int value replaced\n}\n```\n\n## Pathname Relativization\n\nIn a `.gyp` or `.gypi` file, many string values are treated as pathnames\nrelative to the file in which they are defined.\n\nString values associated with the following keys, or contained within\nlists associated with the following keys, are treated as pathnames:\n\n  * destination\n  * files\n  * include\\_dirs\n  * inputs\n  * libraries\n  * library\\_dirs\n  * outputs\n  * sources\n  * mac\\_bundle\\_resources\n  * mac\\_framework\\_dirs\n  * msvs\\_cygwin\\_dirs\n  * msvs\\_props\n\nAdditionally, string values associated with keys ending in the following\nsuffixes, or contained within lists associated with keys ending in the\nfollowing suffixes, are treated as pathnames:\n\n  * `_dir`\n  * `_dirs`\n  * `_file`\n  * `_files`\n  * `_path`\n  * `_paths`\n\nHowever, any string value beginning with any of these characters is\nexcluded from pathname relativization:\n\n  * `/` for identifying absolute paths.\n  * `$` for introducing build system variable expansions.\n  * `-` to support specifying such items as `-llib`, meaning “library\n    `lib` in the library search path.”\n  * `<`, `>`, and `!` for GYP expansions.\n\nWhen merging such relative pathnames, they are adjusted so that they can\nremain valid relative pathnames, despite being relative to a new home.\n\n#### Example\n\nSource dictionary from `../build/common.gypi`:\n\n```\n{\n  'include_dirs': ['include'],  # Treated as relative to ../build\n  'library_dirs': ['lib'],      # Treated as relative to ../build\n  'libraries': ['-lz'],   # Not treated as a pathname, begins with a dash\n  'defines': ['NDEBUG'],  # defines does not contain pathnames\n}\n```\n\nTarget dictionary, from `base.gyp`:\n\n```\n{\n  'sources': ['string_util.cc'],\n}\n```\n\nMerged dictionary:\n\n```\n{\n  'sources': ['string_util.cc'],\n  'include_dirs': ['../build/include'],\n  'library_dirs': ['../build/lib'],\n  'libraries': ['-lz'],\n  'defines': ['NDEBUG'],\n}\n```\n\nBecause of pathname relativization, after the merge is complete, all of\nthe pathnames in the merged dictionary are valid relative to the\ndirectory containing `base.gyp`.\n\n## List Singletons\n\nSome list items are treated as singletons, and the list merge process\nwill enforce special rules when merging them.  At present, any string\nitem in a list that does not begin with a dash (`-`) is treated as a\nsingleton, although **this is subject to change.**  When appending or\nprepending a singleton to a list, if the item is already in the list,\nonly the earlier instance is retained in the merged list.\n\n#### Example\n\nSource dictionary:\n\n```\n{\n  'defines': [\n    'EXPERIMENT=1',\n    'NDEBUG',\n  ],\n}\n```\n\nDestination dictionary:\n\n```\n{\n  'defines': [\n    'NDEBUG',\n    'USE_THREADS',\n  ],\n}\n```\n\nMerged dictionary:\n\n```\n{\n  'defines': [\n    'NDEBUG',\n    'USE_THREADS',\n    'EXPERIMENT=1',  # Note that NDEBUG is not appended after this.\n  ],\n}\n```\n\n## Including Other Files\n\nIf the `-I` (`--include`) argument was used to invoke GYP, any files\nspecified will be implicitly merged into the root dictionary of all\n`.gyp` files.\n\nAn [includes](#includes) section may be placed anywhere within a\n`.gyp` or `.gypi` (include) file.  `includes` sections contain lists of\nother files to include.  They are processed sequentially and merged into\nthe enclosing dictionary at the point that the `includes` section was\nfound.  `includes` sections at the root of a `.gyp` file dictionary are\nmerged after any `-I` includes from the command line.\n\n[includes](#includes) sections are processed immediately after a file is\nloaded, even before [variable and conditional\nprocessing](#Variables_and_Conditionals), so it is not possible to\ninclude a file based on a [variable reference](#Variable_Expansions).\nWhile it would be useful to be able to include files based on variable\nexpansions, it is most likely more useful to allow included files access\nto variables set by the files that included them.\n\nAn [includes](#includes) section may, however, be placed within a\n[conditional](#Conditionals) section.  The included file itself will\nbe loaded unconditionally, but its dictionary will be discarded if the\nassociated condition is not true.\n\n## Variables and Conditionals\n\n### Variables\n\nThere are three main types of variables within GYP.\n\n  * Predefined variables.  By convention, these are named with\n    `CAPITAL_LETTERS`.  Predefined variables are set automatically by\n    GYP.  They may be overridden, but it is not advisable to do so.  See\n    [Predefined Variables](#Predefined_Variables) for a list of\n    variables that GYP provides.\n  * User-defined variables.  Within any dictionary, a key named\n    `variables` can be provided, containing a mapping between variable\n    names (keys) and their contents (values), which may be strings,\n    integers, or lists of strings.  By convention, user-defined\n    variables are named with `lowercase_letters`.\n  * Automatic variables.  Within any dictionary, any key with a string\n    value has a corresponding automatic variable whose name is the same\n    as the key name with an underscore (`_`) prefixed.  For example, if\n    your dictionary contains `type: 'static_library'`, an automatic\n    variable named `_type` will be provided, and its value will be a\n    string, `'static_library'`.\n\nVariables are inherited from enclosing scopes.\n\n### Providing Default Values for Variables (%)\n\nWithin a `variables` section, keys named with percent sign (`%`)\nsuffixes mean that the variable should be set only if it is undefined at\nthe time it is processed.  This can be used to provide defaults for\nvariables that would otherwise be undefined, so that they may reliably\nbe used in [variable expansion or conditional\nprocessing](#Variables_and_Conditionals).\n\n### Predefined Variables\n\nEach GYP generator module provides defaults for the following variables:\n\n  * `OS`: The name of the operating system that the generator produces\n    output for.  Common values for values for `OS` are:\n\n    * `'linux'`\n    * `'mac'`\n    * `'win'`\n\n    But other values may be encountered and this list should not be\n    considered exhaustive.  The `gypd` (debug) generator module does not\n    provide a predefined value for `OS`.  When invoking GYP with the\n    `gypd` module, if a value for `OS` is needed, it must be provided on\n    the command line, such as `gyp -f gypd -DOS=mac`.\n\n    GYP generators also provide defaults for these variables.  They may\n    be expressed in terms of variables used by the build system that\n    they generate for, often in `$(VARIABLE)` format.  For example, the\n    GYP `PRODUCT_DIR` variable maps to the Xcode `BUILT_PRODUCTS_DIR`\n    variable, so `PRODUCT_DIR` is defined by the Xcode generator as\n    `$(BUILT_PRODUCTS_DIR)`.\n  * `EXECUTABLE_PREFIX`: A prefix, if any, applied to executable names.\n    Usually this will be an empty string.\n  * `EXECUTABLE_SUFFIX`: A suffix, if any, applied to executable names.\n    On Windows, this will be `.exe`, elsewhere, it will usually be an\n    empty string.\n  * `INTERMEDIATE_DIR`: A directory that can be used to place\n    intermediate build results in.  `INTERMEDIATE_DIR` is only\n    guaranteed to be accessible within a single target (See targets).\n    This variable is most useful within the context of rules and actions\n    (See rules, See actions).  Compare with `SHARED_INTERMEDIATE_DIR`.\n  * `PRODUCT_DIR`: The directory in which the primary output of each\n    target, such as executables and libraries, is placed.\n  * `RULE_INPUT_ROOT`: The base name for the input file (e.g. \"`foo`\").\n    See Rules.\n  * `RULE_INPUT_EXT`: The file extension for the input file (e.g.\n    \"`.cc`\").  See Rules.\n  * `RULE_INPUT_NAME`: Full name of the input file (e.g. \"`foo.cc`\").\n    See Rules.\n  * `RULE_INPUT_PATH`: Full path to the input file (e.g.\n    \"`/bar/foo.cc`\").  See Rules.\n  * `SHARED_INTERMEDIATE_DIR`: A directory that can be used to place\n    intermediate build results in, and have them be accessible to other\n    targets.  Unlike `INTERMEDIATE_DIR`, each target in a project,\n    possibly spanning multiple `.gyp` files, shares the same\n    `SHARED_INTERMEDIATE_DIR`.\n\nThe following additional predefined variables may be available under\ncertain circumstances:\n\n  * `DEPTH`.  When GYP is invoked with a `--depth` argument, when\n    processing any `.gyp` file, `DEPTH` will be a relative path from the\n    `.gyp` file to the directory specified by the `--depth` argument.\n\n### User-Defined Variables\n\nA user-defined variable may be defined in terms of other variables, but\nnot other variables that have definitions provided in the same scope.\n\n### Variable Expansions (<, >, <@, >@)\n\nGYP provides two forms of variable expansions, “early” or “pre”\nexpansions, and “late,” “post,” or “target” expansions.  They have\nsimilar syntax, differing only in the character used to introduce them.\n\n  * Early expansions are introduced by a less-than (`<`) character.\n    _Mnemonic: the arrow points to the left, earlier on a timeline._\n  * Late expansions are introduced by a less-than (`>`) character.\n    _Mnemonic: the arrow points to the right, later on a timeline._\n\nThe difference the two phases of expansion is described in [Early and\nLate Phases](#Early_and_Late_Phases).\n\nThese characters were chosen based upon the requirement that they not\nconflict with the variable format used natively by build systems.  While\nthe dollar sign (`$`) is the most natural fit for variable expansions,\nits use was ruled out because most build systems already use that\ncharacter for their own variable expansions.  Using different characters\nmeans that no escaping mechanism was needed to differentiate between GYP\nvariables and build system variables, and writing build system variables\ninto GYP files is not cumbersome.\n\nVariables may contain lists or strings, and variable expansions may\noccur in list or string context.  There are variant forms of variable\nexpansions that may be used to determine how each type of variable is to\nbe expanded in each context.\n\n  * When a variable is referenced by `<(VAR)` or `>(VAR)`:\n    * If `VAR` is a string, the variable reference within the string is\n      replaced by variable's string value.\n    * If `VAR` is a list, the variable reference within the string is\n      replaced by a string containing the concatenation of all of the\n      variable’s list items.  Generally, the items are joined with\n      spaces between each, but the specific behavior is\n      generator-specific.  The precise encoding used by any generator\n      should be one that would allow each list item to be treated as a\n      separate argument when used as program arguments on the system\n      that the generator produces output for.\n  * When a variable is referenced by `<@(VAR)` or `>@(VAR)`:\n    * The expansion must occur in list context.\n    * The list item must be `'<@(VAR)'` or `'>@(VAR)'` exactly.\n    * If `VAR` is a list, each of its elements are inserted into the\n      list in which expansion is taking place, replacing the list item\n      containing the variable reference.\n    * If `VAR` is a string, the string is converted to a list which is\n      inserted into the list in which expansion is taking place as\n      above.  The conversion into a list is generator-specific, but\n      generally, spaces in the string are taken as separators between\n      list items.  The specific method of converting the string to a\n      list should be the inverse of the encoding method used to expand\n      list variables in string context, above.\n\nGYP treats references to undefined variables as errors.\n\n### Command Expansions (<!, <!@)\n\nCommand expansions function similarly to variable expansions, but\ninstead of resolving variable references, they cause GYP to execute a\ncommand at generation time and use the command’s output as the\nreplacement.  Command expansions are introduced by a less than and\nexclamation mark (`<!`).\n\nIn a command expansion, the entire string contained within the\nparentheses is passed to the system’s shell.  The command’s output is\nassigned to a string value that may subsequently be expanded in list\ncontext in the same way as variable expansions if an `@` character is\nused.\n\nIn addition, command expansions (unlike other variable expansions) may\ninclude nested variable expansions.  So something like this is allowed:\n\n```\n'variables' : [\n  'foo': '<!(echo Build Date <!(date))',\n],\n```\n\nexpands to:\n\n```\n'variables' : [\n  'foo': 'Build Date 02:10:38 PM Fri Jul 24, 2009 -0700 PDT',\n],\n```\n\nYou may also put commands into arrays in order to quote arguments (but\nnote that you need to use a different string quoting character):\n\n```\n'variables' : [\n  'files': '<!([\"ls\", \"-1\", \"Filename With Spaces\"])',\n],\n```\n\nGYP treats command failures (as indicated by a nonzero exit status)\nduring command expansion as errors.\n\n#### Example\n\n```\n{\n  'sources': [\n    '!(echo filename with space.cc)',\n  ],\n  'libraries': [\n    '!@(pkg-config --libs-only-l apr-1)',\n  ],\n}\n```\n\nmight expand to:\n\n```\n{\n  'sources': [\n    'filename with space.cc',  # no @, expands into a single string\n  ],\n  'libraries': [  # @ was used, so there's a separate list item for each lib\n    '-lapr-1',\n    '-lpthread',\n  ],\n}\n```\n\n## Conditionals\n\nConditionals use the same set of variables used for variable expansion.\nAs with variable expansion, there are two phases of conditional\nevaluation:\n\n  * “Early” or “pre” conditional evaluation, introduced in\n    [conditions](#conditions) sections.\n  * “Late,” “post,” or “target” conditional evaluation, introduced in\n    [target\\_conditions](#target_conditions) sections.\n\nThe syntax for each type is identical, they differ only in the key name\nused to identify them and the timing of their evaluation.  A more\ncomplete description of syntax and use is provided in\n[conditions](#conditions).\n\nThe difference the two phases of evaluation is described in [Early and\nLate Phases](#Early_and_Late_Phases).\n\n## Timing of Variable Expansion and Conditional Evaluation\n\n### Early and Late Phases\n\nGYP performs two phases of variable expansion and conditional evaluation:\n\n  * The “early” or “pre” phase operates on [conditions](#conditions)\n    sections and the `<` form of [variable\n    expansions](#Variable_Expansions).\n  * The “late,” “post,” or “target” phase operates on\n    [target\\_conditions](#target_conditions) sections, the `>` form\n    of [variable expansions](#Variable_Expansions),\n    and on the `!` form of [command\n    expansions](#Command_Expansions_(!,_!@)).\n\nThese two phases are provided because there are some circumstances in\nwhich each is desirable.\n\nThe “early” phase is appropriate for most expansions and evaluations.\n“Early” expansions and evaluations may be performed anywhere within any\n`.gyp` or `.gypi` file.\n\nThe “late” phase is appropriate when expansion or evaluation must be\ndeferred until a specific section has been merged into target context.\n“Late” expansions and evaluations only occur within `targets` sections\nand their descendants.  The typical use case for a late-phase expansion\nis to provide, in some globally-included `.gypi` file, distinct\nbehaviors depending on the specifics of a target.\n\n#### Example\n\nGiven this input:\n\n```\n{\n  'target_defaults': {\n    'target_conditions': [\n      ['_type==\"shared_library\"', {'cflags': ['-fPIC']}],\n    ],\n  },\n  'targets': [\n    {\n      'target_name': 'sharing_is_caring',\n      'type': 'shared_library',\n    },\n    {\n      'target_name': 'static_in_the_attic',\n      'type': 'static_library',\n    },\n  ]\n}\n```\n\nThe conditional needs to be evaluated only in target context; it is\nnonsense outside of target context because no `_type` variable is\ndefined.  [target\\_conditions](#target_conditions) allows evaluation\nto be deferred until after the [targets](#targets) sections are\nmerged into their copies of [target\\_defaults](#target_defaults).\nThe resulting targets, after “late” phase processing:\n\n```\n{\n  'targets': [\n    {\n      'target_name': 'sharing_is_caring',\n      'type': 'shared_library',\n      'cflags': ['-fPIC'],\n    },\n    {\n      'target_name': 'static_in_the_attic',\n      'type': 'static_library',\n    },\n  ]\n}\n```\n\n### Expansion and Evaluation Performed Simultaneously\n\nDuring any expansion and evaluation phase, both expansion and evaluation\nare performed simultaneously.  The process for handling variable\nexpansions and conditional evaluation within a dictionary is:\n\n  * Load [automatic variables](#Variables) (those with leading\n    underscores).\n  * If a [variables](#variables) section is present, recurse into its\n    dictionary.  This allows [conditionals](#Conditionals) to be\n    present within the `variables` dictionary.\n  * Load [Variables user-defined variables](#User-Defined) from the\n    [variables](#variables) section.\n  * For each string value in the dictionary, perform [variable\n    expansion](#Variable_Expansions) and, if operating\n    during the “late” phase, [command\n    expansions](#Command_Expansions).\n  * Reload [automatic variables](#Variables) and [Variables\n    user-defined variables](#User-Defined) because the variable\n    expansion step may have resulted in changes to the automatic\n    variables.\n  * If a [conditions](#conditions) or\n    [target\\_conditions](#target_conditions) section (depending on\n    phase) is present, recurse into its dictionary.  This is done after\n    variable expansion so that conditionals may take advantage of\n    expanded automatic variables.\n  * Evaluate [conditionals](#Conditionals).\n  * Reload [automatic variables](#Variables) and [Variables\n    user-defined variables](#User-Defined) because the conditional\n    evaluation step may have resulted in changes to the automatic\n    variables.\n  * Recurse into child dictionaries or lists that have not yet been\n    processed.\n\nOne quirk of this ordering is that you cannot expect a\n[variables](#variables) section within a dictionary’s\n[conditional](#Conditionals) to be effective in the dictionary\nitself, but the added variables will be effective in any child\ndictionaries or lists.  It is thought to be far more worthwhile to\nprovide resolved [automatic variables](#Variables) to\n[conditional](#Conditionals) sections, though.  As a workaround, to\nconditionalize variable values, place a [conditions](#conditions) or\n[target\\_conditions](#target_conditions) section within the\n[variables](#variables) section.\n\n## Dependencies and Dependents\n\nIn GYP, “dependents” are targets that rely on other targets, called\n“dependencies.”  Dependents declare their reliance with a special\nsection within their target dictionary,\n[dependencies](#dependencies).\n\n### Dependent Settings\n\nIt is useful for targets to “advertise” settings to their dependents.\nFor example, a target might require that all of its dependents add\ncertain directories to their include paths, link against special\nlibraries, or define certain preprocessor macros.  GYP allows these\ncases to be handled gracefully with “dependent settings” sections.\nThere are three types of such sections:\n\n  * [direct\\_dependent\\_settings](#direct_dependent_settings), which\n    advertises settings to a target's direct dependents only.\n  * [all\\_dependent\\_settings](#all_dependnet_settings), which\n    advertises settings to all of a target's dependents, both direct and\n    indirect.\n  * [link\\_settings](#link_settings), which contains settings that\n    should be applied when a target’s object files are used as linker\n    input.\n\nFurthermore, in some cases, a target needs to pass its dependencies’\nsettings on to its own dependents.  This might happen when a target’s\nown public header files include header files provided by its dependency.\n[export\\_dependent\\_settings](#export_dependent_settings) allows a\ntarget to declare dependencies for which\n[direct\\_dependent\\_settings](#direct_dependent_settings) should be\npassed through to its own dependents.\n\nDependent settings processing merges a copy of the relevant dependent\nsettings dictionary from a dependency into its relevant dependent\ntargets.\n\nIn most instances,\n[direct\\_dependent\\_settings](#direct_dependent_settings) will be\nused.  There are very few cases where\n[all\\_dependent\\_settings](#all_dependent_settings) is actually\ncorrect; in most of the cases where it is tempting to use, it would be\npreferable to declare\n[export\\_dependent\\_settings](#export_dependent_settings).  Most\n[libraries](#libraries) and [library\\_dirs](#library_dirs)\nsections should be placed within [link\\_settings](#link_settings)\nsections.\n\n#### Example\n\nGiven:\n\n```\n{\n  'targets': [\n    {\n      'target_name': 'cruncher',\n      'type': 'static_library',\n      'sources': ['cruncher.cc'],\n      'direct_dependent_settings': {\n        'include_dirs': ['.'],  # dependents need to find cruncher.h.\n      },\n      'link_settings': {\n        'libraries': ['-lm'],  # cruncher.cc does math.\n      },\n    },\n    {\n      'target_name': 'cruncher_test',\n      'type': 'executable',\n      'dependencies': ['cruncher'],\n      'sources': ['cruncher_test.cc'],\n    },\n  ],\n}\n```\n\nAfter dependent settings processing, the dictionary for `cruncher_test`\nwill be:\n\n```\n{\n  'target_name': 'cruncher_test',\n  'type': 'executable',\n  'dependencies': ['cruncher'],  # implies linking against cruncher\n  'sources': ['cruncher_test.cc'],\n  'include_dirs': ['.']\n  'libraries': ['-lm'],\n},\n```\n\nIf `cruncher` was declared as a `shared_library` instead of a\n`static_library`, the `cruncher_test` target would not contain `-lm`,\nbut instead, `cruncher` itself would link against `-lm`.\n\n## Linking Dependencies\n\nThe precise meaning of a dependency relationship varies with the\n[types](#type) of the [targets](#targets) at either end of the\nrelationship.  In GYP, a dependency relationship can indicate two things\nabout how targets relate to each other:\n\n  * Whether the dependent target needs to link against the dependency.\n  * Whether the dependency target needs to be built prior to the\n    dependent.  If the former case is true, this case must be true as\n    well.\n\nThe analysis of the first item is complicated by the differences between\nstatic and shared libraries.\n\n  * Static libraries are simply collections of object files (`.o` or\n    `.obj`) that are used as inputs to a linker (`ld` or `link.exe`).\n    Static libraries don't link against other libraries, they’re\n    collected together and used when eventually linking a shared library\n    or executable.\n  * Shared libraries are linker output and must undergo symbol\n    resolution.  They must link against other libraries (static or\n    shared) in order to facilitate symbol resolution.  They may be used\n    as libraries in subsequent link steps.\n  * Executables are also linker output, and also undergo symbol\n    resolution.  Like shared libraries, they must link against static\n    and shared libraries to facilitate symbol resolution.  They may not\n    be reused as linker inputs in subsequent link steps.\n\nAccordingly, GYP performs an operation referred to as “static library\ndependency adjustment,” in which it makes each linker output target\n(shared libraries and executables) link against the static libraries it\ndepends on, either directly or indirectly.  Because the linkable targets\nlink against these static libraries, they are also made direct\ndependents of the static libraries.\n\nAs part of this process, GYP is also able to remove the direct\ndependency relationships between two static library targets, as a\ndependent static library does not actually need to link against a\ndependency static library.  This removal facilitates speedier builds\nunder some build systems, as they are now free to build the two targets\nin parallel.  The removal of this dependency is incorrect in some cases,\nsuch as when the dependency target contains [rules](#rules) or\n[actions](#actions) that generate header files required by the\ndependent target.  In such cases, the dependency target, the one\nproviding the side-effect files, must declare itself as a\n[hard\\_dependency](#hard_dependency).  This setting instructs GYP to\nnot remove the dependency link between two static library targets in its\ngenerated output.\n\n## Loading Files to Resolve Dependencies\n\nWhen GYP runs, it loads all `.gyp` files needed to resolve dependencies\nfound in [dependencies](#dependencies) sections.  These files are not\nmerged into the files that reference them, but they may contain special\nsections that are merged into dependent target dictionaries.\n\n## Build Configurations\n\nExplain this.\n\n## List Filters\n\nGYP allows list items to be filtered by “exclusions” and “patterns.”\nAny list containing string values in a dictionary may have this\nfiltering applied.  For the purposes of this section, a list modified by\nexclusions or patterns is referred to as a “base list”, in contrast to\nthe “exclusion list” and “pattern list” that operates on it.\n\n  * For a base list identified by key name `key`, the `key!` list\n    provides exclusions.\n  * For a base list identified by key name `key`, the `key/` list\n    provides regular expression pattern-based filtering.\n\nBoth `key!` and `key/` may be present.  The `key!` exclusion list will\nbe processed first, followed by the `key/` pattern list.\n\nExclusion lists are most powerful when used in conjunction with\n[conditionals](#Conditionals).\n\n## Exclusion Lists (!)\n\nAn exclusion list provides a way to remove items from the related list\nbased on exact matching.  Any item found in an exclusion list will be\nremoved from the corresponding base list.\n\n#### Example\n\nThis example excludes files from the `sources` based on the setting of\nthe `OS` variable.\n\n```\n{\n  'sources:' [\n    'mac_util.mm',\n    'win_util.cc',\n  ],\n  'conditions': [\n    ['OS==\"mac\"', {'sources!': ['win_util.cc']}],\n    ['OS==\"win\"', {'sources!': ['mac_util.cc']}],\n  ],\n}\n```\n\n## Pattern Lists (/)\n\nPattern lists are similar to, but more powerful than, [exclusion\nlists](#Exclusion_Lists_(!)).  Each item in a pattern list is itself\na two-element list.  The first item is a string, either `'include'` or\n`'exclude'`, specifying the action to take.  The second item is a string\nspecifying a regular expression.  Any item in the base list matching the\nregular expression pattern will either be included or excluded, based on\nthe action specified.\n\nItems in a pattern list are processed in sequence, and an excluded item\nthat is later included will not be removed from the list (unless it is\nsubsequently excluded again.)\n\nPattern lists are processed after [exclusion\nlists](#Exclusion_Lists_(!)), so it is possible for a pattern list to\nre-include items previously excluded by an exclusion list.\n\nNothing is actually removed from a base list until all items in an\n[exclusion list](#Exclusion_Lists_(!)) and pattern list have been\nevaluated.  This allows items to retain their correct position relative\nto one another even after being excluded and subsequently included.\n\n#### Example\n\nIn this example, a uniform naming scheme is adopted for\nplatform-specific files.\n\n```\n{\n  'sources': [\n    'io_posix.cc',\n    'io_win.cc',\n    'launcher_mac.cc',\n    'main.cc',\n    'platform_util_linux.cc',\n    'platform_util_mac.mm',\n  ],\n  'sources/': [\n    ['exclude', '_win\\\\.cc$'],\n  ],\n  'conditions': [\n    ['OS!=\"linux\"', {'sources/': [['exclude', '_linux\\\\.cc$']]}],\n    ['OS!=\"mac\"', {'sources/': [['exclude', '_mac\\\\.cc|mm?$']]}],\n    ['OS==\"win\"', {'sources/': [\n      ['include', '_win\\\\.cc$'],\n      ['exclude', '_posix\\\\.cc$'],\n    ]}],\n  ],\n}\n```\n\nAfter the pattern list is applied, `sources` will have the following\nvalues, depending on the setting of `OS`:\n\n  * When `OS` is `linux`: `['io_posix.cc', 'main.cc',\n    'platform_util_linux.cc']`\n  * When `OS` is `mac`: `['io_posix.cc', 'launcher_mac.cc', 'main.cc',\n    'platform_util_mac.mm']`\n  * When `OS` is `win`: `['io_win.cc', 'main.cc',\n    'platform_util_win.cc']`\n\nNote that when `OS` is `win`, the `include` for `_win.cc` files is\nprocessed after the `exclude` matching the same pattern, because the\n`sources/` list participates in [merging](#Merging) during\n[conditional evaluation](#Conditonals) just like any other list\nwould.  This guarantees that the `_win.cc` files, previously\nunconditionally excluded, will be re-included when `OS` is `win`.\n\n## Locating Excluded Items\n\nIn some cases, a GYP generator needs to access to items that were\nexcluded by an [exclusion list](#Exclusion_Lists_(!)) or [pattern\nlist](#Pattern_Lists_(/)).  When GYP excludes items during processing\nof either of these list types, it places the results in an `_excluded`\nlist.  In the example above, when `OS` is `mac`, `sources_excluded`\nwould be set to `['io_win.cc', 'platform_util_linux.cc']`.  Some GYP\ngenerators use this feature to display excluded files in the project\nfiles they generate for the convenience of users, who may wish to refer\nto other implementations.\n\n## Processing Order\n\nGYP uses a defined and predictable order to execute the various steps\nperformed between loading files and generating output.\n\n  * Load files.\n    * Load `.gyp` files.  Merge any [command-line\n      includes](#Including_Other_Files) into each `.gyp` file’s root\n      dictionary.  As [includes](#Including_Other_Files) are found,\n      load them as well and [merge](#Merging) them into the scope in\n      which the [includes](#includes) section was found.\n    * Perform [“early” or “pre”](#Early_and_Late_Phases) [variable\n      expansion and conditional\n      evaluation](#Variables_and_Conditionals).\n    * [Merge](#Merging) each [target’s](#targets) dictionary into\n      the `.gyp` file’s root [target\\_defaults](#target_defaults)\n      dictionary.\n    * Scan each [target](#targets) for\n      [dependencies](#dependencies), and repeat the above steps for\n      any newly-referenced `.gyp` files not yet loaded.\n  * Scan each [target](#targets) for wildcard\n    [dependencies](#dependencies), expanding the wildcards.\n  * Process [dependent settings](#Dependent_Settings).  These\n    sections are processed, in order:\n    * [all\\_dependent\\_settings](#all_dependent_settings)\n    * [direct\\_dependent\\_settings](#direct_dependent_settings)\n    * [link\\_dependent\\_settings](#link_dependent_settings)\n  * Perform [static library dependency\n    adjustment](#Linking_Dependencies).\n  * Perform [“late,” “post,” or “target”](#Early_and_Late_Phases)\n    [variable expansion and conditional\n    evaluation](#Variables_and_Conditionals) on [target](#targets)\n    dictionaries.\n  * Merge [target](#targets) settings into\n    [configurations](#configurations) as appropriate.\n  * Process [exclusion and pattern\n    lists](#List_Exclusions_and_Patterns).\n\n## Settings Keys\n\n### Settings that may appear anywhere\n\n#### conditions\n\n_List of `condition` items_\n\nA `conditions` section introduces a subdictionary that is only merged\ninto the enclosing scope based on the evaluation of a conditional\nexpression.  Each `condition` within a `conditions` list is itself a\nlist of at least two items:\n\n  1. A string containing the conditional expression itself.  Conditional\n  expressions may take the following forms:\n    * For string values, `var==\"value\"` and `var!=\"value\"` to test\n      equality and inequality.  For example, `'OS==\"linux\"'` is true\n      when the `OS` variable is set to `\"linux\"`.\n    * For integer values, `var==value`, `var!=value`, `var<value`,\n      `var<=value`, `var>=value`, and `var>value`, to test equality and\n      several common forms of inequality.  For example,\n      `'chromium_code==0'` is true when the `chromium_code` variable is\n      set to `0`.\n    * It is an error for a conditional expression to reference any\n      undefined variable.\n  1. A dictionary containing the subdictionary to be merged into the\n  enclosing scope if the conditional expression evaluates to true.\n\nThese two items can be followed by any number of similar two items that\nwill be evaluated if the previous conditional expression does not\nevaluate to true.\n\nAn additional optional dictionary can be appended to this sequence of\ntwo items.  This optional dictionary will be merged into the enclosing\nscope if none of the conditional expressions evaluate to true.\n\nWithin a `conditions` section, each item is processed sequentially, so\nit is possible to predict the order in which operations will occur.\n\nThere is no restriction on nesting `conditions` sections.\n\n`conditions` sections are very similar to `target_conditions` sections.\nSee target\\_conditions.\n\n#### Example\n\n```\n{\n  'sources': [\n    'common.cc',\n  ],\n  'conditions': [\n    ['OS==\"mac\"', {'sources': ['mac_util.mm']}],\n    ['OS==\"win\"', {'sources': ['win_main.cc']}, {'sources': ['posix_main.cc']}],\n    ['OS==\"mac\"', {'sources': ['mac_impl.mm']},\n     'OS==\"win\"', {'sources': ['win_impl.cc']},\n     {'sources': ['default_impl.cc']}\n    ],\n  ],\n}\n```\n\nGiven this input, the `sources` list will take on different values based\non the `OS` variable.\n\n  * If `OS` is `\"mac\"`, `sources` will contain `['common.cc',\n    'mac_util.mm', 'posix_main.cc', 'mac_impl.mm']`.\n  * If `OS` is `\"win\"`, `sources` will contain `['common.cc',\n    'win_main.cc', 'win_impl.cc']`.\n  * If `OS` is any other value such as `\"linux\"`, `sources` will contain\n    `['common.cc', 'posix_main.cc', 'default_impl.cc']`.\n"
  },
  {
    "path": "gyp/docs/LanguageSpecification.md",
    "content": "# Language Specification\n\n## Objective\n\nCreate a tool for the Chromium project that generates native Visual Studio,\nXcode and SCons and/or make build files from a platform-independent input\nformat.  Make the input format as reasonably general as possible without\nspending extra time trying to \"get everything right,\" except where not doing so\nwould likely lead Chromium to an eventual dead end.  When in doubt, do what\nChromium needs and don't worry about generalizing the solution.\n\n## Background\n\nNumerous other projects, both inside and outside Google, have tried to\ncreate a simple, universal cross-platform build representation that\nstill allows sufficient per-platform flexibility to accommodate\nirreconcilable differences.  The fact that no obvious working candidate\nexists that meets Chromium's requirements indicates this is probably a\ntougher problem than it appears at first glance.  We aim to succeed by\ncreating a tool that is highly specific to Chromium's specific use case,\nnot to the general case of design a completely platform-independent tool\nfor expressing any possible build.\n\nThe Mac has the most sophisticated model for application development\nthrough an IDE.  Consequently, we will use the Xcode model as the\nstarting point (the input file format must handle Chromium's use of\nXcode seamlessly) and adapt the design as necessary for the other\nplatforms.\n\n## Overview\n\nThe overall design has the following characteristics:\n\n  * Input configurations are specified in files with the suffix `.gyp`.\n  * Each `.gyp` file specifies how to build the targets for the\n    \"component\" defined by that file.\n  * Each `.gyp` file generates one or more output files appropriate to\n    the platform:\n    * On Mac, a `.gyp` file generates one Xcode .xcodeproj bundle with\n      information about how its targets are built.\n    * On Windows, a `.gyp` file generates one Visual Studio .sln file,\n      and one Visual Studio .vcproj file per target.\n    * On Linux, a `.gyp` file generates one SCons file and/or one\n      Makefile per target\n  * The `.gyp` file syntax is a Python data structure.\n  * Use of arbitrary Python in `.gyp` files is forbidden.\n    * Use of eval() with restricted globals and locals on `.gyp` file\n      contents restricts the input to an evaluated expression, not\n      arbitrary Python statements.\n    * All input is expected to comply with JSON, with two exceptions:\n      the # character (not inside strings) begins a comment that lasts\n      until the end of the line, and trailing commas are permitted at\n      the end of list and dict contents.\n  * Input data is a dictionary of keywords and values.\n  * \"Invalid\" keywords on any given data structure are not illegal,\n    they're just ignored.\n    * TODO:  providing warnings on use of illegal keywords would help\n      users catch typos.  Figure out something nice to do with this.\n\n## Detailed Design\n\nSome up-front design principles/thoughts/TODOs:\n\n  * Re-use keywords consistently.\n  * Keywords that allow configuration of a platform-specific concept get\n    prefixed appropriately:\n    * Examples:  `msvs_disabled_warnings`, `xcode_framework_dirs`\n  * The input syntax is declarative and data-driven.\n    * This gets enforced by using Python `eval()` (which only evaluates\n      an expression) instead of `exec` (which executes arbitrary python)\n  * Semantic meanings of specific keyword values get deferred until all\n    are read and the configuration is being evaluated to spit out the\n    appropriate file(s)\n  * Source file lists:\n    * Are flat lists.  Any imposed ordering within the `.gyp` file (e.g.\n      alphabetically) is purely by convention and for developer\n      convenience.  When source files are linked or archived together,\n      it is expected that this will occur in the order that files are\n      listed in the `.gyp` file.\n    * Source file lists contain no mechanism for by-hand folder\n      configuration (`Filter` tags in Visual Studio, `Groups` in Xcode)\n    * A folder hierarchy is created automatically that mirrors the file\n      system\n\n### Example\n\n```\n{\n  'target_defaults': {\n    'defines': [\n      'U_STATIC_IMPLEMENTATION',\n      ['LOGFILE', 'foo.log',],\n    ],\n    'include_dirs': [\n      '..',\n    ],\n  },\n  'targets': [\n    {\n      'target_name': 'foo',\n      'type': 'static_library',\n      'sources': [\n        'foo/src/foo.cc',\n        'foo/src/foo_main.cc',\n      ],\n      'include_dirs': [\n         'foo',\n         'foo/include',\n      ],\n      'conditions': [\n         [ 'OS==mac', { 'sources': [ 'platform_test_mac.mm' ] } ]\n      ],\n      'direct_dependent_settings': {\n        'defines': [\n          'UNIT_TEST',\n        ],\n        'include_dirs': [\n          'foo',\n          'foo/include',\n        ],\n      },\n    },\n  ],\n}\n```\n\n### Structural Elements\n\n### Top-level Dictionary\n\nThis is the single dictionary in the `.gyp` file that defines the\ntargets and how they're to be built.\n\nThe following keywords are meaningful within the top-level dictionary\ndefinition:\n\n| *Keyword*         | *Description*     |\n|:------------------|:------------------|\n| `conditions`      | A conditional section that may contain other items that can be present in a top-level dictionary, on a conditional basis.  See the \"Conditionals\" section below. |\n| `includes`        | A list of `.gypi` files to be included in the top-level dictionary. |\n| `target_defaults` | A dictionary of default settings to be inherited by all targets in the top-level dictionary.  See the \"Settings keywords\" section below. |\n| `targets`         | A list of target specifications.  See the \"targets\" below. |\n| `variables`       | A dictionary containing variable definitions.  Each key in this dictionary is the name of a variable, and each value must be a string value that the variable is to be set to. |\n\n### targets\n\nA list of dictionaries defining targets to be built by the files\ngenerated from this `.gyp` file.\n\nTargets may contain `includes`, `conditions`, and `variables` sections\nas permitted in the root dictionary. The following additional keywords\nhave structural meaning for target definitions:\n\n| *Keyword*         | *Description*     |\n|:---------------------------- |:------------------------------------------|\n| `actions`                    | A list of special custom actions to perform on a specific input file, or files, to produce output files.  See the \"Actions\" section below. |\n| `all_dependent_settings`     | A dictionary of settings to be applied to all dependents of the target, transitively.  This includes direct dependents and the entire set of their dependents, and so on.  This section may contain anything found within a `target` dictionary, except `configurations`, `target_name`, and `type` sections.  Compare `direct_dependent_settings` and `link_settings`. |\n| `configurations`             | A list of dictionaries defining build configurations for the target.  See the \"Configurations\" section below.  |\n| `copies`                     | A list of copy actions to perform. See the \"Copies\" section below. |\n| `defines`                    | A list of preprocessor definitions to be passed on the command line to the C/C++ compiler (via `-D` or `/D` options). |\n| `dependencies`               | A list of targets on which this target depends.  Targets in other `.gyp` files are specified as `../path/to/other.gyp:target_we_want`. |\n| `direct_dependent_settings`  | A dictionary of settings to be applied to other targets that depend on this target.  These settings will only be applied to direct dependents.  This section may contain anything found within a `target` dictionary, except `configurations`, `target_name`, and `type` sections.  Compare with `all_dependent_settings` and `link_settings`. |\n| `include_dirs`               | A list of include directories to be passed on the command line to the C/C++ compiler (via `-I` or `/I` options). |\n| `libraries`                  | A list of list of libraries (and/or frameworks) on which this target depends. |\n| `link_settings`              | A dictionary of settings to be applied to targets in which this target's contents are linked.  `executable` and `shared_library` targets are linkable, so if they depend on a non-linkable target such as a `static_library`, they will adopt its `link_settings`.  This section can contain anything found within a `target` dictionary, except `configurations`, `target_name`, and `type` sections.  Compare `all_dependent_settings` and `direct_dependent_settings`. |\n| `rules`                      | A special custom action to perform on a list of input files, to produce output files.  See the \"Rules\" section below. |\n| `sources`                    | A list of source files that are used to build this target or which should otherwise show up in the IDE for this target.  In practice, we expect this list to be a union of all files necessary to build the target on all platforms, as well as other related files that aren't actually used for building, like README files. |\n| `target_conditions`          | Like `conditions`, but evaluation is delayed until the settings have been merged into an actual target.  `target_conditions` may be used to place conditionals into a `target_defaults` section but have them still depend on specific target settings. |\n| `target_name`                | The name of a target being defined. |\n| `type`                       | The type of target being defined. This field currently supports `executable`, `static_library`, `shared_library`, and `none`.  The `none` target type is useful when producing output which is not linked. For example, converting raw translation files into resources or documentation into platform specific help files. |\n| `msvs_props`                 | A list of Visual Studio property sheets (`.vsprops` files) to be used to build the target. |\n| `xcode_config_file`          | An Xcode configuration (`.xcconfig` file) to be used to build the target. |\n| `xcode_framework_dirs`       | A list of framework directories be used to build the target. |\n\nYou can affect the way that lists/dictionaries are merged together (for\nexample the way a list in target\\_defaults interacts with the same named\nlist in the target itself) with a couple of special characters, which\nare covered in [Merge\nBasics](InputFormatReference#Merge_Basics_(=,_?,_+).md) and [List\nFilters](InputFormatReference#List_Filters.md) on the\nInputFormatReference page.\n\n### configurations\n\n`configurations` sections may be found within `targets` or\n`target_defaults` sections.  The `configurations` section is a list of\ndictionaries specifying different build configurations.  Because\nconfigurations are implemented as lists, it is not currently possible to\noverride aspects of configurations that are imported into a target from\na `target_defaults` section.\n\nNOTE: It is extremely important that each target within a project define\nthe same set of configurations.  This continues to apply even when a\nproject spans across multiple `.gyp` files.\n\nA configuration dictionary may contain anything that can be found within\na target dictionary, except for `actions`, `all_dependent_settings`,\n`configurations`, `dependencies`, `direct_dependent_settings`,\n`libraries`, `link_settings`, `sources`, `target_name`, and `type`.\n\nConfiguration dictionaries may also contain these elements:\n\n| *Keyword*            | *Description*                                       |\n|:---------------------|:----------------------------------------------------|\n| `configuration_name` | Required attribute.  The name of the configuration. |\n\n### Conditionals\n\nConditionals may appear within any dictionary in a `.gyp` file.  There\nare two tpes of conditionals, which differ only in the timing of their\nprocessing.  `conditions` sections are processed shortly after loading\n`.gyp` files, and `target_conditions` sections are processed after all\ndependencies have been computed.\n\nA conditional section is introduced with a `conditions` or\n`target_conditions` dictionary keyword, and is composed of a list.  Each\nlist contains two or three elements.  The first two elements, which are\nalways required, are the conditional expression to evaluate and a\ndictionary containing settings to merge into the dictionary containing\nthe `conditions` or `target_conditions` section if the expression\nevaluates to true.  The third, optional, list element is a dictionary to\nmerge if the expression evaluates to false.\n\nThe `eval()` of the expression string takes place in the context of\nglobal and/or local dictionaries that constructed from the `.gyp` input\ndata, and overrides the `__builtin__` dictionary, to prevent the\nexecution of arbitrary Python code.\n\n### Actions\n\nAn `actions` section provides a list of custom build actions to perform\non inputs, producing outputs.  The `actions` section is organized as a\nlist.  Each item in the list is a dictionary having the following form:\n\n| *Keyword*     | *Type* | *Description*                |\n|:--------------|:-------|:-----------------------------|\n| `action_name` | string | The name of the action.  Depending on how actions are implemented in the various generators, some may desire or require this property to be set to a unique name; others may ignore this property entirely. |\n| `inputs`      | list   | A list of pathnames treated as inputs to the custom action. |\n| `outputs`     | list   | A list of pathnames that the custom action produces. |\n| `action`      | list   | A command line invocation used to produce `outputs` from `inputs`.  For maximum cross-platform compatibility, invocations that require a Python interpreter should be specified with a first element `\"python\"`.  This will enable generators for environments with specialized Python installations to be able to perform the action in an appropriate Python environment. |\n| `message`     | string | A message to be displayed to the user by the build system when the action is run. |\n\nBuild environments will compare `inputs` and `outputs`.  If any `output`\nis missing or is outdated relative to any `input`, the custom action\nwill be invoked.  If all `outputs` are present and newer than all\n`inputs`, the `outputs` are considered up-to-date and the action need\nnot be invoked.\n\nActions are implemented in Xcode as shell script build phases performed\nprior to the compilation phase.  In the Visual Studio generator, actions\nappear files with a `FileConfiguration` containing a custom\n`VCCustomBuildTool` specifying the remainder of the inputs, the outputs,\nand the action.\n\nCombined with variable expansions, actions can be quite powerful.  Here\nis an example action that leverages variable expansions to minimize\nduplication of pathnames:\n\n```\n      'sources': [\n        # libraries.cc is generated by the js2c action below.\n        '<(INTERMEDIATE_DIR)/libraries.cc',\n      ],\n      'actions': [\n        {\n          'variables': {\n            'core_library_files': [\n              'src/runtime.js',\n              'src/v8natives.js',\n              'src/macros.py',\n            ],\n          },\n          'action_name': 'js2c',\n          'inputs': [\n            'tools/js2c.py',\n            '<@(core_library_files)',\n          ],\n          'outputs': [\n            '<(INTERMEDIATE_DIR)/libraries.cc',\n            '<(INTERMEDIATE_DIR)/libraries-empty.cc',\n          ],\n          'action': ['python', 'tools/js2c.py', '<@(_outputs)', 'CORE', '<@(core_library_files)'],\n        },\n      ],\n```\n\n### Rules\n\nA `rules` section provides custom build action to perform on inputs, producing\noutputs.  The `rules` section is organized as a list.  Each item in the list is\na dictionary having the following form:\n\n| *Keyword*   | *Type* | *Description*                            |\n|:------------|:-------|:-----------------------------------------|\n| `rule_name` | string | The name of the rule.  Depending on how Rules are implemented in the various generators, some may desire or require this property to be set to a unique name; others may ignore this property entirely. |\n| `extension` | string | All source files of the current target with the given extension will be treated successively as inputs to the rule. |\n| `inputs`    | list   | Additional dependencies of the rule. |\n| `outputs`   | list   | A list of pathnames that the rule produces. Has access to `RULE_INPUT_` variables (see below). |\n| `action`    | list   | A command line invocation used to produce `outputs` from `inputs`.  For maximum cross-platform compatibility, invocations that require a Python interpreter should be specified with a first element `\"python\"`.  This will enable generators for environments with specialized Python installations to be able to perform the action in an appropriate Python environment. Has access to `RULE_INPUT_` variables (see below). |\n| `message`   | string | A message to be displayed to the user by the build system when the action is run. Has access to `RULE_INPUT_` variables (see below). |\n\nThere are several variables available to `outputs`, `action`, and `message`.\n\n|  *Variable*          | *Description*                       |\n|:---------------------|:------------------------------------|\n| `RULE_INPUT_PATH`    | The full path to the current input. |\n| `RULE_INPUT_DIRNAME` | The directory of the current input. |\n| `RULE_INPUT_NAME`    | The file name of the current input. |\n| `RULE_INPUT_ROOT`    | The file name of the current input without extension. |\n| `RULE_INPUT_EXT`     | The file name extension of the current input. |\n\nRules can be thought of as Action generators. For each source selected\nby `extension` an special action is created. This action starts out with\nthe same `inputs`, `outputs`, `action`, and `message` as the rule. The\nsource is added to the action's `inputs`. The `outputs`, `action`, and\n`message` are then handled the same but with the additional variables.\nIf the `_output` variable is used in the `action` or `message` the\n`RULE_INPUT_` variables in `output` will be expanded for the current\nsource.\n\n### Copies\n\nA `copies` section provides a simple means of copying files.  The\n`copies` section is organized as a list.  Each item in the list is a\ndictionary having the following form:\n\n| *Keyword*     | *Type* | *Description*                 |\n|:--------------|:-------|:------------------------------|\n| `destination` | string | The directory into which the `files` will be copied. |\n| `files`       | list   | A list of files to be copied. |\n\nThe copies will be created in `destination` and have the same file name\nas the file they are copied from. Even if the `files` are from multiple\ndirectories they will all be copied into the `destination` directory.\nEach `destination` file has an implicit build dependency on the file it\nis copied from.\n\n### Generated Xcode .pbxproj Files\n\nWe derive the following things in a `project.pbxproj` plist file within\nan `.xcodeproj` bundle from the above input file formats as follows:\n\n  * `Group hierarchy`: This is generated in a fixed format with contents\n    derived from the input files. There is no provision for the user to\n    specify additional groups or create a custom hierarchy.\n    * `Configuration group`: This will be used with the\n      `xcode_config_file` property above, if needed.\n    * `Source group`: The union of the `sources` lists of all `targets`\n      after applying appropriate `conditions`.  The resulting list is\n      sorted and put into a group hierarchy that matches the layout of\n      the directory tree on disk, with a root of // (the top of the\n      hierarchy).\n    * `Frameworks group`: Taken directly from `libraries` value for the\n      target, after applying appropriate conditions.\n    * `Projects group`: References to other `.xcodeproj` bundles that\n      are needed by the `.xcodeproj` in which the group is contained.\n    * `Products group`: Output from the various targets.\n  * `Project References`:\n  * `Project Configurations`:\n    * Per-`.xcodeproj` file settings are not supported, all settings are\n      applied at the target level.\n  * `Targets`:\n    * `Phases`: Copy sources, link with libraries/frameworks, ...\n    * `Target Configurations`: Specified by input.\n    * `Dependencies`: (local and remote)\n\n### Generated Visual Studio .vcproj Files\n\nWe derive the following sections in a `.vcproj` file from the above\ninput file formats as follows:\n\n  * `VisualStudioProject`:\n    * `Platforms`:\n    * `ToolFiles`:\n    * `Configurations`:\n      * `Configuration`:\n    * `References`:\n    * `Files`:\n      * `Filter`:\n      * `File`:\n        * `FileConfiguration`:\n          * `Tool`:\n    * `Globals`:\n\n### Generated Visual Studio .sln Files\n\nWe derive the following sections in a `.sln` file from the above input\nfile formats as follows:\n\n  * `Projects`:\n    * `WebsiteProperties`:\n    * `ProjectDependencies`:\n  * `Global`:\n    * `SolutionConfigurationPlatforms`:\n    * `ProjectConfigurationPlatforms`:\n    * `SolutionProperties`:\n    * `NestedProjects`:\n\n## Caveats\n\nNotes/Question from very first prototype draft of the language.\nMake sure these issues are addressed somewhere before deleting.\n\n  * Libraries are easy, application abstraction is harder\n    * Applications involves resource compilation\n    * Applications involve many inputs\n    * Applications include transitive closure of dependencies\n  * Specific use cases like cc\\_library\n    * Mac compiles more than just .c/.cpp files (specifically, .m and .mm\n      files)\n    * Compiler options vary by:\n      * File type\n      * Target type\n      * Individual file\n    * Files may have custom settings per file per platform, but we probably\n      don't care or need to support this in gyp.\n  * Will all linked non-Chromium projects always use the same versions of every\n    subsystem?\n  * Variants are difficult.  We've identified the following variants (some\n    specific to Chromium, some typical of other projects in the same ballpark):\n    * Target platform\n    * V8 vs. JSC\n    * Debug vs. Release\n    * Toolchain (VS version, gcc, version)\n    * Host platform\n    * L10N\n    * Vendor\n    * Purify / Valgrind\n  * Will everyone upgrade VS at once?\n  * What does a dylib dependency mean?\n"
  },
  {
    "path": "gyp/docs/README.md",
    "content": "# Generate Your Projects (gyp-next)\n\nGYP is a Meta-Build system: a build system that generates other build systems.\n\n* [User documentation](./UserDocumentation.md)\n* [Input Format Reference](./InputFormatReference.md)\n* [Language specification](./LanguageSpecification.md)\n* [Hacking](./Hacking.md)\n* [Testing](./Testing.md)\n* [GYP vs. CMake](./GypVsCMake.md)\n\nGYP is intended to support large projects that need to be built on multiple\nplatforms (e.g., Mac, Windows, Linux), and where it is important that\nthe project can be built using the IDEs that are popular on each platform\nas if the project is a \"native\" one.\n\nIt can be used to generate XCode projects, Visual Studio projects, Ninja\nbuild files, and Makefiles. In each case GYP's goal is to replicate as\nclosely as possible the way one would set up a native build of the project\nusing the IDE.\n\nGYP can also be used to generate \"hybrid\" projects that provide the IDE\nscaffolding for a nice user experience but call out to Ninja to do the actual\nbuilding (which is usually much faster than the native build systems of the\nIDEs).\n\nFor more information on GYP, click on the links above.\n"
  },
  {
    "path": "gyp/docs/Testing.md",
    "content": "# Testing\n\nNOTE: this document is outdated and needs to be updated. Read with your own discretion.\n\n## Introduction\n\nThis document describes the GYP testing infrastructure,\nas provided by the `TestGyp.py` module.\n\nThese tests emphasize testing the _behavior_ of the\nvarious GYP-generated build configurations:\nVisual Studio, Xcode, SCons, Make, etc.\nThe goal is _not_ to test the output of the GYP generators by,\nfor example, comparing a GYP-generated Makefile\nagainst a set of known \"golden\" Makefiles\n(although the testing infrastructure could\nbe used to write those kinds of tests).\nThe idea is that the generated build configuration files\ncould be completely written to add a feature or fix a bug\nso long as they continue to support the functional behaviors\ndefined by the tests:  building programs, shared libraries, etc.\n\n## \"Hello, world!\" GYP test configuration\n\nHere is an actual test configuration,\na simple build of a C program to print `\"Hello, world!\"`.\n\n```\n  $ ls -l test/hello\n  total 20\n  -rw-r--r-- 1 knight knight 312 Jul 30 20:22 gyptest-all.py\n  -rw-r--r-- 1 knight knight 307 Jul 30 20:22 gyptest-default.py\n  -rwxr-xr-x 1 knight knight 326 Jul 30 20:22 gyptest-target.py\n  -rw-r--r-- 1 knight knight  98 Jul 30 20:22 hello.c\n  -rw-r--r-- 1 knight knight 142 Jul 30 20:22 hello.gyp\n  $\n```\n\nThe `gyptest-*.py` files are three separate tests (test scripts)\nthat use this configuration.  The first one, `gyptest-all.py`,\nlooks like this:\n\n```\n  #!/usr/bin/env python\n\n  \"\"\"\n  Verifies simplest-possible build of a \"Hello, world!\" program\n  using an explicit build target of 'all'.\n  \"\"\"\n\n  import TestGyp\n\n  test = TestGyp.TestGyp()\n\n  test.run_gyp('hello.gyp')\n\n  test.build_all('hello.gyp')\n\n  test.run_built_executable('hello', stdout=\"Hello, world!\\n\")\n\n  test.pass_test()\n```\n\nThe test script above runs GYP against the specified input file\n(`hello.gyp`) to generate a build configuration.\nIt then tries to build the `'all'` target\n(or its equivalent) using the generated build configuration.\nLast, it verifies that the build worked as expected\nby running the executable program (`hello`)\nthat was just presumably built by the generated configuration,\nand verifies that the output from the program\nmatches the expected `stdout` string (`\"Hello, world!\\n\"`).\n\nWhich configuration is generated\n(i.e., which build tool to test)\nis specified when the test is run;\nsee the next section.\n\nSurrounding the functional parts of the test\ndescribed above are the header,\nwhich should be basically the same for each test\n(modulo a different description in the docstring):\n\n```\n  #!/usr/bin/env python\n\n  \"\"\"\n  Verifies simplest-possible build of a \"Hello, world!\" program\n  using an explicit build target of 'all'.\n  \"\"\"\n\n  import TestGyp\n\n  test = TestGyp.TestGyp()\n```\n\nSimilarly, the footer should be the same in every test:\n\n```\n  test.pass_test()\n```\n\n## Running tests\n\nTest scripts are run by the `gyptest.py` script.\nYou can specify (an) explicit test script(s) to run:\n\n```\n  $ python gyptest.py test/hello/gyptest-all.py\n  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib\n  TESTGYP_FORMAT=scons\n  /usr/bin/python test/hello/gyptest-all.py\n  PASSED\n  $\n```\n\nIf you specify a directory, all test scripts\n(scripts prefixed with `gyptest-`) underneath\nthe directory will be run:\n\n```\n  $ python gyptest.py test/hello\n  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib\n  TESTGYP_FORMAT=scons\n  /usr/bin/python test/hello/gyptest-all.py\n  PASSED\n  /usr/bin/python test/hello/gyptest-default.py\n  PASSED\n  /usr/bin/python test/hello/gyptest-target.py\n  PASSED\n  $\n```\n\nOr you can specify the `-a` option to run all scripts\nin the tree:\n\n```\n  $ python gyptest.py -a\n  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib\n  TESTGYP_FORMAT=scons\n  /usr/bin/python test/configurations/gyptest-configurations.py\n  PASSED\n  /usr/bin/python test/defines/gyptest-defines.py\n  PASSED\n      .\n      .\n      .\n      .\n  /usr/bin/python test/variables/gyptest-commands.py\n  PASSED\n  $\n```\n\nIf any tests fail during the run,\nthe `gyptest.py` script will report them in a\nsummary at the end.\n\n## Debugging tests\n\nTests that create intermediate output do so under the gyp/out/testworkarea\ndirectory. On test completion, intermediate output is cleaned up. To preserve\nthis output, set the environment variable PRESERVE=1. This can be handy to\ninspect intermediate data when debugging a test.\n\nYou can also set PRESERVE\\_PASS=1, PRESERVE\\_FAIL=1 or PRESERVE\\_NO\\_RESULT=1\nto preserve output for tests that fall into one of those categories.\n\n# Specifying the format (build tool) to use\n\nBy default, the `gyptest.py` script will generate configurations for\nthe \"primary\" supported build tool for the platform you're on:\nVisual Studio on Windows,\nXcode on Mac,\nand (currently) SCons on Linux.\nAn alternate format (build tool) may be specified\nusing the `-f` option:\n\n```\n  $ python gyptest.py -f make test/hello/gyptest-all.py\n  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib\n  TESTGYP_FORMAT=make\n  /usr/bin/python test/hello/gyptest-all.py\n  PASSED\n  $\n```\n\nMultiple tools may be specified in a single pass as\na comma-separated list:\n\n```\n  $ python gyptest.py -f make,scons test/hello/gyptest-all.py\n  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib\n  TESTGYP_FORMAT=make\n  /usr/bin/python test/hello/gyptest-all.py\n  PASSED\n  TESTGYP_FORMAT=scons\n  /usr/bin/python test/hello/gyptest-all.py\n  PASSED\n  $\n```\n\n## Test script functions and methods\n\nThe `TestGyp` class contains a lot of functionality\nintended to make it easy to write tests.\nThis section describes the most useful pieces for GYP testing.\n\n(The `TestGyp` class is actually a subclass of more generic\n`TestCommon` and `TestCmd` base classes\nthat contain even more functionality than is\ndescribed here.)\n\n### Initialization\n\nThe standard initialization formula is:\n\n```\n  import TestGyp\n  test = TestGyp.TestGyp()\n```\n\nThis copies the contents of the directory tree in which\nthe test script lives to a temporary directory for execution,\nand arranges for the temporary directory's removal on exit.\n\nBy default, any comparisons of output or file contents\nmust be exact matches for the test to pass.\nIf you need to use regular expressions for matches,\na useful alternative initialization is:\n\n```\n  import TestGyp\n  test = TestGyp.TestGyp(match = TestGyp.match_re,\n                         diff = TestGyp.diff_re)`\n```\n\n### Running GYP\n\nThe canonical invocation is to simply specify the `.gyp` file to be executed:\n\n```\n  test.run_gyp('file.gyp')\n```\n\nAdditional GYP arguments may be specified:\n\n```\n  test.run_gyp('file.gyp', arguments=['arg1', 'arg2', ...])\n```\n\nTo execute GYP from a subdirectory (where, presumably, the specified file\nlives):\n\n```\n  test.run_gyp('file.gyp', chdir='subdir')\n```\n\n### Running the build tool\n\nRunning the build tool requires passing in a `.gyp` file, which may be used to\ncalculate the name of a specific build configuration file (such as a MSVS\nsolution file corresponding to the `.gyp` file).\n\nThere are several different `.build_*()` methods for invoking different types\nof builds.\n\nTo invoke a build tool with an explicit `all` target (or equivalent):\n\n```\n  test.build_all('file.gyp')\n```\n\nTo invoke a build tool with its default behavior (for example, executing `make`\nwith no targets specified):\n\n```\n  test.build_default('file.gyp')\n```\n\nTo invoke a build tool with an explicit specified target:\n\n```\n  test.build_target('file.gyp', 'target')\n```\n\n### Running executables\n\nThe most useful method executes a program built by the GYP-generated\nconfiguration:\n\n```\n  test.run_built_executable('program')\n```\n\nThe `.run_built_executable()` method will account for the actual built target\noutput location for the build tool being tested, as well as tack on any\nnecessary executable file suffix for the platform (for example `.exe` on\nWindows).\n\n`stdout=` and `stderr=` keyword arguments specify expected standard output and\nerror output, respectively.  Failure to match these (if specified) will cause\nthe test to fail.  An explicit `None` value will suppress that verification:\n\n```\n  test.run_built_executable('program',\n                            stdout=\"expect this output\\n\",\n\t\t\t\t\t\t\tstderr=None)\n```\n\nNote that the default values are `stdout=None` and `stderr=''` (that is, no\ncheck for standard output, and error output must be empty).\n\nArbitrary executables (not necessarily those built by GYP) can be executed with\nthe lower-level `.run()` method:\n\n```\n  test.run('program')\n```\n\nThe program must be in the local directory (that is, the temporary directory\nfor test execution) or be an absolute path name.\n\n### Fetching command output\n\n```\n  test.stdout()\n```\n\nReturns the standard output from the most recent executed command (including\n`.run_gyp()`, `.build_*()`, or `.run*()` methods).\n\n```\n  test.stderr()\n```\n\nReturns the error output from the most recent executed command (including\n`.run_gyp()`, `.build_*()`, or `.run*()` methods).\n\n### Verifying existence or non-existence of files or directories\n\n```\n  test.must_exist('file_or_dir')\n```\n\nVerifies that the specified file or directory exists, and fails the test if it\ndoesn't.\n\n```\n  test.must_not_exist('file_or_dir')\n```\n\nVerifies that the specified file or directory does not exist, and fails the\ntest if it does.\n\n### Verifying file contents\n\n```\n  test.must_match('file', 'expected content\\n')\n```\n\nVerifies that the content of the specified file match the expected string, and\nfails the test if it does not.  By default, the match must be exact, but\nline-by-line regular expressions may be used if the `TestGyp` object was\ninitialized with `TestGyp.match_re`.\n\n```\n  test.must_not_match('file', 'expected content\\n')\n```\n\nVerifies that the content of the specified file does _not_ match the expected\nstring, and fails the test if it does.  By default, the match must be exact,\nbut line-by-line regular expressions may be used if the `TestGyp` object was\ninitialized with `TestGyp.match_re`.\n\n```\n  test.must_contain('file', 'substring')\n```\n\nVerifies that the specified file contains the specified substring, and fails\nthe test if it does not.\n\n```\n  test.must_not_contain('file', 'substring')\n```\n\nVerifies that the specified file does not contain the specified substring, and\nfails the test if it does.\n\n```\n  test.must_contain_all_lines(output, lines)\n```\n\nVerifies that the output string contains all of the \"lines\" in the specified\nlist of lines.  In practice, the lines can be any substring and need not be\n`\\n`-terminated lines per se.  If any line is missing, the test fails.\n\n```\n  test.must_not_contain_any_lines(output, lines)\n```\n\nVerifies that the output string does _not_ contain any of the \"lines\" in the\nspecified list of lines.  In practice, the lines can be any substring and need\nnot be `\\n`-terminated lines per se.  If any line exists in the output string,\nthe test fails.\n\n```\n  test.must_contain_any_line(output, lines)\n```\n\nVerifies that the output string contains at least one of the \"lines\" in the\nspecified list of lines.  In practice, the lines can be any substring and need\nnot be `\\n`-terminated lines per se.  If none of the specified lines is present,\nthe test fails.\n\n### Reading file contents\n\n```\n  test.read('file')\n```\n\nReturns the contents of the specified file.  Directory elements contained in a\nlist will be joined:\n\n```\n  test.read(['subdir', 'file'])\n```\n\n### Test success or failure\n\n```\n  test.fail_test()\n```\n\nFails the test, reporting `FAILED` on standard output and exiting with an exit\nstatus of `1`.\n\n```\n  test.pass_test()\n```\n\nPasses the test, reporting `PASSED` on standard output and exiting with an exit\nstatus of `0`.\n\n```\n  test.no_result()\n```\n\nIndicates the test had no valid result (i.e., the conditions could not be\ntested because of an external factor like a full file system).  Reports `NO\nRESULT` on standard output and exits with a status of `2`.\n"
  },
  {
    "path": "gyp/docs/UserDocumentation.md",
    "content": "# User Documentation\n\n## Introduction\n\nThis document is intended to provide a user-level guide to GYP.  The\nemphasis here is on how to use GYP to accomplish specific tasks, not on\nthe complete technical language specification.  (For that, see the\n[LanguageSpecification](LanguageSpecification.md).)\n\nThe document below starts with some overviews to provide context: an\noverview of the structure of a `.gyp` file itself, an overview of a\ntypical executable-program target in a `.gyp` file, an an overview of a\ntypical library target in a `.gyp` file.\n\nAfter the overviews, there are examples of `gyp` patterns for different\ncommon use cases.\n\n## Skeleton of a typical Chromium .gyp file\n\nHere is the skeleton of a typical `.gyp` file in the Chromium tree:\n\n```\n  {\n    'variables': {\n      .\n      .\n      .\n    },\n    'includes': [\n      '../build/common.gypi',\n    ],\n    'target_defaults': {\n      .\n      .\n      .\n    },\n    'targets': [\n      {\n        'target_name': 'target_1',\n          .\n          .\n          .\n      },\n      {\n        'target_name': 'target_2',\n          .\n          .\n          .\n      },\n    ],\n    'conditions': [\n      ['OS==\"linux\"', {\n        'targets': [\n          {\n            'target_name': 'linux_target_3',\n              .\n              .\n              .\n          },\n        ],\n      }],\n      ['OS==\"win\"', {\n        'targets': [\n          {\n            'target_name': 'windows_target_4',\n              .\n              .\n              .\n          },\n        ],\n      }, { # OS != \"win\"\n        'targets': [\n          {\n            'target_name': 'non_windows_target_5',\n              .\n              .\n              .\n          },\n      }],\n    ],\n  }\n```\n\nThe entire file just contains a Python dictionary.  (It's actually JSON,\nwith two small Pythonic deviations: comments are introduced with `#`,\nand a `,` (comma)) is legal after the last element in a list or\ndictionary.)\n\nThe top-level pieces in the `.gyp` file are as follows:\n\n`'variables'`:  Definitions of variables that can be interpolated and\nused in various other parts of the file.\n\n`'includes'`:  A list of of other files that will be included in this\nfile.  By convention, included files have the suffix `.gypi` (gyp\ninclude).\n\n`'target_defaults'`:  Settings that will apply to _all_ of the targets\ndefined in this `.gyp` file.\n\n`'targets'`:  The list of targets for which this `.gyp` file can\ngenerate builds.  Each target is a dictionary that contains settings\ndescribing all the information necessary to build the target.\n\n`'conditions'`:  A list of condition specifications that can modify the\ncontents of the items in the global dictionary defined by this `.gyp`\nfile based on the values of different variables.  As implied by the\nabove example, the most common use of a `conditions` section in the\ntop-level dictionary is to add platform-specific targets to the\n`targets` list.\n\n## Skeleton of a typical executable target in a .gyp file\n\nThe most straightforward target is probably a simple executable program.\nHere is an example `executable` target that demonstrates the features\nthat should cover most simple uses of gyp:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'type': 'executable',\n        'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65',\n        'dependencies': [\n          'xyzzy',\n          '../bar/bar.gyp:bar',\n        ],\n        'defines': [\n          'DEFINE_FOO',\n          'DEFINE_A_VALUE=value',\n        ],\n        'include_dirs': [\n          '..',\n        ],\n        'sources': [\n          'file1.cc',\n          'file2.cc',\n        ],\n        'conditions': [\n          ['OS==\"linux\"', {\n            'defines': [\n              'LINUX_DEFINE',\n            ],\n            'include_dirs': [\n              'include/linux',\n            ],\n          }],\n          ['OS==\"win\"', {\n            'defines': [\n              'WINDOWS_SPECIFIC_DEFINE',\n            ],\n          }, { # OS != \"win\",\n            'defines': [\n              'NON_WINDOWS_DEFINE',\n            ],\n          }]\n        ],\n      },\n    ],\n  }\n```\n\nThe top-level settings in the target include:\n\n`'target_name'`: The name by which the target should be known, which\nshould be unique across all `.gyp` files.  This name will be used as the\nproject name in the generated Visual Studio solution, as the target name\nin the generated XCode configuration, and as the alias for building this\ntarget from the command line of the generated SCons configuration.\n\n`'type'`: Set to `executable`, logically enough.\n\n`'msvs_guid'`: THIS IS ONLY TRANSITIONAL.  This is a hard-coded GUID\nvalues that will be used in the generated Visual Studio solution\nfile(s).  This allows us to check in a `chrome.sln` file that\ninteroperates with gyp-generated project files.  Once everything in\nChromium is being generated by gyp, it will no longer be important that\nthe GUIDs stay constant across invocations, and we'll likely get rid of\nthese settings,\n\n`'dependencies'`: This lists other targets that this target depends on.\nThe gyp-generated files will guarantee that the other targets are built\nbefore this target.  Any library targets in the `dependencies` list will\nbe linked with this target.  The various settings (`defines`,\n`include_dirs`, etc.) listed in the `direct_dependent_settings` sections\nof the targets in this list will be applied to how _this_ target is\nbuilt and linked.  See the more complete discussion of\n`direct_dependent_settings`, below.\n\n`'defines'`: The C preprocessor definitions that will be passed in on\ncompilation command lines (using `-D` or `/D` options).\n\n`'include_dirs'`: The directories in which included header files live.\nThese will be passed in on compilation command lines (using `-I` or `/I`\noptions).\n\n`'sources'`: The source files for this target.\n\n`'conditions'`: A block of conditions that will be evaluated to update\nthe different settings in the target dictionary.\n\n## Skeleton of a typical library target in a .gyp file\n\nThe vast majority of targets are libraries.  Here is an example of a\nlibrary target including the additional features that should cover most\nneeds of libraries:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'type': '<(library)'\n        'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65',\n        'dependencies': [\n          'xyzzy',\n          '../bar/bar.gyp:bar',\n        ],\n        'defines': [\n          'DEFINE_FOO',\n          'DEFINE_A_VALUE=value',\n        ],\n        'include_dirs': [\n          '..',\n        ],\n        'direct_dependent_settings': {\n          'defines': [\n            'DEFINE_FOO',\n            'DEFINE_ADDITIONAL',\n          ],\n          'linkflags': [\n          ],\n        },\n        'export_dependent_settings': [\n          '../bar/bar.gyp:bar',\n        ],\n        'sources': [\n          'file1.cc',\n          'file2.cc',\n        ],\n        'conditions': [\n          ['OS==\"linux\"', {\n            'defines': [\n              'LINUX_DEFINE',\n            ],\n            'include_dirs': [\n              'include/linux',\n            ],\n          ],\n          ['OS==\"win\"', {\n            'defines': [\n              'WINDOWS_SPECIFIC_DEFINE',\n            ],\n          }, { # OS != \"win\",\n            'defines': [\n              'NON_WINDOWS_DEFINE',\n            ],\n          }]\n        ],\n    ],\n  }\n```\n\nThe possible entries in a library target are largely the same as those\nthat can be specified for an executable target (`defines`,\n`include_dirs`, etc.).  The differences include:\n\n`'type'`: This should almost always be set to '<(library)', which allows\nthe user to define at gyp time whether libraries are to be built static\nor shared.  (On Linux, at least, linking with shared libraries saves\nsignificant link time.) If it's necessary to pin down the type of\nlibrary to be built, the `type` can be set explicitly to\n`static_library` or `shared_library`.\n\n`'direct_dependent_settings'`: This defines the settings that will be\napplied to other targets that _directly depend_ on this target--that is,\nthat list _this_ target in their `'dependencies'` setting.  This is\nwhere you list the `defines`, `include_dirs`, `cflags` and `linkflags`\nthat other targets that compile or link against this target need to\nbuild consistently.\n\n`'export_dependent_settings'`: This lists the targets whose\n`direct_dependent_settings` should be \"passed on\" to other targets that\nuse (depend on) this target.  `TODO:  expand on this description.`\n\n## Use Cases\n\nThese use cases are intended to cover the most common actions performed\nby developers using GYP.\n\nNote that these examples are _not_ fully-functioning, self-contained\nexamples (or else they'd be way too long).  Each example mostly contains\njust the keywords and settings relevant to the example, with perhaps a\nfew extra keywords for context.  The intent is to try to show the\nspecific pieces you need to pay attention to when doing something.\n[NOTE:  if practical use shows that these examples are confusing without\nadditional context, please add what's necessary to clarify things.]\n\n### Add new source files\n\nThere are similar but slightly different patterns for adding a\nplatform-independent source file vs. adding a source file that only\nbuilds on some of the supported platforms.\n\n#### Add a source file that builds on all platforms\n\n**Simplest possible case**: You are adding a file(s) that builds on all\nplatforms.\n\nJust add the file(s) to the `sources` list of the appropriate dictionary\nin the `targets` list:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'my_target',\n        'type': 'executable',\n        'sources': [\n          '../other/file_1.cc',\n          'new_file.cc',\n          'subdir/file3.cc',\n        ],\n      },\n    ],\n  },\n```\n\nFile path names are relative to the directory in which the `.gyp` file lives.\n\nKeep the list sorted alphabetically (unless there's a really, really,\n_really_ good reason not to).\n\n#### Add a platform-specific source file\n\n##### Your platform-specific file is named `*_linux.{ext}`, `*_mac.{ext}`, `*_posix.{ext}` or `*_win.{ext}`\n\nThe simplest way to add a platform-specific source file, assuming you're\nadding a completely new file and get to name it, is to use one of the\nfollowing standard suffixes:\n\n  * `_linux`  (e.g. `foo_linux.cc`)\n  * `_mac`    (e.g. `foo_mac.cc`)\n  * `_posix`  (e.g. `foo_posix.cc`)\n  * `_win`    (e.g. `foo_win.cc`)\n\nSimply add the file to the `sources` list of the appropriate dict within\nthe `targets` list, like you would any other source file.\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'type': 'executable',\n        'sources': [\n          'independent.cc',\n          'specific_win.cc',\n        ],\n      },\n    ],\n  },\n```\n\nThe Chromium `.gyp` files all have appropriate `conditions` entries to\nfilter out the files that aren't appropriate for the current platform.\nIn the above example, the `specific_win.cc` file will be removed\nautomatically from the source-list on non-Windows builds.\n\n##### Your platform-specific file does not use an already-defined pattern\n\nIf your platform-specific file does not contain a\n`*_{linux,mac,posix,win}` substring (or some other pattern that's\nalready in the `conditions` for the target), and you can't change the\nfile name, there are two patterns that can be used.\n\n**Preferred**:  Add the file to the `sources` list of the appropriate\ndictionary within the `targets` list.  Add an appropriate `conditions`\nsection to exclude the specific files name:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'type': 'executable',\n        'sources': [\n          'linux_specific.cc',\n        ],\n        'conditions': [\n          ['OS != \"linux\"', {\n            'sources!': [\n              # Linux-only; exclude on other platforms.\n              'linux_specific.cc',\n            ]\n          }[,\n        ],\n      },\n    ],\n  },\n```\n\nDespite the duplicate listing, the above is generally preferred because\nthe `sources` list contains a useful global list of all sources on all\nplatforms with consistent sorting on all platforms.\n\n**Non-preferred**: In some situations, however, it might make sense to\nlist a platform-specific file only in a `conditions` section that\nspecifically _includes_ it in the `sources` list:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'type': 'executable',\n        'sources': [],\n        ['OS == \"linux\"', {\n          'sources': [\n            # Only add to sources list on Linux.\n            'linux_specific.cc',\n          ]\n        }],\n      },\n    ],\n  },\n```\n\nThe above two examples end up generating equivalent builds, with the\nsmall exception that the `sources` lists will list the files in\ndifferent orders.  (The first example defines explicitly where\n`linux_specific.cc` appears in the list--perhaps in in the\nmiddle--whereas the second example will always tack it on to the end of\nthe list.)\n\n**Including or excluding files using patterns**: There are more\ncomplicated ways to construct a `sources` list based on patterns.  See\n`TODO` below.\n\n### Add a new executable\n\nAn executable program is probably the most straightforward type of\ntarget, since all it typically needs is a list of source files, some\ncompiler/linker settings (probably varied by platform), and some library\ntargets on which it depends and which must be used in the final link.\n\n#### Add an executable that builds on all platforms\n\nAdd a dictionary defining the new executable target to the `targets`\nlist in the appropriate `.gyp` file.  Example:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'new_unit_tests',\n        'type': 'executable',\n        'defines': [\n          'FOO',\n        ],\n        'include_dirs': [\n          '..',\n        ],\n        'dependencies': [\n          'other_target_in_this_file',\n          'other_gyp2:target_in_other_gyp2',\n        ],\n        'sources': [\n          'new_additional_source.cc',\n          'new_unit_tests.cc',\n        ],\n      },\n    ],\n  }\n```\n\n#### Add a platform-specific executable\n\nAdd a dictionary defining the new executable target to the `targets`\nlist within an appropriate `conditions` block for the platform.  The\n`conditions` block should be a sibling to the top-level `targets` list:\n\n```\n  {\n    'targets': [\n    ],\n    'conditions': [\n      ['OS==\"win\"', {\n        'targets': [\n          {\n            'target_name': 'new_unit_tests',\n            'type': 'executable',\n            'defines': [\n              'FOO',\n            ],\n            'include_dirs': [\n              '..',\n            ],\n            'dependencies': [\n              'other_target_in_this_file',\n              'other_gyp2:target_in_other_gyp2',\n            ],\n            'sources': [\n              'new_additional_source.cc',\n              'new_unit_tests.cc',\n            ],\n          },\n        ],\n      }],\n    ],\n  }\n```\n\n### Add settings to a target\n\nThere are several different types of settings that can be defined for\nany given target.\n\n#### Add new preprocessor definitions (`-D` or `/D` flags)\n\nNew preprocessor definitions are added by the `defines` setting:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'existing_target',\n        'defines': [\n          'FOO',\n          'BAR=some_value',\n        ],\n      },\n    ],\n  },\n```\n\nThese may be specified directly in a target's settings, as in the above\nexample, or in a `conditions` section.\n\n#### Add a new include directory (`-I` or `/I` flags)\n\nNew include directories are added by the `include_dirs` setting:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'existing_target',\n        'include_dirs': [\n          '..',\n          'include',\n        ],\n      },\n    ],\n  },\n```\n\nThese may be specified directly in a target's settings, as in the above\nexample, or in a `conditions` section.\n\n#### Add new compiler flags\n\nSpecific compiler flags can be added with the `cflags` setting:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'existing_target',\n        'conditions': [\n          ['OS==\"win\"', {\n            'cflags': [\n              '/WX',\n            ],\n          }, { # OS != \"win\"\n            'cflags': [\n              '-Werror',\n            ],\n          }],\n        ],\n      },\n    ],\n  },\n```\n\nBecause these flags will be specific to the actual compiler involved,\nthey will almost always be only set within a `conditions` section.\n\n#### Add new linker flags\n\nSetting linker flags is OS-specific. On linux and most non-mac posix\nsystems, they can be added with the `ldflags` setting:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'existing_target',\n        'conditions': [\n          ['OS==\"linux\"', {\n            'ldflags': [\n              '-pthread',\n            ],\n          }],\n        ],\n      },\n    ],\n  },\n```\n\nBecause these flags will be specific to the actual linker involved,\nthey will almost always be only set within a `conditions` section.\n\nOn OS X, linker settings are set via `xcode_settings`, on Windows via\n`msvs_settings`.\n\n#### Exclude settings on a platform\n\nAny given settings keyword (`defines`, `include_dirs`, etc.) has a\ncorresponding form with a trailing `!` (exclamation point) to remove\nvalues from a setting.  One useful example of this is to remove the\nLinux `-Werror` flag from the global settings defined in\n`build/common.gypi`:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'third_party_target',\n        'conditions': [\n          ['OS==\"linux\"', {\n            'cflags!': [\n              '-Werror',\n            ],\n          }],\n        ],\n      },\n    ],\n  },\n```\n\n### Cross-compiling\n\nGYP has some (relatively limited) support for cross-compiling.\n\nIf the variable `GYP_CROSSCOMPILE` or one of the toolchain-related\nvariables (like `CC_host` or `CC_target`) is set, GYP will think that\nyou wish to do a cross-compile.\n\nWhen cross-compiling, each target can be part of a \"host\" build, a\n\"target\" build, or both. By default, the target is assumed to be (only)\npart of the \"target\" build. The 'toolsets' property can be set on a\ntarget to change the default.\n\nA target's dependencies are assumed to match the build type (so, if A\ndepends on B, by default that means that a target build of A depends on\na target build of B). You can explicitly depend on targets across\ntoolchains by specifying \"#host\" or \"#target\" in the dependencies list.\nIf GYP is not doing a cross-compile, the \"#host\" and \"#target\" will be\nstripped as needed, so nothing breaks.\n\n### Add a new library\n\nTODO:  write intro\n\n#### Add a library that builds on all platforms\n\nAdd the a dictionary defining the new library target to the `targets`\nlist in the appropriate `.gyp` file.  Example:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'new_library',\n        'type': '<(library)',\n        'defines': [\n          'FOO',\n          'BAR=some_value',\n        ],\n        'include_dirs': [\n          '..',\n        ],\n        'dependencies': [\n          'other_target_in_this_file',\n          'other_gyp2:target_in_other_gyp2',\n        ],\n        'direct_dependent_settings': {\n          'include_dirs': '.',\n        },\n        'export_dependent_settings': [\n          'other_target_in_this_file',\n        ],\n        'sources': [\n          'new_additional_source.cc',\n          'new_library.cc',\n        ],\n      },\n    ],\n  }\n```\n\nThe use of the `<(library)` variable above should be the default `type`\nsetting for most library targets, as it allows the developer to choose,\nat `gyp` time, whether to build with static or shared libraries.\n(Building with shared libraries saves a _lot_ of link time on Linux.)\n\nIt may be necessary to build a specific library as a fixed type.  Is so,\nthe `type` field can be hard-wired appropriately.  For a static library:\n\n```\n        'type': 'static_library',\n```\n\nFor a shared library:\n\n```\n        'type': 'shared_library',\n```\n\n#### Add a platform-specific library\n\nAdd a dictionary defining the new library target to the `targets` list\nwithin a `conditions` block that's a sibling to the top-level `targets`\nlist:\n\n```\n  {\n    'targets': [\n    ],\n    'conditions': [\n      ['OS==\"win\"', {\n        'targets': [\n          {\n            'target_name': 'new_library',\n            'type': '<(library)',\n            'defines': [\n              'FOO',\n              'BAR=some_value',\n            ],\n            'include_dirs': [\n              '..',\n            ],\n            'dependencies': [\n              'other_target_in_this_file',\n              'other_gyp2:target_in_other_gyp2',\n            ],\n            'direct_dependent_settings': {\n              'include_dirs': '.',\n            },\n            'export_dependent_settings': [\n              'other_target_in_this_file',\n            ],\n            'sources': [\n              'new_additional_source.cc',\n              'new_library.cc',\n            ],\n          },\n        ],\n      }],\n    ],\n  }\n```\n\n### Dependencies between targets\n\nGYP provides useful primitives for establishing dependencies between\ntargets, which need to be configured in the following situations.\n\n#### Linking with another library target\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'dependencies': [\n          'libbar',\n        ],\n      },\n      {\n        'target_name': 'libbar',\n        'type': '<(library)',\n        'sources': [\n        ],\n      },\n    ],\n  }\n```\n\nNote that if the library target is in a different `.gyp` file, you have\nto specify the path to other `.gyp` file, relative to this `.gyp` file's\ndirectory:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'dependencies': [\n          '../bar/bar.gyp:libbar',\n        ],\n      },\n    ],\n  }\n```\n\nAdding a library often involves updating multiple `.gyp` files, adding\nthe target to the appropriate `.gyp` file (possibly a newly-added `.gyp`\nfile), and updating targets in the other `.gyp` files that depend on\n(link with) the new library.\n\n#### Compiling with necessary flags for a library target dependency\n\nWe need to build a library (often a third-party library) with specific\npreprocessor definitions or command-line flags, and need to ensure that\ntargets that depend on the library build with the same settings.  This\nsituation is handled by a `direct_dependent_settings` block:\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'type': 'executable',\n        'dependencies': [\n          'libbar',\n        ],\n      },\n      {\n        'target_name': 'libbar',\n        'type': '<(library)',\n        'defines': [\n          'LOCAL_DEFINE_FOR_LIBBAR',\n          'DEFINE_TO_USE_LIBBAR',\n        ],\n        'include_dirs': [\n          '..',\n          'include/libbar',\n        ],\n        'direct_dependent_settings': {\n          'defines': [\n            'DEFINE_TO_USE_LIBBAR',\n          ],\n          'include_dirs': [\n            'include/libbar',\n          ],\n        },\n      },\n    ],\n  }\n```\n\nIn the above example, the sources of the `foo` executable will be\ncompiled with the options `-DDEFINE_TO_USE_LIBBAR -Iinclude/libbar`,\nbecause of those settings' being listed in the\n`direct_dependent_settings` block.\n\nNote that these settings will likely need to be replicated in the\nsettings for the library target itself, so that the library will build\nwith the same options.  This does not prevent the target from defining\nadditional options for its \"internal\" use when compiling its own source\nfiles.  (In the above example, these are the `LOCAL_DEFINE_FOR_LIBBAR`\ndefine, and the `..` entry in the `include_dirs` list.)\n\n#### When a library depends on an additional library at final link time\n\n```\n  {\n    'targets': [\n      {\n        'target_name': 'foo',\n        'type': 'executable',\n        'dependencies': [\n          'libbar',\n        ],\n      },\n      {\n        'target_name': 'libbar',\n        'type': '<(library)',\n        'dependencies': [\n          'libother'\n        ],\n        'export_dependent_settings': [\n          'libother'\n        ],\n      },\n      {\n        'target_name': 'libother',\n        'type': '<(library)',\n        'direct_dependent_settings': {\n          'defines': [\n            'DEFINE_FOR_LIBOTHER',\n          ],\n          'include_dirs': [\n            'include/libother',\n          ],\n        },\n      },\n    ],\n  }\n```\n\n### Support for Mac OS X bundles\n\ngyp supports building bundles on OS X (.app, .framework, .bundle, etc).\nHere is an example of this:\n\n```\n    {\n      'target_name': 'test_app',\n      'product_name': 'Test App Gyp',\n      'type': 'executable',\n      'mac_bundle': 1,\n      'sources': [\n        'main.m',\n        'TestAppAppDelegate.h',\n        'TestAppAppDelegate.m',\n      ],\n      'mac_bundle_resources': [\n        'TestApp/English.lproj/InfoPlist.strings',\n        'TestApp/English.lproj/MainMenu.xib',\n      ],\n      'link_settings': {\n        'libraries': [\n          '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',\n        ],\n      },\n      'xcode_settings': {\n        'INFOPLIST_FILE': 'TestApp/TestApp-Info.plist',\n      },\n    },\n```\n\nThe `mac_bundle` key tells gyp that this target should be a bundle.\n`executable` targets get extension `.app` by default, `shared_library`\ntargets get `.framework` – but you can change the bundle extensions by\nsetting `product_extension` if you want. Files listed in\n`mac_bundle_resources` will be copied to the bundle's `Resource` folder\nof the bundle. You can also set\n`process_outputs_as_mac_bundle_resources` to 1 in actions and rules to\nlet the output of actions and rules be added to that folder (similar to\n`process_outputs_as_sources`). If `product_name` is not set, the bundle\nwill be named after `target_name`as usual.\n\n### Move files (refactoring)\n\nTODO\n\n### Custom build steps\n\nTODO\n\n#### Adding an explicit build step to generate specific files\n\nTODO\n\n#### Adding a rule to handle files with a new suffix\n\nTODO\n\n### Build flavors\n\nTODO\n"
  },
  {
    "path": "gyp/gyp",
    "content": "#!/bin/sh\n# Copyright 2013 The Chromium Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\nset -e\nbase=$(dirname \"$0\")\nexec python \"${base}/gyp_main.py\" \"$@\"\n"
  },
  {
    "path": "gyp/gyp.bat",
    "content": "@rem Copyright (c) 2009 Google Inc. All rights reserved.\r\n@rem Use of this source code is governed by a BSD-style license that can be\r\n@rem found in the LICENSE file.\r\n\r\n@python \"%~dp0gyp_main.py\" %*\r\n"
  },
  {
    "path": "gyp/gyp_main.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2009 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\nimport os\nimport subprocess\nimport sys\n\n\ndef IsCygwin():\n    # Function copied from pylib/gyp/common.py\n    try:\n        out = subprocess.Popen(\n            \"uname\", stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n        )\n        stdout, _ = out.communicate()\n        return \"CYGWIN\" in stdout.decode(\"utf-8\")\n    except Exception:\n        return False\n\n\ndef UnixifyPath(path):\n    try:\n        if not IsCygwin():\n            return path\n        out = subprocess.Popen(\n            [\"cygpath\", \"-u\", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n        )\n        stdout, _ = out.communicate()\n        return stdout.decode(\"utf-8\")\n    except Exception:\n        return path\n\n\n# Make sure we're using the version of pylib in this repo, not one installed\n# elsewhere on the system. Also convert to Unix style path on Cygwin systems,\n# else the 'gyp' library will not be found\npath = UnixifyPath(sys.argv[0])\nsys.path.insert(0, os.path.join(os.path.dirname(path), \"pylib\"))\nimport gyp  # noqa: E402\n\nif __name__ == \"__main__\":\n    sys.exit(gyp.script_main())\n"
  },
  {
    "path": "gyp/pylib/gyp/MSVSNew.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"New implementation of Visual Studio project generation.\"\"\"\n\nimport hashlib\nimport os\nimport random\nfrom operator import attrgetter\n\nimport gyp.common\n\n\ndef cmp(x, y):\n    return (x > y) - (x < y)\n\n\n# Initialize random number generator\nrandom.seed()\n\n# GUIDs for project types\nENTRY_TYPE_GUIDS = {\n    \"project\": \"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\",\n    \"folder\": \"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\",\n}\n\n# ------------------------------------------------------------------------------\n# Helper functions\n\n\ndef MakeGuid(name, seed=\"msvs_new\"):\n    \"\"\"Returns a GUID for the specified target name.\n\n    Args:\n      name: Target name.\n      seed: Seed for SHA-256 hash.\n    Returns:\n      A GUID-line string calculated from the name and seed.\n\n    This generates something which looks like a GUID, but depends only on the\n    name and seed.  This means the same name/seed will always generate the same\n    GUID, so that projects and solutions which refer to each other can explicitly\n    determine the GUID to refer to explicitly.  It also means that the GUID will\n    not change when the project for a target is rebuilt.\n    \"\"\"\n    # Calculate a SHA-256 signature for the seed and name.\n    d = hashlib.sha256((str(seed) + str(name)).encode(\"utf-8\")).hexdigest().upper()\n    # Convert most of the signature to GUID form (discard the rest)\n    guid = (\n        \"{\"\n        + d[:8]\n        + \"-\"\n        + d[8:12]\n        + \"-\"\n        + d[12:16]\n        + \"-\"\n        + d[16:20]\n        + \"-\"\n        + d[20:32]\n        + \"}\"\n    )\n    return guid\n\n\n# ------------------------------------------------------------------------------\n\n\nclass MSVSSolutionEntry:\n    def __cmp__(self, other):\n        # Sort by name then guid (so things are in order on vs2008).\n        return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))\n\n\nclass MSVSFolder(MSVSSolutionEntry):\n    \"\"\"Folder in a Visual Studio project or solution.\"\"\"\n\n    def __init__(self, path, name=None, entries=None, guid=None, items=None):\n        \"\"\"Initializes the folder.\n\n        Args:\n          path: Full path to the folder.\n          name: Name of the folder.\n          entries: List of folder entries to nest inside this folder.  May contain\n              Folder or Project objects.  May be None, if the folder is empty.\n          guid: GUID to use for folder, if not None.\n          items: List of solution items to include in the folder project.  May be\n              None, if the folder does not directly contain items.\n        \"\"\"\n        if name:\n            self.name = name\n        else:\n            # Use last layer.\n            self.name = os.path.basename(path)\n\n        self.path = path\n        self.guid = guid\n\n        # Copy passed lists (or set to empty lists)\n        self.entries = sorted(entries or [], key=attrgetter(\"path\"))\n        self.items = list(items or [])\n\n        self.entry_type_guid = ENTRY_TYPE_GUIDS[\"folder\"]\n\n    def get_guid(self):\n        if self.guid is None:\n            # Use consistent guids for folders (so things don't regenerate).\n            self.guid = MakeGuid(self.path, seed=\"msvs_folder\")\n        return self.guid\n\n\n# ------------------------------------------------------------------------------\n\n\nclass MSVSProject(MSVSSolutionEntry):\n    \"\"\"Visual Studio project.\"\"\"\n\n    def __init__(\n        self,\n        path,\n        name=None,\n        dependencies=None,\n        guid=None,\n        spec=None,\n        build_file=None,\n        config_platform_overrides=None,\n        fixpath_prefix=None,\n    ):\n        \"\"\"Initializes the project.\n\n        Args:\n          path: Absolute path to the project file.\n          name: Name of project.  If None, the name will be the same as the base\n              name of the project file.\n          dependencies: List of other Project objects this project is dependent\n              upon, if not None.\n          guid: GUID to use for project, if not None.\n          spec: Dictionary specifying how to build this project.\n          build_file: Filename of the .gyp file that the vcproj file comes from.\n          config_platform_overrides: optional dict of configuration platforms to\n              used in place of the default for this target.\n          fixpath_prefix: the path used to adjust the behavior of _fixpath\n        \"\"\"\n        self.path = path\n        self.guid = guid\n        self.spec = spec\n        self.build_file = build_file\n        # Use project filename if name not specified\n        self.name = name or os.path.splitext(os.path.basename(path))[0]\n\n        # Copy passed lists (or set to empty lists)\n        self.dependencies = list(dependencies or [])\n\n        self.entry_type_guid = ENTRY_TYPE_GUIDS[\"project\"]\n\n        if config_platform_overrides:\n            self.config_platform_overrides = config_platform_overrides\n        else:\n            self.config_platform_overrides = {}\n        self.fixpath_prefix = fixpath_prefix\n        self.msbuild_toolset = None\n\n    def set_dependencies(self, dependencies):\n        self.dependencies = list(dependencies or [])\n\n    def get_guid(self):\n        if self.guid is None:\n            # Set GUID from path\n            # TODO(rspangler): This is fragile.\n            # 1. We can't just use the project filename sans path, since there could\n            #    be multiple projects with the same base name (for example,\n            #    foo/unittest.vcproj and bar/unittest.vcproj).\n            # 2. The path needs to be relative to $SOURCE_ROOT, so that the project\n            #    GUID is the same whether it's included from base/base.sln or\n            #    foo/bar/baz/baz.sln.\n            # 3. The GUID needs to be the same each time this builder is invoked, so\n            #    that we don't need to rebuild the solution when the project changes.\n            # 4. We should be able to handle pre-built project files by reading the\n            #    GUID from the files.\n            self.guid = MakeGuid(self.name)\n        return self.guid\n\n    def set_msbuild_toolset(self, msbuild_toolset):\n        self.msbuild_toolset = msbuild_toolset\n\n\n# ------------------------------------------------------------------------------\n\n\nclass MSVSSolution:\n    \"\"\"Visual Studio solution.\"\"\"\n\n    def __init__(\n        self, path, version, entries=None, variants=None, websiteProperties=True\n    ):\n        \"\"\"Initializes the solution.\n\n        Args:\n          path: Path to solution file.\n          version: Format version to emit.\n          entries: List of entries in solution.  May contain Folder or Project\n              objects.  May be None, if the folder is empty.\n          variants: List of build variant strings.  If none, a default list will\n              be used.\n          websiteProperties: Flag to decide if the website properties section\n              is generated.\n        \"\"\"\n        self.path = path\n        self.websiteProperties = websiteProperties\n        self.version = version\n\n        # Copy passed lists (or set to empty lists)\n        self.entries = list(entries or [])\n\n        if variants:\n            # Copy passed list\n            self.variants = variants[:]\n        else:\n            # Use default\n            self.variants = [\"Debug|Win32\", \"Release|Win32\"]\n        # TODO(rspangler): Need to be able to handle a mapping of solution config\n        # to project config.  Should we be able to handle variants being a dict,\n        # or add a separate variant_map variable?  If it's a dict, we can't\n        # guarantee the order of variants since dict keys aren't ordered.\n\n        # TODO(rspangler): Automatically write to disk for now; should delay until\n        # node-evaluation time.\n        self.Write()\n\n    def Write(self, writer=gyp.common.WriteOnDiff):\n        \"\"\"Writes the solution file to disk.\n\n        Raises:\n          IndexError: An entry appears multiple times.\n        \"\"\"\n        # Walk the entry tree and collect all the folders and projects.\n        all_entries = set()\n        entries_to_check = self.entries[:]\n        while entries_to_check:\n            e = entries_to_check.pop(0)\n\n            # If this entry has been visited, nothing to do.\n            if e in all_entries:\n                continue\n\n            all_entries.add(e)\n\n            # If this is a folder, check its entries too.\n            if isinstance(e, MSVSFolder):\n                entries_to_check += e.entries\n\n        all_entries = sorted(all_entries, key=attrgetter(\"path\"))\n\n        # Open file and print header\n        f = writer(self.path)\n        f.write(\n            \"Microsoft Visual Studio Solution File, \"\n            \"Format Version %s\\r\\n\" % self.version.SolutionVersion()\n        )\n        f.write(\"# %s\\r\\n\" % self.version.Description())\n\n        # Project entries\n        sln_root = os.path.split(self.path)[0]\n        for e in all_entries:\n            relative_path = gyp.common.RelativePath(e.path, sln_root)\n            # msbuild does not accept an empty folder_name.\n            # use '.' in case relative_path is empty.\n            folder_name = relative_path.replace(\"/\", \"\\\\\") or \".\"\n            f.write(\n                'Project(\"%s\") = \"%s\", \"%s\", \"%s\"\\r\\n'\n                % (\n                    e.entry_type_guid,  # Entry type GUID\n                    e.name,  # Folder name\n                    folder_name,  # Folder name (again)\n                    e.get_guid(),  # Entry GUID\n                )\n            )\n\n            # TODO(rspangler): Need a way to configure this stuff\n            if self.websiteProperties:\n                f.write(\n                    \"\\tProjectSection(WebsiteProperties) = preProject\\r\\n\"\n                    '\\t\\tDebug.AspNetCompiler.Debug = \"True\"\\r\\n'\n                    '\\t\\tRelease.AspNetCompiler.Debug = \"False\"\\r\\n'\n                    \"\\tEndProjectSection\\r\\n\"\n                )\n\n            if isinstance(e, MSVSFolder) and e.items:\n                f.write(\"\\tProjectSection(SolutionItems) = preProject\\r\\n\")\n                for i in e.items:\n                    f.write(f\"\\t\\t{i} = {i}\\r\\n\")\n                f.write(\"\\tEndProjectSection\\r\\n\")\n\n            if isinstance(e, MSVSProject) and e.dependencies:\n                f.write(\"\\tProjectSection(ProjectDependencies) = postProject\\r\\n\")\n                for d in e.dependencies:\n                    f.write(f\"\\t\\t{d.get_guid()} = {d.get_guid()}\\r\\n\")\n                f.write(\"\\tEndProjectSection\\r\\n\")\n\n            f.write(\"EndProject\\r\\n\")\n\n        # Global section\n        f.write(\"Global\\r\\n\")\n\n        # Configurations (variants)\n        f.write(\"\\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\\r\\n\")\n        for v in self.variants:\n            f.write(f\"\\t\\t{v} = {v}\\r\\n\")\n        f.write(\"\\tEndGlobalSection\\r\\n\")\n\n        # Sort config guids for easier diffing of solution changes.\n        config_guids = []\n        config_guids_overrides = {}\n        for e in all_entries:\n            if isinstance(e, MSVSProject):\n                config_guids.append(e.get_guid())\n                config_guids_overrides[e.get_guid()] = e.config_platform_overrides\n        config_guids.sort()\n\n        f.write(\"\\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\\r\\n\")\n        for g in config_guids:\n            for v in self.variants:\n                nv = config_guids_overrides[g].get(v, v)\n                # Pick which project configuration to build for this solution\n                # configuration.\n                f.write(\n                    \"\\t\\t%s.%s.ActiveCfg = %s\\r\\n\"\n                    % (\n                        g,  # Project GUID\n                        v,  # Solution build configuration\n                        nv,  # Project build config for that solution config\n                    )\n                )\n\n                # Enable project in this solution configuration.\n                f.write(\n                    \"\\t\\t%s.%s.Build.0 = %s\\r\\n\"\n                    % (\n                        g,  # Project GUID\n                        v,  # Solution build configuration\n                        nv,  # Project build config for that solution config\n                    )\n                )\n        f.write(\"\\tEndGlobalSection\\r\\n\")\n\n        # TODO(rspangler): Should be able to configure this stuff too (though I've\n        # never seen this be any different)\n        f.write(\"\\tGlobalSection(SolutionProperties) = preSolution\\r\\n\")\n        f.write(\"\\t\\tHideSolutionNode = FALSE\\r\\n\")\n        f.write(\"\\tEndGlobalSection\\r\\n\")\n\n        # Folder mappings\n        # Omit this section if there are no folders\n        if any(e.entries for e in all_entries if isinstance(e, MSVSFolder)):\n            f.write(\"\\tGlobalSection(NestedProjects) = preSolution\\r\\n\")\n            for e in all_entries:\n                if not isinstance(e, MSVSFolder):\n                    continue  # Does not apply to projects, only folders\n                for subentry in e.entries:\n                    f.write(f\"\\t\\t{subentry.get_guid()} = {e.get_guid()}\\r\\n\")\n            f.write(\"\\tEndGlobalSection\\r\\n\")\n\n        f.write(\"EndGlobal\\r\\n\")\n\n        f.close()\n"
  },
  {
    "path": "gyp/pylib/gyp/MSVSProject.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Visual Studio project reader/writer.\"\"\"\n\nfrom gyp import easy_xml\n\n# ------------------------------------------------------------------------------\n\n\nclass Tool:\n    \"\"\"Visual Studio tool.\"\"\"\n\n    def __init__(self, name, attrs=None):\n        \"\"\"Initializes the tool.\n\n        Args:\n          name: Tool name.\n          attrs: Dict of tool attributes; may be None.\n        \"\"\"\n        self._attrs = attrs or {}\n        self._attrs[\"Name\"] = name\n\n    def _GetSpecification(self):\n        \"\"\"Creates an element for the tool.\n\n        Returns:\n          A new xml.dom.Element for the tool.\n        \"\"\"\n        return [\"Tool\", self._attrs]\n\n\nclass Filter:\n    \"\"\"Visual Studio filter - that is, a virtual folder.\"\"\"\n\n    def __init__(self, name, contents=None):\n        \"\"\"Initializes the folder.\n\n        Args:\n          name: Filter (folder) name.\n          contents: List of filenames and/or Filter objects contained.\n        \"\"\"\n        self.name = name\n        self.contents = list(contents or [])\n\n\n# ------------------------------------------------------------------------------\n\n\nclass Writer:\n    \"\"\"Visual Studio XML project writer.\"\"\"\n\n    def __init__(self, project_path, version, name, guid=None, platforms=None):\n        \"\"\"Initializes the project.\n\n        Args:\n          project_path: Path to the project file.\n          version: Format version to emit.\n          name: Name of the project.\n          guid: GUID to use for project, if not None.\n          platforms: Array of string, the supported platforms.  If null, ['Win32']\n        \"\"\"\n        self.project_path = project_path\n        self.version = version\n        self.name = name\n        self.guid = guid\n\n        # Default to Win32 for platforms.\n        if not platforms:\n            platforms = [\"Win32\"]\n\n        # Initialize the specifications of the various sections.\n        self.platform_section = [\"Platforms\"]\n        for platform in platforms:\n            self.platform_section.append([\"Platform\", {\"Name\": platform}])\n        self.tool_files_section = [\"ToolFiles\"]\n        self.configurations_section = [\"Configurations\"]\n        self.files_section = [\"Files\"]\n\n        # Keep a dict keyed on filename to speed up access.\n        self.files_dict = {}\n\n    def AddToolFile(self, path):\n        \"\"\"Adds a tool file to the project.\n\n        Args:\n          path: Relative path from project to tool file.\n        \"\"\"\n        self.tool_files_section.append([\"ToolFile\", {\"RelativePath\": path}])\n\n    def _GetSpecForConfiguration(self, config_type, config_name, attrs, tools):\n        \"\"\"Returns the specification for a configuration.\n\n        Args:\n          config_type: Type of configuration node.\n          config_name: Configuration name.\n          attrs: Dict of configuration attributes; may be None.\n          tools: List of tools (strings or Tool objects); may be None.\n        Returns:\n        \"\"\"\n        # Handle defaults\n        if not attrs:\n            attrs = {}\n        if not tools:\n            tools = []\n\n        # Add configuration node and its attributes\n        node_attrs = attrs.copy()\n        node_attrs[\"Name\"] = config_name\n        specification = [config_type, node_attrs]\n\n        # Add tool nodes and their attributes\n        if tools:\n            for t in tools:\n                if isinstance(t, Tool):\n                    specification.append(t._GetSpecification())\n                else:\n                    specification.append(Tool(t)._GetSpecification())\n        return specification\n\n    def AddConfig(self, name, attrs=None, tools=None):\n        \"\"\"Adds a configuration to the project.\n\n        Args:\n          name: Configuration name.\n          attrs: Dict of configuration attributes; may be None.\n          tools: List of tools (strings or Tool objects); may be None.\n        \"\"\"\n        spec = self._GetSpecForConfiguration(\"Configuration\", name, attrs, tools)\n        self.configurations_section.append(spec)\n\n    def _AddFilesToNode(self, parent, files):\n        \"\"\"Adds files and/or filters to the parent node.\n\n        Args:\n          parent: Destination node\n          files: A list of Filter objects and/or relative paths to files.\n\n        Will call itself recursively, if the files list contains Filter objects.\n        \"\"\"\n        for f in files:\n            if isinstance(f, Filter):\n                node = [\"Filter\", {\"Name\": f.name}]\n                self._AddFilesToNode(node, f.contents)\n            else:\n                node = [\"File\", {\"RelativePath\": f}]\n                self.files_dict[f] = node\n            parent.append(node)\n\n    def AddFiles(self, files):\n        \"\"\"Adds files to the project.\n\n        Args:\n          files: A list of Filter objects and/or relative paths to files.\n\n        This makes a copy of the file/filter tree at the time of this call.  If you\n        later add files to a Filter object which was passed into a previous call\n        to AddFiles(), it will not be reflected in this project.\n        \"\"\"\n        self._AddFilesToNode(self.files_section, files)\n        # TODO(rspangler) This also doesn't handle adding files to an existing\n        # filter.  That is, it doesn't merge the trees.\n\n    def AddFileConfig(self, path, config, attrs=None, tools=None):\n        \"\"\"Adds a configuration to a file.\n\n        Args:\n          path: Relative path to the file.\n          config: Name of configuration to add.\n          attrs: Dict of configuration attributes; may be None.\n          tools: List of tools (strings or Tool objects); may be None.\n\n        Raises:\n          ValueError: Relative path does not match any file added via AddFiles().\n        \"\"\"\n        # Find the file node with the right relative path\n        parent = self.files_dict.get(path)\n        if not parent:\n            raise ValueError('AddFileConfig: file \"%s\" not in project.' % path)\n\n        # Add the config to the file node\n        spec = self._GetSpecForConfiguration(\"FileConfiguration\", config, attrs, tools)\n        parent.append(spec)\n\n    def WriteIfChanged(self):\n        \"\"\"Writes the project file.\"\"\"\n        # First create XML content definition\n        content = [\n            \"VisualStudioProject\",\n            {\n                \"ProjectType\": \"Visual C++\",\n                \"Version\": self.version.ProjectVersion(),\n                \"Name\": self.name,\n                \"ProjectGUID\": self.guid,\n                \"RootNamespace\": self.name,\n                \"Keyword\": \"Win32Proj\",\n            },\n            self.platform_section,\n            self.tool_files_section,\n            self.configurations_section,\n            [\"References\"],  # empty section\n            self.files_section,\n            [\"Globals\"],  # empty section\n        ]\n        easy_xml.WriteXmlIfChanged(content, self.project_path, encoding=\"Windows-1252\")\n"
  },
  {
    "path": "gyp/pylib/gyp/MSVSSettings.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\nr\"\"\"Code to validate and convert settings of the Microsoft build tools.\n\nThis file contains code to validate and convert settings of the Microsoft\nbuild tools.  The function ConvertToMSBuildSettings(), ValidateMSVSSettings(),\nand ValidateMSBuildSettings() are the entry points.\n\nThis file was created by comparing the projects created by Visual Studio 2008\nand Visual Studio 2010 for all available settings through the user interface.\nThe MSBuild schemas were also considered.  They are typically found in the\nMSBuild install directory, e.g. c:\\Program Files (x86)\\MSBuild\n\"\"\"\n\nimport re\nimport sys\n\n# Dictionaries of settings validators. The key is the tool name, the value is\n# a dictionary mapping setting names to validation functions.\n_msvs_validators = {}\n_msbuild_validators = {}\n\n\n# A dictionary of settings converters. The key is the tool name, the value is\n# a dictionary mapping setting names to conversion functions.\n_msvs_to_msbuild_converters = {}\n\n\n# Tool name mapping from MSVS to MSBuild.\n_msbuild_name_of_tool = {}\n\n\nclass _Tool:\n    \"\"\"Represents a tool used by MSVS or MSBuild.\n\n    Attributes:\n        msvs_name: The name of the tool in MSVS.\n        msbuild_name: The name of the tool in MSBuild.\n    \"\"\"\n\n    def __init__(self, msvs_name, msbuild_name):\n        self.msvs_name = msvs_name\n        self.msbuild_name = msbuild_name\n\n\ndef _AddTool(tool):\n    \"\"\"Adds a tool to the four dictionaries used to process settings.\n\n    This only defines the tool.  Each setting also needs to be added.\n\n    Args:\n      tool: The _Tool object to be added.\n    \"\"\"\n    _msvs_validators[tool.msvs_name] = {}\n    _msbuild_validators[tool.msbuild_name] = {}\n    _msvs_to_msbuild_converters[tool.msvs_name] = {}\n    _msbuild_name_of_tool[tool.msvs_name] = tool.msbuild_name\n\n\ndef _GetMSBuildToolSettings(msbuild_settings, tool):\n    \"\"\"Returns an MSBuild tool dictionary.  Creates it if needed.\"\"\"\n    return msbuild_settings.setdefault(tool.msbuild_name, {})\n\n\nclass _Type:\n    \"\"\"Type of settings (Base class).\"\"\"\n\n    def ValidateMSVS(self, value):\n        \"\"\"Verifies that the value is legal for MSVS.\n\n        Args:\n          value: the value to check for this type.\n\n        Raises:\n          ValueError if value is not valid for MSVS.\n        \"\"\"\n\n    def ValidateMSBuild(self, value):\n        \"\"\"Verifies that the value is legal for MSBuild.\n\n        Args:\n          value: the value to check for this type.\n\n        Raises:\n          ValueError if value is not valid for MSBuild.\n        \"\"\"\n\n    def ConvertToMSBuild(self, value):\n        \"\"\"Returns the MSBuild equivalent of the MSVS value given.\n\n        Args:\n          value: the MSVS value to convert.\n\n        Returns:\n          the MSBuild equivalent.\n\n        Raises:\n          ValueError if value is not valid.\n        \"\"\"\n        return value\n\n\nclass _String(_Type):\n    \"\"\"A setting that's just a string.\"\"\"\n\n    def ValidateMSVS(self, value):\n        if not isinstance(value, str):\n            raise ValueError(\"expected string; got %r\" % value)\n\n    def ValidateMSBuild(self, value):\n        if not isinstance(value, str):\n            raise ValueError(\"expected string; got %r\" % value)\n\n    def ConvertToMSBuild(self, value):\n        # Convert the macros\n        return ConvertVCMacrosToMSBuild(value)\n\n\nclass _StringList(_Type):\n    \"\"\"A settings that's a list of strings.\"\"\"\n\n    def ValidateMSVS(self, value):\n        if not isinstance(value, (list, str)):\n            raise ValueError(\"expected string list; got %r\" % value)\n\n    def ValidateMSBuild(self, value):\n        if not isinstance(value, (list, str)):\n            raise ValueError(\"expected string list; got %r\" % value)\n\n    def ConvertToMSBuild(self, value):\n        # Convert the macros\n        if isinstance(value, list):\n            return [ConvertVCMacrosToMSBuild(i) for i in value]\n        else:\n            return ConvertVCMacrosToMSBuild(value)\n\n\nclass _Boolean(_Type):\n    \"\"\"Boolean settings, can have the values 'false' or 'true'.\"\"\"\n\n    def _Validate(self, value):\n        if value not in {\"true\", \"false\"}:\n            raise ValueError(\"expected bool; got %r\" % value)\n\n    def ValidateMSVS(self, value):\n        self._Validate(value)\n\n    def ValidateMSBuild(self, value):\n        self._Validate(value)\n\n    def ConvertToMSBuild(self, value):\n        self._Validate(value)\n        return value\n\n\nclass _Integer(_Type):\n    \"\"\"Integer settings.\"\"\"\n\n    def __init__(self, msbuild_base=10):\n        _Type.__init__(self)\n        self._msbuild_base = msbuild_base\n\n    def ValidateMSVS(self, value):\n        # Try to convert, this will raise ValueError if invalid.\n        self.ConvertToMSBuild(value)\n\n    def ValidateMSBuild(self, value):\n        # Try to convert, this will raise ValueError if invalid.\n        int(value, self._msbuild_base)\n\n    def ConvertToMSBuild(self, value):\n        msbuild_format = ((self._msbuild_base == 10) and \"%d\") or \"0x%04x\"\n        return msbuild_format % int(value)\n\n\nclass _Enumeration(_Type):\n    \"\"\"Type of settings that is an enumeration.\n\n    In MSVS, the values are indexes like '0', '1', and '2'.\n    MSBuild uses text labels that are more representative, like 'Win32'.\n\n    Constructor args:\n      label_list: an array of MSBuild labels that correspond to the MSVS index.\n          In the rare cases where MSVS has skipped an index value, None is\n          used in the array to indicate the unused spot.\n      new: an array of labels that are new to MSBuild.\n    \"\"\"\n\n    def __init__(self, label_list, new=None):\n        _Type.__init__(self)\n        self._label_list = label_list\n        self._msbuild_values = {value for value in label_list if value is not None}\n        if new is not None:\n            self._msbuild_values.update(new)\n\n    def ValidateMSVS(self, value):\n        # Try to convert.  It will raise an exception if not valid.\n        self.ConvertToMSBuild(value)\n\n    def ValidateMSBuild(self, value):\n        if value not in self._msbuild_values:\n            raise ValueError(\"unrecognized enumerated value %s\" % value)\n\n    def ConvertToMSBuild(self, value):\n        index = int(value)\n        if index < 0 or index >= len(self._label_list):\n            raise ValueError(\n                \"index value (%d) not in expected range [0, %d)\"\n                % (index, len(self._label_list))\n            )\n        label = self._label_list[index]\n        if label is None:\n            raise ValueError(\"converted value for %s not specified.\" % value)\n        return label\n\n\n# Instantiate the various generic types.\n_boolean = _Boolean()\n_integer = _Integer()\n# For now, we don't do any special validation on these types:\n_string = _String()\n_file_name = _String()\n_folder_name = _String()\n_file_list = _StringList()\n_folder_list = _StringList()\n_string_list = _StringList()\n# Some boolean settings went from numerical values to boolean.  The\n# mapping is 0: default, 1: false, 2: true.\n_newly_boolean = _Enumeration([\"\", \"false\", \"true\"])\n\n\ndef _Same(tool, name, setting_type):\n    \"\"\"Defines a setting that has the same name in MSVS and MSBuild.\n\n    Args:\n      tool: a dictionary that gives the names of the tool for MSVS and MSBuild.\n      name: the name of the setting.\n      setting_type: the type of this setting.\n    \"\"\"\n    _Renamed(tool, name, name, setting_type)\n\n\ndef _Renamed(tool, msvs_name, msbuild_name, setting_type):\n    \"\"\"Defines a setting for which the name has changed.\n\n    Args:\n      tool: a dictionary that gives the names of the tool for MSVS and MSBuild.\n      msvs_name: the name of the MSVS setting.\n      msbuild_name: the name of the MSBuild setting.\n      setting_type: the type of this setting.\n    \"\"\"\n\n    def _Translate(value, msbuild_settings):\n        msbuild_tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)\n        msbuild_tool_settings[msbuild_name] = setting_type.ConvertToMSBuild(value)\n\n    _msvs_validators[tool.msvs_name][msvs_name] = setting_type.ValidateMSVS\n    _msbuild_validators[tool.msbuild_name][msbuild_name] = setting_type.ValidateMSBuild\n    _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate\n\n\ndef _Moved(tool, settings_name, msbuild_tool_name, setting_type):\n    _MovedAndRenamed(\n        tool, settings_name, msbuild_tool_name, settings_name, setting_type\n    )\n\n\ndef _MovedAndRenamed(\n    tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, setting_type\n):\n    \"\"\"Defines a setting that may have moved to a new section.\n\n    Args:\n      tool: a dictionary that gives the names of the tool for MSVS and MSBuild.\n      msvs_settings_name: the MSVS name of the setting.\n      msbuild_tool_name: the name of the MSBuild tool to place the setting under.\n      msbuild_settings_name: the MSBuild name of the setting.\n      setting_type: the type of this setting.\n    \"\"\"\n\n    def _Translate(value, msbuild_settings):\n        tool_settings = msbuild_settings.setdefault(msbuild_tool_name, {})\n        tool_settings[msbuild_settings_name] = setting_type.ConvertToMSBuild(value)\n\n    _msvs_validators[tool.msvs_name][msvs_settings_name] = setting_type.ValidateMSVS\n    validator = setting_type.ValidateMSBuild\n    _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator\n    _msvs_to_msbuild_converters[tool.msvs_name][msvs_settings_name] = _Translate\n\n\ndef _MSVSOnly(tool, name, setting_type):\n    \"\"\"Defines a setting that is only found in MSVS.\n\n    Args:\n      tool: a dictionary that gives the names of the tool for MSVS and MSBuild.\n      name: the name of the setting.\n      setting_type: the type of this setting.\n    \"\"\"\n\n    def _Translate(unused_value, unused_msbuild_settings):\n        # Since this is for MSVS only settings, no translation will happen.\n        pass\n\n    _msvs_validators[tool.msvs_name][name] = setting_type.ValidateMSVS\n    _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate\n\n\ndef _MSBuildOnly(tool, name, setting_type):\n    \"\"\"Defines a setting that is only found in MSBuild.\n\n    Args:\n      tool: a dictionary that gives the names of the tool for MSVS and MSBuild.\n      name: the name of the setting.\n      setting_type: the type of this setting.\n    \"\"\"\n\n    def _Translate(value, msbuild_settings):\n        # Let msbuild-only properties get translated as-is from msvs_settings.\n        tool_settings = msbuild_settings.setdefault(tool.msbuild_name, {})\n        tool_settings[name] = value\n\n    _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild\n    _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate\n\n\ndef _ConvertedToAdditionalOption(tool, msvs_name, flag):\n    \"\"\"Defines a setting that's handled via a command line option in MSBuild.\n\n    Args:\n      tool: a dictionary that gives the names of the tool for MSVS and MSBuild.\n      msvs_name: the name of the MSVS setting that if 'true' becomes a flag\n      flag: the flag to insert at the end of the AdditionalOptions\n    \"\"\"\n\n    def _Translate(value, msbuild_settings):\n        if value == \"true\":\n            tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)\n            if \"AdditionalOptions\" in tool_settings:\n                new_flags = \"{} {}\".format(tool_settings[\"AdditionalOptions\"], flag)\n            else:\n                new_flags = flag\n            tool_settings[\"AdditionalOptions\"] = new_flags\n\n    _msvs_validators[tool.msvs_name][msvs_name] = _boolean.ValidateMSVS\n    _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate\n\n\ndef _CustomGeneratePreprocessedFile(tool, msvs_name):\n    def _Translate(value, msbuild_settings):\n        tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)\n        if value == \"0\":\n            tool_settings[\"PreprocessToFile\"] = \"false\"\n            tool_settings[\"PreprocessSuppressLineNumbers\"] = \"false\"\n        elif value == \"1\":  # /P\n            tool_settings[\"PreprocessToFile\"] = \"true\"\n            tool_settings[\"PreprocessSuppressLineNumbers\"] = \"false\"\n        elif value == \"2\":  # /EP /P\n            tool_settings[\"PreprocessToFile\"] = \"true\"\n            tool_settings[\"PreprocessSuppressLineNumbers\"] = \"true\"\n        else:\n            raise ValueError(\"value must be one of [0, 1, 2]; got %s\" % value)\n\n    # Create a bogus validator that looks for '0', '1', or '2'\n    msvs_validator = _Enumeration([\"a\", \"b\", \"c\"]).ValidateMSVS\n    _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator\n    msbuild_validator = _boolean.ValidateMSBuild\n    msbuild_tool_validators = _msbuild_validators[tool.msbuild_name]\n    msbuild_tool_validators[\"PreprocessToFile\"] = msbuild_validator\n    msbuild_tool_validators[\"PreprocessSuppressLineNumbers\"] = msbuild_validator\n    _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate\n\n\nfix_vc_macro_slashes_regex_list = (\"IntDir\", \"OutDir\")\nfix_vc_macro_slashes_regex = re.compile(\n    r\"(\\$\\((?:%s)\\))(?:[\\\\/]+)\" % \"|\".join(fix_vc_macro_slashes_regex_list)\n)\n\n# Regular expression to detect keys that were generated by exclusion lists\n_EXCLUDED_SUFFIX_RE = re.compile(\"^(.*)_excluded$\")\n\n\ndef _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr):\n    \"\"\"Verify that 'setting' is valid if it is generated from an exclusion list.\n\n    If the setting appears to be generated from an exclusion list, the root name\n    is checked.\n\n    Args:\n        setting:   A string that is the setting name to validate\n        settings:  A dictionary where the keys are valid settings\n        error_msg: The message to emit in the event of error\n        stderr:    The stream receiving the error messages.\n    \"\"\"\n    # This may be unrecognized because it's an exclusion list. If the\n    # setting name has the _excluded suffix, then check the root name.\n    unrecognized = True\n    if m := re.match(_EXCLUDED_SUFFIX_RE, setting):\n        root_setting = m.group(1)\n        unrecognized = root_setting not in settings\n\n    if unrecognized:\n        # We don't know this setting. Give a warning.\n        print(error_msg, file=stderr)\n\n\ndef FixVCMacroSlashes(s):\n    \"\"\"Replace macros which have excessive following slashes.\n\n    These macros are known to have a built-in trailing slash. Furthermore, many\n    scripts hiccup on processing paths with extra slashes in the middle.\n\n    This list is probably not exhaustive.  Add as needed.\n    \"\"\"\n    if \"$\" in s:\n        s = fix_vc_macro_slashes_regex.sub(r\"\\1\", s)\n    return s\n\n\ndef ConvertVCMacrosToMSBuild(s):\n    \"\"\"Convert the MSVS macros found in the string to the MSBuild equivalent.\n\n    This list is probably not exhaustive.  Add as needed.\n    \"\"\"\n    if \"$\" in s:\n        replace_map = {\n            \"$(ConfigurationName)\": \"$(Configuration)\",\n            \"$(InputDir)\": \"%(RelativeDir)\",\n            \"$(InputExt)\": \"%(Extension)\",\n            \"$(InputFileName)\": \"%(Filename)%(Extension)\",\n            \"$(InputName)\": \"%(Filename)\",\n            \"$(InputPath)\": \"%(Identity)\",\n            \"$(ParentName)\": \"$(ProjectFileName)\",\n            \"$(PlatformName)\": \"$(Platform)\",\n            \"$(SafeInputName)\": \"%(Filename)\",\n        }\n        for old, new in replace_map.items():\n            s = s.replace(old, new)\n        s = FixVCMacroSlashes(s)\n    return s\n\n\ndef ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):\n    \"\"\"Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).\n\n    Args:\n        msvs_settings: A dictionary.  The key is the tool name.  The values are\n            themselves dictionaries of settings and their values.\n        stderr: The stream receiving the error messages.\n\n    Returns:\n        A dictionary of MSBuild settings.  The key is either the MSBuild tool name\n        or the empty string (for the global settings).  The values are themselves\n        dictionaries of settings and their values.\n    \"\"\"\n    msbuild_settings = {}\n    for msvs_tool_name, msvs_tool_settings in msvs_settings.items():\n        if msvs_tool_name in _msvs_to_msbuild_converters:\n            msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]\n            for msvs_setting, msvs_value in msvs_tool_settings.items():\n                if msvs_setting in msvs_tool:\n                    # Invoke the translation function.\n                    try:\n                        msvs_tool[msvs_setting](msvs_value, msbuild_settings)\n                    except ValueError as e:\n                        print(\n                            \"Warning: while converting %s/%s to MSBuild, \"\n                            \"%s\" % (msvs_tool_name, msvs_setting, e),\n                            file=stderr,\n                        )\n                else:\n                    _ValidateExclusionSetting(\n                        msvs_setting,\n                        msvs_tool,\n                        (\n                            \"Warning: unrecognized setting %s/%s \"\n                            \"while converting to MSBuild.\"\n                            % (msvs_tool_name, msvs_setting)\n                        ),\n                        stderr,\n                    )\n        else:\n            print(\n                \"Warning: unrecognized tool %s while converting to \"\n                \"MSBuild.\" % msvs_tool_name,\n                file=stderr,\n            )\n    return msbuild_settings\n\n\ndef ValidateMSVSSettings(settings, stderr=sys.stderr):\n    \"\"\"Validates that the names of the settings are valid for MSVS.\n\n    Args:\n        settings: A dictionary.  The key is the tool name.  The values are\n            themselves dictionaries of settings and their values.\n        stderr: The stream receiving the error messages.\n    \"\"\"\n    _ValidateSettings(_msvs_validators, settings, stderr)\n\n\ndef ValidateMSBuildSettings(settings, stderr=sys.stderr):\n    \"\"\"Validates that the names of the settings are valid for MSBuild.\n\n    Args:\n        settings: A dictionary.  The key is the tool name.  The values are\n            themselves dictionaries of settings and their values.\n        stderr: The stream receiving the error messages.\n    \"\"\"\n    _ValidateSettings(_msbuild_validators, settings, stderr)\n\n\ndef _ValidateSettings(validators, settings, stderr):\n    \"\"\"Validates that the settings are valid for MSBuild or MSVS.\n\n    We currently only validate the names of the settings, not their values.\n\n    Args:\n        validators: A dictionary of tools and their validators.\n        settings: A dictionary.  The key is the tool name.  The values are\n            themselves dictionaries of settings and their values.\n        stderr: The stream receiving the error messages.\n    \"\"\"\n    for tool_name in settings:\n        if tool_name in validators:\n            tool_validators = validators[tool_name]\n            for setting, value in settings[tool_name].items():\n                if setting in tool_validators:\n                    try:\n                        tool_validators[setting](value)\n                    except ValueError as e:\n                        print(\n                            f\"Warning: for {tool_name}/{setting}, {e}\",\n                            file=stderr,\n                        )\n                else:\n                    _ValidateExclusionSetting(\n                        setting,\n                        tool_validators,\n                        (f\"Warning: unrecognized setting {tool_name}/{setting}\"),\n                        stderr,\n                    )\n\n        else:\n            print(\"Warning: unrecognized tool %s\" % (tool_name), file=stderr)\n\n\n# MSVS and MBuild names of the tools.\n_compile = _Tool(\"VCCLCompilerTool\", \"ClCompile\")\n_link = _Tool(\"VCLinkerTool\", \"Link\")\n_midl = _Tool(\"VCMIDLTool\", \"Midl\")\n_rc = _Tool(\"VCResourceCompilerTool\", \"ResourceCompile\")\n_lib = _Tool(\"VCLibrarianTool\", \"Lib\")\n_manifest = _Tool(\"VCManifestTool\", \"Manifest\")\n_masm = _Tool(\"MASM\", \"MASM\")\n_armasm = _Tool(\"ARMASM\", \"ARMASM\")\n\n\n_AddTool(_compile)\n_AddTool(_link)\n_AddTool(_midl)\n_AddTool(_rc)\n_AddTool(_lib)\n_AddTool(_manifest)\n_AddTool(_masm)\n_AddTool(_armasm)\n# Add sections only found in the MSBuild settings.\n_msbuild_validators[\"\"] = {}\n_msbuild_validators[\"ProjectReference\"] = {}\n_msbuild_validators[\"ManifestResourceCompile\"] = {}\n\n# Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and\n# ClCompile in MSBuild.\n# See \"c:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\1033\\cl.xml\" for\n# the schema of the MSBuild ClCompile settings.\n\n# Options that have the same name in MSVS and MSBuild\n_Same(_compile, \"AdditionalIncludeDirectories\", _folder_list)  # /I\n_Same(_compile, \"AdditionalOptions\", _string_list)\n_Same(_compile, \"AdditionalUsingDirectories\", _folder_list)  # /AI\n_Same(_compile, \"AssemblerListingLocation\", _file_name)  # /Fa\n_Same(_compile, \"BrowseInformationFile\", _file_name)\n_Same(_compile, \"BufferSecurityCheck\", _boolean)  # /GS\n_Same(_compile, \"DisableLanguageExtensions\", _boolean)  # /Za\n_Same(_compile, \"DisableSpecificWarnings\", _string_list)  # /wd\n_Same(_compile, \"EnableFiberSafeOptimizations\", _boolean)  # /GT\n_Same(_compile, \"EnablePREfast\", _boolean)  # /analyze Visible='false'\n_Same(_compile, \"ExpandAttributedSource\", _boolean)  # /Fx\n_Same(_compile, \"FloatingPointExceptions\", _boolean)  # /fp:except\n_Same(_compile, \"ForceConformanceInForLoopScope\", _boolean)  # /Zc:forScope\n_Same(_compile, \"ForcedIncludeFiles\", _file_list)  # /FI\n_Same(_compile, \"ForcedUsingFiles\", _file_list)  # /FU\n_Same(_compile, \"GenerateXMLDocumentationFiles\", _boolean)  # /doc\n_Same(_compile, \"IgnoreStandardIncludePath\", _boolean)  # /X\n_Same(_compile, \"MinimalRebuild\", _boolean)  # /Gm\n_Same(_compile, \"OmitDefaultLibName\", _boolean)  # /Zl\n_Same(_compile, \"OmitFramePointers\", _boolean)  # /Oy\n_Same(_compile, \"PreprocessorDefinitions\", _string_list)  # /D\n_Same(_compile, \"ProgramDataBaseFileName\", _file_name)  # /Fd\n_Same(_compile, \"RuntimeTypeInfo\", _boolean)  # /GR\n_Same(_compile, \"ShowIncludes\", _boolean)  # /showIncludes\n_Same(_compile, \"SmallerTypeCheck\", _boolean)  # /RTCc\n_Same(_compile, \"StringPooling\", _boolean)  # /GF\n_Same(_compile, \"SuppressStartupBanner\", _boolean)  # /nologo\n_Same(_compile, \"TreatWChar_tAsBuiltInType\", _boolean)  # /Zc:wchar_t\n_Same(_compile, \"UndefineAllPreprocessorDefinitions\", _boolean)  # /u\n_Same(_compile, \"UndefinePreprocessorDefinitions\", _string_list)  # /U\n_Same(_compile, \"UseFullPaths\", _boolean)  # /FC\n_Same(_compile, \"WholeProgramOptimization\", _boolean)  # /GL\n_Same(_compile, \"XMLDocumentationFileName\", _file_name)\n_Same(_compile, \"CompileAsWinRT\", _boolean)  # /ZW\n\n_Same(\n    _compile,\n    \"AssemblerOutput\",\n    _Enumeration(\n        [\n            \"NoListing\",\n            \"AssemblyCode\",  # /FA\n            \"All\",  # /FAcs\n            \"AssemblyAndMachineCode\",  # /FAc\n            \"AssemblyAndSourceCode\",\n        ]\n    ),\n)  # /FAs\n_Same(\n    _compile,\n    \"BasicRuntimeChecks\",\n    _Enumeration(\n        [\n            \"Default\",\n            \"StackFrameRuntimeCheck\",  # /RTCs\n            \"UninitializedLocalUsageCheck\",  # /RTCu\n            \"EnableFastChecks\",\n        ]\n    ),\n)  # /RTC1\n_Same(\n    _compile,\n    \"BrowseInformation\",\n    _Enumeration([\"false\", \"true\", \"true\"]),  # /FR\n)  # /Fr\n_Same(\n    _compile,\n    \"CallingConvention\",\n    _Enumeration([\"Cdecl\", \"FastCall\", \"StdCall\", \"VectorCall\"]),  # /Gd  # /Gr  # /Gz\n)  # /Gv\n_Same(\n    _compile,\n    \"CompileAs\",\n    _Enumeration([\"Default\", \"CompileAsC\", \"CompileAsCpp\"]),  # /TC\n)  # /TP\n_Same(\n    _compile,\n    \"DebugInformationFormat\",\n    _Enumeration(\n        [\n            \"\",  # Disabled\n            \"OldStyle\",  # /Z7\n            None,\n            \"ProgramDatabase\",  # /Zi\n            \"EditAndContinue\",\n        ]\n    ),\n)  # /ZI\n_Same(\n    _compile,\n    \"EnableEnhancedInstructionSet\",\n    _Enumeration(\n        [\n            \"NotSet\",\n            \"StreamingSIMDExtensions\",  # /arch:SSE\n            \"StreamingSIMDExtensions2\",  # /arch:SSE2\n            \"AdvancedVectorExtensions\",  # /arch:AVX (vs2012+)\n            \"NoExtensions\",  # /arch:IA32 (vs2012+)\n            # This one only exists in the new msbuild format.\n            \"AdvancedVectorExtensions2\",  # /arch:AVX2 (vs2013r2+)\n        ]\n    ),\n)\n_Same(\n    _compile,\n    \"ErrorReporting\",\n    _Enumeration(\n        [\n            \"None\",  # /errorReport:none\n            \"Prompt\",  # /errorReport:prompt\n            \"Queue\",\n        ],  # /errorReport:queue\n        new=[\"Send\"],\n    ),\n)  # /errorReport:send\"\n_Same(\n    _compile,\n    \"ExceptionHandling\",\n    _Enumeration([\"false\", \"Sync\", \"Async\"], new=[\"SyncCThrow\"]),  # /EHsc  # /EHa\n)  # /EHs\n_Same(\n    _compile,\n    \"FavorSizeOrSpeed\",\n    _Enumeration([\"Neither\", \"Speed\", \"Size\"]),  # /Ot\n)  # /Os\n_Same(\n    _compile,\n    \"FloatingPointModel\",\n    _Enumeration([\"Precise\", \"Strict\", \"Fast\"]),  # /fp:precise  # /fp:strict\n)  # /fp:fast\n_Same(\n    _compile,\n    \"InlineFunctionExpansion\",\n    _Enumeration(\n        [\"Default\", \"OnlyExplicitInline\", \"AnySuitable\"],  # /Ob1  # /Ob2\n        new=[\"Disabled\"],\n    ),\n)  # /Ob0\n_Same(\n    _compile,\n    \"Optimization\",\n    _Enumeration([\"Disabled\", \"MinSpace\", \"MaxSpeed\", \"Full\"]),  # /Od  # /O1  # /O2\n)  # /Ox\n_Same(\n    _compile,\n    \"RuntimeLibrary\",\n    _Enumeration(\n        [\n            \"MultiThreaded\",  # /MT\n            \"MultiThreadedDebug\",  # /MTd\n            \"MultiThreadedDLL\",  # /MD\n            \"MultiThreadedDebugDLL\",\n        ]\n    ),\n)  # /MDd\n_Same(\n    _compile,\n    \"StructMemberAlignment\",\n    _Enumeration(\n        [\n            \"Default\",\n            \"1Byte\",  # /Zp1\n            \"2Bytes\",  # /Zp2\n            \"4Bytes\",  # /Zp4\n            \"8Bytes\",  # /Zp8\n            \"16Bytes\",\n        ]\n    ),\n)  # /Zp16\n_Same(\n    _compile,\n    \"WarningLevel\",\n    _Enumeration(\n        [\n            \"TurnOffAllWarnings\",  # /W0\n            \"Level1\",  # /W1\n            \"Level2\",  # /W2\n            \"Level3\",  # /W3\n            \"Level4\",\n        ],  # /W4\n        new=[\"EnableAllWarnings\"],\n    ),\n)  # /Wall\n\n# Options found in MSVS that have been renamed in MSBuild.\n_Renamed(\n    _compile, \"EnableFunctionLevelLinking\", \"FunctionLevelLinking\", _boolean\n)  # /Gy\n_Renamed(_compile, \"EnableIntrinsicFunctions\", \"IntrinsicFunctions\", _boolean)  # /Oi\n_Renamed(_compile, \"KeepComments\", \"PreprocessKeepComments\", _boolean)  # /C\n_Renamed(_compile, \"ObjectFile\", \"ObjectFileName\", _file_name)  # /Fo\n_Renamed(_compile, \"OpenMP\", \"OpenMPSupport\", _boolean)  # /openmp\n_Renamed(\n    _compile, \"PrecompiledHeaderThrough\", \"PrecompiledHeaderFile\", _file_name\n)  # Used with /Yc and /Yu\n_Renamed(\n    _compile, \"PrecompiledHeaderFile\", \"PrecompiledHeaderOutputFile\", _file_name\n)  # /Fp\n_Renamed(\n    _compile,\n    \"UsePrecompiledHeader\",\n    \"PrecompiledHeader\",\n    _Enumeration(\n        [\"NotUsing\", \"Create\", \"Use\"]  # VS recognized '' for this value too.  # /Yc\n    ),\n)  # /Yu\n_Renamed(_compile, \"WarnAsError\", \"TreatWarningAsError\", _boolean)  # /WX\n\n_ConvertedToAdditionalOption(_compile, \"DefaultCharIsUnsigned\", \"/J\")\n\n# MSVS options not found in MSBuild.\n_MSVSOnly(_compile, \"Detect64BitPortabilityProblems\", _boolean)\n_MSVSOnly(_compile, \"UseUnicodeResponseFiles\", _boolean)\n\n# MSBuild options not found in MSVS.\n_MSBuildOnly(_compile, \"BuildingInIDE\", _boolean)\n_MSBuildOnly(\n    _compile, \"CompileAsManaged\", _Enumeration([], new=[\"false\", \"true\"])\n)  # /clr\n_MSBuildOnly(_compile, \"CreateHotpatchableImage\", _boolean)  # /hotpatch\n_MSBuildOnly(_compile, \"LanguageStandard\", _string)\n_MSBuildOnly(_compile, \"LanguageStandard_C\", _string)\n_MSBuildOnly(_compile, \"MultiProcessorCompilation\", _boolean)  # /MP\n_MSBuildOnly(_compile, \"PreprocessOutputPath\", _string)  # /Fi\n_MSBuildOnly(_compile, \"ProcessorNumber\", _integer)  # the number of processors\n_MSBuildOnly(_compile, \"TrackerLogDirectory\", _folder_name)\n_MSBuildOnly(_compile, \"TreatSpecificWarningsAsErrors\", _string_list)  # /we\n_MSBuildOnly(_compile, \"UseUnicodeForAssemblerListing\", _boolean)  # /FAu\n\n# Defines a setting that needs very customized processing\n_CustomGeneratePreprocessedFile(_compile, \"GeneratePreprocessedFile\")\n\n\n# Directives for converting MSVS VCLinkerTool to MSBuild Link.\n# See \"c:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\1033\\link.xml\" for\n# the schema of the MSBuild Link settings.\n\n# Options that have the same name in MSVS and MSBuild\n_Same(_link, \"AdditionalDependencies\", _file_list)\n_Same(_link, \"AdditionalLibraryDirectories\", _folder_list)  # /LIBPATH\n#  /MANIFESTDEPENDENCY:\n_Same(_link, \"AdditionalManifestDependencies\", _file_list)\n_Same(_link, \"AdditionalOptions\", _string_list)\n_Same(_link, \"AddModuleNamesToAssembly\", _file_list)  # /ASSEMBLYMODULE\n_Same(_link, \"AllowIsolation\", _boolean)  # /ALLOWISOLATION\n_Same(_link, \"AssemblyLinkResource\", _file_list)  # /ASSEMBLYLINKRESOURCE\n_Same(_link, \"BaseAddress\", _string)  # /BASE\n_Same(_link, \"CLRUnmanagedCodeCheck\", _boolean)  # /CLRUNMANAGEDCODECHECK\n_Same(_link, \"DelayLoadDLLs\", _file_list)  # /DELAYLOAD\n_Same(_link, \"DelaySign\", _boolean)  # /DELAYSIGN\n_Same(_link, \"EmbedManagedResourceFile\", _file_list)  # /ASSEMBLYRESOURCE\n_Same(_link, \"EnableUAC\", _boolean)  # /MANIFESTUAC\n_Same(_link, \"EntryPointSymbol\", _string)  # /ENTRY\n_Same(_link, \"ForceSymbolReferences\", _file_list)  # /INCLUDE\n_Same(_link, \"FunctionOrder\", _file_name)  # /ORDER\n_Same(_link, \"GenerateDebugInformation\", _boolean)  # /DEBUG\n_Same(_link, \"GenerateMapFile\", _boolean)  # /MAP\n_Same(_link, \"HeapCommitSize\", _string)\n_Same(_link, \"HeapReserveSize\", _string)  # /HEAP\n_Same(_link, \"IgnoreAllDefaultLibraries\", _boolean)  # /NODEFAULTLIB\n_Same(_link, \"IgnoreEmbeddedIDL\", _boolean)  # /IGNOREIDL\n_Same(_link, \"ImportLibrary\", _file_name)  # /IMPLIB\n_Same(_link, \"KeyContainer\", _file_name)  # /KEYCONTAINER\n_Same(_link, \"KeyFile\", _file_name)  # /KEYFILE\n_Same(_link, \"ManifestFile\", _file_name)  # /ManifestFile\n_Same(_link, \"MapExports\", _boolean)  # /MAPINFO:EXPORTS\n_Same(_link, \"MapFileName\", _file_name)\n_Same(_link, \"MergedIDLBaseFileName\", _file_name)  # /IDLOUT\n_Same(_link, \"MergeSections\", _string)  # /MERGE\n_Same(_link, \"MidlCommandFile\", _file_name)  # /MIDL\n_Same(_link, \"ModuleDefinitionFile\", _file_name)  # /DEF\n_Same(_link, \"OutputFile\", _file_name)  # /OUT\n_Same(_link, \"PerUserRedirection\", _boolean)\n_Same(_link, \"Profile\", _boolean)  # /PROFILE\n_Same(_link, \"ProfileGuidedDatabase\", _file_name)  # /PGD\n_Same(_link, \"ProgramDatabaseFile\", _file_name)  # /PDB\n_Same(_link, \"RegisterOutput\", _boolean)\n_Same(_link, \"SetChecksum\", _boolean)  # /RELEASE\n_Same(_link, \"StackCommitSize\", _string)\n_Same(_link, \"StackReserveSize\", _string)  # /STACK\n_Same(_link, \"StripPrivateSymbols\", _file_name)  # /PDBSTRIPPED\n_Same(_link, \"SupportUnloadOfDelayLoadedDLL\", _boolean)  # /DELAY:UNLOAD\n_Same(_link, \"SuppressStartupBanner\", _boolean)  # /NOLOGO\n_Same(_link, \"SwapRunFromCD\", _boolean)  # /SWAPRUN:CD\n_Same(_link, \"TurnOffAssemblyGeneration\", _boolean)  # /NOASSEMBLY\n_Same(_link, \"TypeLibraryFile\", _file_name)  # /TLBOUT\n_Same(_link, \"TypeLibraryResourceID\", _integer)  # /TLBID\n_Same(_link, \"UACUIAccess\", _boolean)  # /uiAccess='true'\n_Same(_link, \"Version\", _string)  # /VERSION\n\n_Same(_link, \"EnableCOMDATFolding\", _newly_boolean)  # /OPT:ICF\n_Same(_link, \"FixedBaseAddress\", _newly_boolean)  # /FIXED\n_Same(_link, \"LargeAddressAware\", _newly_boolean)  # /LARGEADDRESSAWARE\n_Same(_link, \"OptimizeReferences\", _newly_boolean)  # /OPT:REF\n_Same(_link, \"RandomizedBaseAddress\", _newly_boolean)  # /DYNAMICBASE\n_Same(_link, \"TerminalServerAware\", _newly_boolean)  # /TSAWARE\n\n_subsystem_enumeration = _Enumeration(\n    [\n        \"NotSet\",\n        \"Console\",  # /SUBSYSTEM:CONSOLE\n        \"Windows\",  # /SUBSYSTEM:WINDOWS\n        \"Native\",  # /SUBSYSTEM:NATIVE\n        \"EFI Application\",  # /SUBSYSTEM:EFI_APPLICATION\n        \"EFI Boot Service Driver\",  # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER\n        \"EFI ROM\",  # /SUBSYSTEM:EFI_ROM\n        \"EFI Runtime\",  # /SUBSYSTEM:EFI_RUNTIME_DRIVER\n        \"WindowsCE\",\n    ],  # /SUBSYSTEM:WINDOWSCE\n    new=[\"POSIX\"],\n)  # /SUBSYSTEM:POSIX\n\n_target_machine_enumeration = _Enumeration(\n    [\n        \"NotSet\",\n        \"MachineX86\",  # /MACHINE:X86\n        None,\n        \"MachineARM\",  # /MACHINE:ARM\n        \"MachineEBC\",  # /MACHINE:EBC\n        \"MachineIA64\",  # /MACHINE:IA64\n        None,\n        \"MachineMIPS\",  # /MACHINE:MIPS\n        \"MachineMIPS16\",  # /MACHINE:MIPS16\n        \"MachineMIPSFPU\",  # /MACHINE:MIPSFPU\n        \"MachineMIPSFPU16\",  # /MACHINE:MIPSFPU16\n        None,\n        None,\n        None,\n        \"MachineSH4\",  # /MACHINE:SH4\n        None,\n        \"MachineTHUMB\",  # /MACHINE:THUMB\n        \"MachineX64\",\n    ]\n)  # /MACHINE:X64\n\n_Same(\n    _link,\n    \"AssemblyDebug\",\n    _Enumeration([\"\", \"true\", \"false\"]),  # /ASSEMBLYDEBUG\n)  # /ASSEMBLYDEBUG:DISABLE\n_Same(\n    _link,\n    \"CLRImageType\",\n    _Enumeration(\n        [\n            \"Default\",\n            \"ForceIJWImage\",  # /CLRIMAGETYPE:IJW\n            \"ForcePureILImage\",  # /Switch=\"CLRIMAGETYPE:PURE\n            \"ForceSafeILImage\",\n        ]\n    ),\n)  # /Switch=\"CLRIMAGETYPE:SAFE\n_Same(\n    _link,\n    \"CLRThreadAttribute\",\n    _Enumeration(\n        [\n            \"DefaultThreadingAttribute\",  # /CLRTHREADATTRIBUTE:NONE\n            \"MTAThreadingAttribute\",  # /CLRTHREADATTRIBUTE:MTA\n            \"STAThreadingAttribute\",\n        ]\n    ),\n)  # /CLRTHREADATTRIBUTE:STA\n_Same(\n    _link,\n    \"DataExecutionPrevention\",\n    _Enumeration([\"\", \"false\", \"true\"]),  # /NXCOMPAT:NO\n)  # /NXCOMPAT\n_Same(\n    _link,\n    \"Driver\",\n    _Enumeration([\"NotSet\", \"Driver\", \"UpOnly\", \"WDM\"]),  # /Driver  # /DRIVER:UPONLY\n)  # /DRIVER:WDM\n_Same(\n    _link,\n    \"LinkTimeCodeGeneration\",\n    _Enumeration(\n        [\n            \"Default\",\n            \"UseLinkTimeCodeGeneration\",  # /LTCG\n            \"PGInstrument\",  # /LTCG:PGInstrument\n            \"PGOptimization\",  # /LTCG:PGOptimize\n            \"PGUpdate\",\n        ]\n    ),\n)  # /LTCG:PGUpdate\n_Same(\n    _link,\n    \"ShowProgress\",\n    _Enumeration(\n        [\"NotSet\", \"LinkVerbose\", \"LinkVerboseLib\"],  # /VERBOSE  # /VERBOSE:Lib\n        new=[\n            \"LinkVerboseICF\",  # /VERBOSE:ICF\n            \"LinkVerboseREF\",  # /VERBOSE:REF\n            \"LinkVerboseSAFESEH\",  # /VERBOSE:SAFESEH\n            \"LinkVerboseCLR\",\n        ],\n    ),\n)  # /VERBOSE:CLR\n_Same(_link, \"SubSystem\", _subsystem_enumeration)\n_Same(_link, \"TargetMachine\", _target_machine_enumeration)\n_Same(\n    _link,\n    \"UACExecutionLevel\",\n    _Enumeration(\n        [\n            \"AsInvoker\",  # /level='asInvoker'\n            \"HighestAvailable\",  # /level='highestAvailable'\n            \"RequireAdministrator\",\n        ]\n    ),\n)  # /level='requireAdministrator'\n_Same(_link, \"MinimumRequiredVersion\", _string)\n_Same(_link, \"TreatLinkerWarningAsErrors\", _boolean)  # /WX\n\n\n# Options found in MSVS that have been renamed in MSBuild.\n_Renamed(\n    _link,\n    \"ErrorReporting\",\n    \"LinkErrorReporting\",\n    _Enumeration(\n        [\n            \"NoErrorReport\",  # /ERRORREPORT:NONE\n            \"PromptImmediately\",  # /ERRORREPORT:PROMPT\n            \"QueueForNextLogin\",\n        ],  # /ERRORREPORT:QUEUE\n        new=[\"SendErrorReport\"],\n    ),\n)  # /ERRORREPORT:SEND\n_Renamed(\n    _link, \"IgnoreDefaultLibraryNames\", \"IgnoreSpecificDefaultLibraries\", _file_list\n)  # /NODEFAULTLIB\n_Renamed(_link, \"ResourceOnlyDLL\", \"NoEntryPoint\", _boolean)  # /NOENTRY\n_Renamed(_link, \"SwapRunFromNet\", \"SwapRunFromNET\", _boolean)  # /SWAPRUN:NET\n\n_Moved(_link, \"GenerateManifest\", \"\", _boolean)\n_Moved(_link, \"IgnoreImportLibrary\", \"\", _boolean)\n_Moved(_link, \"LinkIncremental\", \"\", _newly_boolean)\n_Moved(_link, \"LinkLibraryDependencies\", \"ProjectReference\", _boolean)\n_Moved(_link, \"UseLibraryDependencyInputs\", \"ProjectReference\", _boolean)\n\n# MSVS options not found in MSBuild.\n_MSVSOnly(_link, \"OptimizeForWindows98\", _newly_boolean)\n_MSVSOnly(_link, \"UseUnicodeResponseFiles\", _boolean)\n\n# MSBuild options not found in MSVS.\n_MSBuildOnly(_link, \"BuildingInIDE\", _boolean)\n_MSBuildOnly(_link, \"ImageHasSafeExceptionHandlers\", _boolean)  # /SAFESEH\n_MSBuildOnly(_link, \"LinkDLL\", _boolean)  # /DLL Visible='false'\n_MSBuildOnly(_link, \"LinkStatus\", _boolean)  # /LTCG:STATUS\n_MSBuildOnly(_link, \"PreventDllBinding\", _boolean)  # /ALLOWBIND\n_MSBuildOnly(_link, \"SupportNobindOfDelayLoadedDLL\", _boolean)  # /DELAY:NOBIND\n_MSBuildOnly(_link, \"TrackerLogDirectory\", _folder_name)\n_MSBuildOnly(_link, \"MSDOSStubFileName\", _file_name)  # /STUB Visible='false'\n_MSBuildOnly(_link, \"SectionAlignment\", _integer)  # /ALIGN\n_MSBuildOnly(_link, \"SpecifySectionAttributes\", _string)  # /SECTION\n_MSBuildOnly(\n    _link,\n    \"ForceFileOutput\",\n    _Enumeration(\n        [],\n        new=[\n            \"Enabled\",  # /FORCE\n            # /FORCE:MULTIPLE\n            \"MultiplyDefinedSymbolOnly\",\n            \"UndefinedSymbolOnly\",\n        ],\n    ),\n)  # /FORCE:UNRESOLVED\n_MSBuildOnly(\n    _link,\n    \"CreateHotPatchableImage\",\n    _Enumeration(\n        [],\n        new=[\n            \"Enabled\",  # /FUNCTIONPADMIN\n            \"X86Image\",  # /FUNCTIONPADMIN:5\n            \"X64Image\",  # /FUNCTIONPADMIN:6\n            \"ItaniumImage\",\n        ],\n    ),\n)  # /FUNCTIONPADMIN:16\n_MSBuildOnly(\n    _link,\n    \"CLRSupportLastError\",\n    _Enumeration(\n        [],\n        new=[\n            \"Enabled\",  # /CLRSupportLastError\n            \"Disabled\",  # /CLRSupportLastError:NO\n            # /CLRSupportLastError:SYSTEMDLL\n            \"SystemDlls\",\n        ],\n    ),\n)\n\n\n# Directives for converting VCResourceCompilerTool to ResourceCompile.\n# See \"c:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\1033\\rc.xml\" for\n# the schema of the MSBuild ResourceCompile settings.\n\n_Same(_rc, \"AdditionalOptions\", _string_list)\n_Same(_rc, \"AdditionalIncludeDirectories\", _folder_list)  # /I\n_Same(_rc, \"Culture\", _Integer(msbuild_base=16))\n_Same(_rc, \"IgnoreStandardIncludePath\", _boolean)  # /X\n_Same(_rc, \"PreprocessorDefinitions\", _string_list)  # /D\n_Same(_rc, \"ResourceOutputFileName\", _string)  # /fo\n_Same(_rc, \"ShowProgress\", _boolean)  # /v\n# There is no UI in VisualStudio 2008 to set the following properties.\n# However they are found in CL and other tools.  Include them here for\n# completeness, as they are very likely to have the same usage pattern.\n_Same(_rc, \"SuppressStartupBanner\", _boolean)  # /nologo\n_Same(_rc, \"UndefinePreprocessorDefinitions\", _string_list)  # /u\n\n# MSBuild options not found in MSVS.\n_MSBuildOnly(_rc, \"NullTerminateStrings\", _boolean)  # /n\n_MSBuildOnly(_rc, \"TrackerLogDirectory\", _folder_name)\n\n\n# Directives for converting VCMIDLTool to Midl.\n# See \"c:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\1033\\midl.xml\" for\n# the schema of the MSBuild Midl settings.\n\n_Same(_midl, \"AdditionalIncludeDirectories\", _folder_list)  # /I\n_Same(_midl, \"AdditionalOptions\", _string_list)\n_Same(_midl, \"CPreprocessOptions\", _string)  # /cpp_opt\n_Same(_midl, \"ErrorCheckAllocations\", _boolean)  # /error allocation\n_Same(_midl, \"ErrorCheckBounds\", _boolean)  # /error bounds_check\n_Same(_midl, \"ErrorCheckEnumRange\", _boolean)  # /error enum\n_Same(_midl, \"ErrorCheckRefPointers\", _boolean)  # /error ref\n_Same(_midl, \"ErrorCheckStubData\", _boolean)  # /error stub_data\n_Same(_midl, \"GenerateStublessProxies\", _boolean)  # /Oicf\n_Same(_midl, \"GenerateTypeLibrary\", _boolean)\n_Same(_midl, \"HeaderFileName\", _file_name)  # /h\n_Same(_midl, \"IgnoreStandardIncludePath\", _boolean)  # /no_def_idir\n_Same(_midl, \"InterfaceIdentifierFileName\", _file_name)  # /iid\n_Same(_midl, \"MkTypLibCompatible\", _boolean)  # /mktyplib203\n_Same(_midl, \"OutputDirectory\", _string)  # /out\n_Same(_midl, \"PreprocessorDefinitions\", _string_list)  # /D\n_Same(_midl, \"ProxyFileName\", _file_name)  # /proxy\n_Same(_midl, \"RedirectOutputAndErrors\", _file_name)  # /o\n_Same(_midl, \"SuppressStartupBanner\", _boolean)  # /nologo\n_Same(_midl, \"TypeLibraryName\", _file_name)  # /tlb\n_Same(_midl, \"UndefinePreprocessorDefinitions\", _string_list)  # /U\n_Same(_midl, \"WarnAsError\", _boolean)  # /WX\n\n_Same(\n    _midl,\n    \"DefaultCharType\",\n    _Enumeration([\"Unsigned\", \"Signed\", \"Ascii\"]),  # /char unsigned  # /char signed\n)  # /char ascii7\n_Same(\n    _midl,\n    \"TargetEnvironment\",\n    _Enumeration(\n        [\n            \"NotSet\",\n            \"Win32\",  # /env win32\n            \"Itanium\",  # /env ia64\n            \"X64\",  # /env x64\n            \"ARM64\",  # /env arm64\n        ]\n    ),\n)\n_Same(\n    _midl,\n    \"EnableErrorChecks\",\n    _Enumeration([\"EnableCustom\", \"None\", \"All\"]),  # /error none\n)  # /error all\n_Same(\n    _midl,\n    \"StructMemberAlignment\",\n    _Enumeration([\"NotSet\", \"1\", \"2\", \"4\", \"8\"]),  # Zp1  # Zp2  # Zp4\n)  # Zp8\n_Same(\n    _midl,\n    \"WarningLevel\",\n    _Enumeration([\"0\", \"1\", \"2\", \"3\", \"4\"]),  # /W0  # /W1  # /W2  # /W3\n)  # /W4\n\n_Renamed(_midl, \"DLLDataFileName\", \"DllDataFileName\", _file_name)  # /dlldata\n_Renamed(_midl, \"ValidateParameters\", \"ValidateAllParameters\", _boolean)  # /robust\n\n# MSBuild options not found in MSVS.\n_MSBuildOnly(_midl, \"ApplicationConfigurationMode\", _boolean)  # /app_config\n_MSBuildOnly(_midl, \"ClientStubFile\", _file_name)  # /cstub\n_MSBuildOnly(\n    _midl,\n    \"GenerateClientFiles\",\n    _Enumeration([], new=[\"Stub\", \"None\"]),  # /client stub\n)  # /client none\n_MSBuildOnly(\n    _midl,\n    \"GenerateServerFiles\",\n    _Enumeration([], new=[\"Stub\", \"None\"]),  # /client stub\n)  # /client none\n_MSBuildOnly(_midl, \"LocaleID\", _integer)  # /lcid DECIMAL\n_MSBuildOnly(_midl, \"ServerStubFile\", _file_name)  # /sstub\n_MSBuildOnly(_midl, \"SuppressCompilerWarnings\", _boolean)  # /no_warn\n_MSBuildOnly(_midl, \"TrackerLogDirectory\", _folder_name)\n_MSBuildOnly(\n    _midl,\n    \"TypeLibFormat\",\n    _Enumeration([], new=[\"NewFormat\", \"OldFormat\"]),  # /newtlb\n)  # /oldtlb\n\n\n# Directives for converting VCLibrarianTool to Lib.\n# See \"c:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\1033\\lib.xml\" for\n# the schema of the MSBuild Lib settings.\n\n_Same(_lib, \"AdditionalDependencies\", _file_list)\n_Same(_lib, \"AdditionalLibraryDirectories\", _folder_list)  # /LIBPATH\n_Same(_lib, \"AdditionalOptions\", _string_list)\n_Same(_lib, \"ExportNamedFunctions\", _string_list)  # /EXPORT\n_Same(_lib, \"ForceSymbolReferences\", _string)  # /INCLUDE\n_Same(_lib, \"IgnoreAllDefaultLibraries\", _boolean)  # /NODEFAULTLIB\n_Same(_lib, \"IgnoreSpecificDefaultLibraries\", _file_list)  # /NODEFAULTLIB\n_Same(_lib, \"ModuleDefinitionFile\", _file_name)  # /DEF\n_Same(_lib, \"OutputFile\", _file_name)  # /OUT\n_Same(_lib, \"SuppressStartupBanner\", _boolean)  # /NOLOGO\n_Same(_lib, \"UseUnicodeResponseFiles\", _boolean)\n_Same(_lib, \"LinkTimeCodeGeneration\", _boolean)  # /LTCG\n_Same(_lib, \"TargetMachine\", _target_machine_enumeration)\n\n# TODO(jeanluc) _link defines the same value that gets moved to\n# ProjectReference.  We may want to validate that they are consistent.\n_Moved(_lib, \"LinkLibraryDependencies\", \"ProjectReference\", _boolean)\n\n_MSBuildOnly(_lib, \"DisplayLibrary\", _string)  # /LIST Visible='false'\n_MSBuildOnly(\n    _lib,\n    \"ErrorReporting\",\n    _Enumeration(\n        [],\n        new=[\n            \"PromptImmediately\",  # /ERRORREPORT:PROMPT\n            \"QueueForNextLogin\",  # /ERRORREPORT:QUEUE\n            \"SendErrorReport\",  # /ERRORREPORT:SEND\n            \"NoErrorReport\",\n        ],\n    ),\n)  # /ERRORREPORT:NONE\n_MSBuildOnly(_lib, \"MinimumRequiredVersion\", _string)\n_MSBuildOnly(_lib, \"Name\", _file_name)  # /NAME\n_MSBuildOnly(_lib, \"RemoveObjects\", _file_list)  # /REMOVE\n_MSBuildOnly(_lib, \"SubSystem\", _subsystem_enumeration)\n_MSBuildOnly(_lib, \"TrackerLogDirectory\", _folder_name)\n_MSBuildOnly(_lib, \"TreatLibWarningAsErrors\", _boolean)  # /WX\n_MSBuildOnly(_lib, \"Verbose\", _boolean)\n\n\n# Directives for converting VCManifestTool to Mt.\n# See \"c:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\1033\\mt.xml\" for\n# the schema of the MSBuild Lib settings.\n\n# Options that have the same name in MSVS and MSBuild\n_Same(_manifest, \"AdditionalManifestFiles\", _file_list)  # /manifest\n_Same(_manifest, \"AdditionalOptions\", _string_list)\n_Same(_manifest, \"AssemblyIdentity\", _string)  # /identity:\n_Same(_manifest, \"ComponentFileName\", _file_name)  # /dll\n_Same(_manifest, \"GenerateCatalogFiles\", _boolean)  # /makecdfs\n_Same(_manifest, \"InputResourceManifests\", _string)  # /inputresource\n_Same(_manifest, \"OutputManifestFile\", _file_name)  # /out\n_Same(_manifest, \"RegistrarScriptFile\", _file_name)  # /rgs\n_Same(_manifest, \"ReplacementsFile\", _file_name)  # /replacements\n_Same(_manifest, \"SuppressStartupBanner\", _boolean)  # /nologo\n_Same(_manifest, \"TypeLibraryFile\", _file_name)  # /tlb:\n_Same(_manifest, \"UpdateFileHashes\", _boolean)  # /hashupdate\n_Same(_manifest, \"UpdateFileHashesSearchPath\", _file_name)\n_Same(_manifest, \"VerboseOutput\", _boolean)  # /verbose\n\n# Options that have moved location.\n_MovedAndRenamed(\n    _manifest,\n    \"ManifestResourceFile\",\n    \"ManifestResourceCompile\",\n    \"ResourceOutputFileName\",\n    _file_name,\n)\n_Moved(_manifest, \"EmbedManifest\", \"\", _boolean)\n\n# MSVS options not found in MSBuild.\n_MSVSOnly(_manifest, \"DependencyInformationFile\", _file_name)\n_MSVSOnly(_manifest, \"UseFAT32Workaround\", _boolean)\n_MSVSOnly(_manifest, \"UseUnicodeResponseFiles\", _boolean)\n\n# MSBuild options not found in MSVS.\n_MSBuildOnly(_manifest, \"EnableDPIAwareness\", _boolean)\n_MSBuildOnly(_manifest, \"GenerateCategoryTags\", _boolean)  # /category\n_MSBuildOnly(\n    _manifest, \"ManifestFromManagedAssembly\", _file_name\n)  # /managedassemblyname\n_MSBuildOnly(_manifest, \"OutputResourceManifests\", _string)  # /outputresource\n_MSBuildOnly(_manifest, \"SuppressDependencyElement\", _boolean)  # /nodependency\n_MSBuildOnly(_manifest, \"TrackerLogDirectory\", _folder_name)\n\n\n# Directives for MASM.\n# See \"$(VCTargetsPath)\\BuildCustomizations\\masm.xml\" for the schema of the\n# MSBuild MASM settings.\n\n# Options that have the same name in MSVS and MSBuild.\n_Same(_masm, \"UseSafeExceptionHandlers\", _boolean)  # /safeseh\n"
  },
  {
    "path": "gyp/pylib/gyp/MSVSSettings_test.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Unit tests for the MSVSSettings.py file.\"\"\"\n\nimport unittest\nfrom io import StringIO\n\nfrom gyp import MSVSSettings\n\n\nclass TestSequenceFunctions(unittest.TestCase):\n    def setUp(self):\n        self.stderr = StringIO()\n\n    def _ExpectedWarnings(self, expected):\n        \"\"\"Compares recorded lines to expected warnings.\"\"\"\n        self.stderr.seek(0)\n        actual = self.stderr.read().split(\"\\n\")\n        actual = [line for line in actual if line]\n        self.assertEqual(sorted(expected), sorted(actual))\n\n    def testValidateMSVSSettings_tool_names(self):\n        \"\"\"Tests that only MSVS tool names are allowed.\"\"\"\n        MSVSSettings.ValidateMSVSSettings(\n            {\n                \"VCCLCompilerTool\": {},\n                \"VCLinkerTool\": {},\n                \"VCMIDLTool\": {},\n                \"foo\": {},\n                \"VCResourceCompilerTool\": {},\n                \"VCLibrarianTool\": {},\n                \"VCManifestTool\": {},\n                \"ClCompile\": {},\n            },\n            self.stderr,\n        )\n        self._ExpectedWarnings(\n            [\"Warning: unrecognized tool foo\", \"Warning: unrecognized tool ClCompile\"]\n        )\n\n    def testValidateMSVSSettings_settings(self):\n        \"\"\"Tests that for invalid MSVS settings.\"\"\"\n        MSVSSettings.ValidateMSVSSettings(\n            {\n                \"VCCLCompilerTool\": {\n                    \"AdditionalIncludeDirectories\": \"folder1;folder2\",\n                    \"AdditionalOptions\": [\"string1\", \"string2\"],\n                    \"AdditionalUsingDirectories\": \"folder1;folder2\",\n                    \"AssemblerListingLocation\": \"a_file_name\",\n                    \"AssemblerOutput\": \"0\",\n                    \"BasicRuntimeChecks\": \"5\",\n                    \"BrowseInformation\": \"fdkslj\",\n                    \"BrowseInformationFile\": \"a_file_name\",\n                    \"BufferSecurityCheck\": \"true\",\n                    \"CallingConvention\": \"-1\",\n                    \"CompileAs\": \"1\",\n                    \"DebugInformationFormat\": \"2\",\n                    \"DefaultCharIsUnsigned\": \"true\",\n                    \"Detect64BitPortabilityProblems\": \"true\",\n                    \"DisableLanguageExtensions\": \"true\",\n                    \"DisableSpecificWarnings\": \"string1;string2\",\n                    \"EnableEnhancedInstructionSet\": \"1\",\n                    \"EnableFiberSafeOptimizations\": \"true\",\n                    \"EnableFunctionLevelLinking\": \"true\",\n                    \"EnableIntrinsicFunctions\": \"true\",\n                    \"EnablePREfast\": \"true\",\n                    \"Enableprefast\": \"bogus\",\n                    \"ErrorReporting\": \"1\",\n                    \"ExceptionHandling\": \"1\",\n                    \"ExpandAttributedSource\": \"true\",\n                    \"FavorSizeOrSpeed\": \"1\",\n                    \"FloatingPointExceptions\": \"true\",\n                    \"FloatingPointModel\": \"1\",\n                    \"ForceConformanceInForLoopScope\": \"true\",\n                    \"ForcedIncludeFiles\": \"file1;file2\",\n                    \"ForcedUsingFiles\": \"file1;file2\",\n                    \"GeneratePreprocessedFile\": \"1\",\n                    \"GenerateXMLDocumentationFiles\": \"true\",\n                    \"IgnoreStandardIncludePath\": \"true\",\n                    \"InlineFunctionExpansion\": \"1\",\n                    \"KeepComments\": \"true\",\n                    \"MinimalRebuild\": \"true\",\n                    \"ObjectFile\": \"a_file_name\",\n                    \"OmitDefaultLibName\": \"true\",\n                    \"OmitFramePointers\": \"true\",\n                    \"OpenMP\": \"true\",\n                    \"Optimization\": \"1\",\n                    \"PrecompiledHeaderFile\": \"a_file_name\",\n                    \"PrecompiledHeaderThrough\": \"a_file_name\",\n                    \"PreprocessorDefinitions\": \"string1;string2\",\n                    \"ProgramDataBaseFileName\": \"a_file_name\",\n                    \"RuntimeLibrary\": \"1\",\n                    \"RuntimeTypeInfo\": \"true\",\n                    \"ShowIncludes\": \"true\",\n                    \"SmallerTypeCheck\": \"true\",\n                    \"StringPooling\": \"true\",\n                    \"StructMemberAlignment\": \"1\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"TreatWChar_tAsBuiltInType\": \"true\",\n                    \"UndefineAllPreprocessorDefinitions\": \"true\",\n                    \"UndefinePreprocessorDefinitions\": \"string1;string2\",\n                    \"UseFullPaths\": \"true\",\n                    \"UsePrecompiledHeader\": \"1\",\n                    \"UseUnicodeResponseFiles\": \"true\",\n                    \"WarnAsError\": \"true\",\n                    \"WarningLevel\": \"1\",\n                    \"WholeProgramOptimization\": \"true\",\n                    \"XMLDocumentationFileName\": \"a_file_name\",\n                    \"ZZXYZ\": \"bogus\",\n                },\n                \"VCLinkerTool\": {\n                    \"AdditionalDependencies\": \"file1;file2\",\n                    \"AdditionalDependencies_excluded\": \"file3\",\n                    \"AdditionalLibraryDirectories\": \"folder1;folder2\",\n                    \"AdditionalManifestDependencies\": \"file1;file2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"AddModuleNamesToAssembly\": \"file1;file2\",\n                    \"AllowIsolation\": \"true\",\n                    \"AssemblyDebug\": \"2\",\n                    \"AssemblyLinkResource\": \"file1;file2\",\n                    \"BaseAddress\": \"a string1\",\n                    \"CLRImageType\": \"2\",\n                    \"CLRThreadAttribute\": \"2\",\n                    \"CLRUnmanagedCodeCheck\": \"true\",\n                    \"DataExecutionPrevention\": \"2\",\n                    \"DelayLoadDLLs\": \"file1;file2\",\n                    \"DelaySign\": \"true\",\n                    \"Driver\": \"2\",\n                    \"EmbedManagedResourceFile\": \"file1;file2\",\n                    \"EnableCOMDATFolding\": \"2\",\n                    \"EnableUAC\": \"true\",\n                    \"EntryPointSymbol\": \"a string1\",\n                    \"ErrorReporting\": \"2\",\n                    \"FixedBaseAddress\": \"2\",\n                    \"ForceSymbolReferences\": \"file1;file2\",\n                    \"FunctionOrder\": \"a_file_name\",\n                    \"GenerateDebugInformation\": \"true\",\n                    \"GenerateManifest\": \"true\",\n                    \"GenerateMapFile\": \"true\",\n                    \"HeapCommitSize\": \"a string1\",\n                    \"HeapReserveSize\": \"a string1\",\n                    \"IgnoreAllDefaultLibraries\": \"true\",\n                    \"IgnoreDefaultLibraryNames\": \"file1;file2\",\n                    \"IgnoreEmbeddedIDL\": \"true\",\n                    \"IgnoreImportLibrary\": \"true\",\n                    \"ImportLibrary\": \"a_file_name\",\n                    \"KeyContainer\": \"a_file_name\",\n                    \"KeyFile\": \"a_file_name\",\n                    \"LargeAddressAware\": \"2\",\n                    \"LinkIncremental\": \"2\",\n                    \"LinkLibraryDependencies\": \"true\",\n                    \"LinkTimeCodeGeneration\": \"2\",\n                    \"ManifestFile\": \"a_file_name\",\n                    \"MapExports\": \"true\",\n                    \"MapFileName\": \"a_file_name\",\n                    \"MergedIDLBaseFileName\": \"a_file_name\",\n                    \"MergeSections\": \"a string1\",\n                    \"MidlCommandFile\": \"a_file_name\",\n                    \"ModuleDefinitionFile\": \"a_file_name\",\n                    \"OptimizeForWindows98\": \"1\",\n                    \"OptimizeReferences\": \"2\",\n                    \"OutputFile\": \"a_file_name\",\n                    \"PerUserRedirection\": \"true\",\n                    \"Profile\": \"true\",\n                    \"ProfileGuidedDatabase\": \"a_file_name\",\n                    \"ProgramDatabaseFile\": \"a_file_name\",\n                    \"RandomizedBaseAddress\": \"2\",\n                    \"RegisterOutput\": \"true\",\n                    \"ResourceOnlyDLL\": \"true\",\n                    \"SetChecksum\": \"true\",\n                    \"ShowProgress\": \"2\",\n                    \"StackCommitSize\": \"a string1\",\n                    \"StackReserveSize\": \"a string1\",\n                    \"StripPrivateSymbols\": \"a_file_name\",\n                    \"SubSystem\": \"2\",\n                    \"SupportUnloadOfDelayLoadedDLL\": \"true\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"SwapRunFromCD\": \"true\",\n                    \"SwapRunFromNet\": \"true\",\n                    \"TargetMachine\": \"2\",\n                    \"TerminalServerAware\": \"2\",\n                    \"TurnOffAssemblyGeneration\": \"true\",\n                    \"TypeLibraryFile\": \"a_file_name\",\n                    \"TypeLibraryResourceID\": \"33\",\n                    \"UACExecutionLevel\": \"2\",\n                    \"UACUIAccess\": \"true\",\n                    \"UseLibraryDependencyInputs\": \"true\",\n                    \"UseUnicodeResponseFiles\": \"true\",\n                    \"Version\": \"a string1\",\n                },\n                \"VCMIDLTool\": {\n                    \"AdditionalIncludeDirectories\": \"folder1;folder2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"CPreprocessOptions\": \"a string1\",\n                    \"DefaultCharType\": \"1\",\n                    \"DLLDataFileName\": \"a_file_name\",\n                    \"EnableErrorChecks\": \"1\",\n                    \"ErrorCheckAllocations\": \"true\",\n                    \"ErrorCheckBounds\": \"true\",\n                    \"ErrorCheckEnumRange\": \"true\",\n                    \"ErrorCheckRefPointers\": \"true\",\n                    \"ErrorCheckStubData\": \"true\",\n                    \"GenerateStublessProxies\": \"true\",\n                    \"GenerateTypeLibrary\": \"true\",\n                    \"HeaderFileName\": \"a_file_name\",\n                    \"IgnoreStandardIncludePath\": \"true\",\n                    \"InterfaceIdentifierFileName\": \"a_file_name\",\n                    \"MkTypLibCompatible\": \"true\",\n                    \"notgood\": \"bogus\",\n                    \"OutputDirectory\": \"a string1\",\n                    \"PreprocessorDefinitions\": \"string1;string2\",\n                    \"ProxyFileName\": \"a_file_name\",\n                    \"RedirectOutputAndErrors\": \"a_file_name\",\n                    \"StructMemberAlignment\": \"1\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"TargetEnvironment\": \"1\",\n                    \"TypeLibraryName\": \"a_file_name\",\n                    \"UndefinePreprocessorDefinitions\": \"string1;string2\",\n                    \"ValidateParameters\": \"true\",\n                    \"WarnAsError\": \"true\",\n                    \"WarningLevel\": \"1\",\n                },\n                \"VCResourceCompilerTool\": {\n                    \"AdditionalOptions\": \"a string1\",\n                    \"AdditionalIncludeDirectories\": \"folder1;folder2\",\n                    \"Culture\": \"1003\",\n                    \"IgnoreStandardIncludePath\": \"true\",\n                    \"notgood2\": \"bogus\",\n                    \"PreprocessorDefinitions\": \"string1;string2\",\n                    \"ResourceOutputFileName\": \"a string1\",\n                    \"ShowProgress\": \"true\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"UndefinePreprocessorDefinitions\": \"string1;string2\",\n                },\n                \"VCLibrarianTool\": {\n                    \"AdditionalDependencies\": \"file1;file2\",\n                    \"AdditionalLibraryDirectories\": \"folder1;folder2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"ExportNamedFunctions\": \"string1;string2\",\n                    \"ForceSymbolReferences\": \"a string1\",\n                    \"IgnoreAllDefaultLibraries\": \"true\",\n                    \"IgnoreSpecificDefaultLibraries\": \"file1;file2\",\n                    \"LinkLibraryDependencies\": \"true\",\n                    \"ModuleDefinitionFile\": \"a_file_name\",\n                    \"OutputFile\": \"a_file_name\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"UseUnicodeResponseFiles\": \"true\",\n                },\n                \"VCManifestTool\": {\n                    \"AdditionalManifestFiles\": \"file1;file2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"AssemblyIdentity\": \"a string1\",\n                    \"ComponentFileName\": \"a_file_name\",\n                    \"DependencyInformationFile\": \"a_file_name\",\n                    \"GenerateCatalogFiles\": \"true\",\n                    \"InputResourceManifests\": \"a string1\",\n                    \"ManifestResourceFile\": \"a_file_name\",\n                    \"OutputManifestFile\": \"a_file_name\",\n                    \"RegistrarScriptFile\": \"a_file_name\",\n                    \"ReplacementsFile\": \"a_file_name\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"TypeLibraryFile\": \"a_file_name\",\n                    \"UpdateFileHashes\": \"truel\",\n                    \"UpdateFileHashesSearchPath\": \"a_file_name\",\n                    \"UseFAT32Workaround\": \"true\",\n                    \"UseUnicodeResponseFiles\": \"true\",\n                    \"VerboseOutput\": \"true\",\n                },\n            },\n            self.stderr,\n        )\n        self._ExpectedWarnings(\n            [\n                \"Warning: for VCCLCompilerTool/BasicRuntimeChecks, \"\n                \"index value (5) not in expected range [0, 4)\",\n                \"Warning: for VCCLCompilerTool/BrowseInformation, \"\n                \"invalid literal for int() with base 10: 'fdkslj'\",\n                \"Warning: for VCCLCompilerTool/CallingConvention, \"\n                \"index value (-1) not in expected range [0, 4)\",\n                \"Warning: for VCCLCompilerTool/DebugInformationFormat, \"\n                \"converted value for 2 not specified.\",\n                \"Warning: unrecognized setting VCCLCompilerTool/Enableprefast\",\n                \"Warning: unrecognized setting VCCLCompilerTool/ZZXYZ\",\n                \"Warning: for VCLinkerTool/TargetMachine, \"\n                \"converted value for 2 not specified.\",\n                \"Warning: unrecognized setting VCMIDLTool/notgood\",\n                \"Warning: unrecognized setting VCResourceCompilerTool/notgood2\",\n                \"Warning: for VCManifestTool/UpdateFileHashes, \"\n                \"expected bool; got 'truel'\"\n                \"\",\n            ]\n        )\n\n    def testValidateMSBuildSettings_settings(self):\n        \"\"\"Tests that for invalid MSBuild settings.\"\"\"\n        MSVSSettings.ValidateMSBuildSettings(\n            {\n                \"ClCompile\": {\n                    \"AdditionalIncludeDirectories\": \"folder1;folder2\",\n                    \"AdditionalOptions\": [\"string1\", \"string2\"],\n                    \"AdditionalUsingDirectories\": \"folder1;folder2\",\n                    \"AssemblerListingLocation\": \"a_file_name\",\n                    \"AssemblerOutput\": \"NoListing\",\n                    \"BasicRuntimeChecks\": \"StackFrameRuntimeCheck\",\n                    \"BrowseInformation\": \"false\",\n                    \"BrowseInformationFile\": \"a_file_name\",\n                    \"BufferSecurityCheck\": \"true\",\n                    \"BuildingInIDE\": \"true\",\n                    \"CallingConvention\": \"Cdecl\",\n                    \"CompileAs\": \"CompileAsC\",\n                    \"CompileAsManaged\": \"true\",\n                    \"CreateHotpatchableImage\": \"true\",\n                    \"DebugInformationFormat\": \"ProgramDatabase\",\n                    \"DisableLanguageExtensions\": \"true\",\n                    \"DisableSpecificWarnings\": \"string1;string2\",\n                    \"EnableEnhancedInstructionSet\": \"StreamingSIMDExtensions\",\n                    \"EnableFiberSafeOptimizations\": \"true\",\n                    \"EnablePREfast\": \"true\",\n                    \"Enableprefast\": \"bogus\",\n                    \"ErrorReporting\": \"Prompt\",\n                    \"ExceptionHandling\": \"SyncCThrow\",\n                    \"ExpandAttributedSource\": \"true\",\n                    \"FavorSizeOrSpeed\": \"Neither\",\n                    \"FloatingPointExceptions\": \"true\",\n                    \"FloatingPointModel\": \"Precise\",\n                    \"ForceConformanceInForLoopScope\": \"true\",\n                    \"ForcedIncludeFiles\": \"file1;file2\",\n                    \"ForcedUsingFiles\": \"file1;file2\",\n                    \"FunctionLevelLinking\": \"false\",\n                    \"GenerateXMLDocumentationFiles\": \"true\",\n                    \"IgnoreStandardIncludePath\": \"true\",\n                    \"InlineFunctionExpansion\": \"OnlyExplicitInline\",\n                    \"IntrinsicFunctions\": \"false\",\n                    \"MinimalRebuild\": \"true\",\n                    \"MultiProcessorCompilation\": \"true\",\n                    \"ObjectFileName\": \"a_file_name\",\n                    \"OmitDefaultLibName\": \"true\",\n                    \"OmitFramePointers\": \"true\",\n                    \"OpenMPSupport\": \"true\",\n                    \"Optimization\": \"Disabled\",\n                    \"PrecompiledHeader\": \"NotUsing\",\n                    \"PrecompiledHeaderFile\": \"a_file_name\",\n                    \"PrecompiledHeaderOutputFile\": \"a_file_name\",\n                    \"PreprocessKeepComments\": \"true\",\n                    \"PreprocessorDefinitions\": \"string1;string2\",\n                    \"PreprocessOutputPath\": \"a string1\",\n                    \"PreprocessSuppressLineNumbers\": \"false\",\n                    \"PreprocessToFile\": \"false\",\n                    \"ProcessorNumber\": \"33\",\n                    \"ProgramDataBaseFileName\": \"a_file_name\",\n                    \"RuntimeLibrary\": \"MultiThreaded\",\n                    \"RuntimeTypeInfo\": \"true\",\n                    \"ShowIncludes\": \"true\",\n                    \"SmallerTypeCheck\": \"true\",\n                    \"StringPooling\": \"true\",\n                    \"StructMemberAlignment\": \"1Byte\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"TrackerLogDirectory\": \"a_folder\",\n                    \"TreatSpecificWarningsAsErrors\": \"string1;string2\",\n                    \"TreatWarningAsError\": \"true\",\n                    \"TreatWChar_tAsBuiltInType\": \"true\",\n                    \"UndefineAllPreprocessorDefinitions\": \"true\",\n                    \"UndefinePreprocessorDefinitions\": \"string1;string2\",\n                    \"UseFullPaths\": \"true\",\n                    \"UseUnicodeForAssemblerListing\": \"true\",\n                    \"WarningLevel\": \"TurnOffAllWarnings\",\n                    \"WholeProgramOptimization\": \"true\",\n                    \"XMLDocumentationFileName\": \"a_file_name\",\n                    \"ZZXYZ\": \"bogus\",\n                },\n                \"Link\": {\n                    \"AdditionalDependencies\": \"file1;file2\",\n                    \"AdditionalLibraryDirectories\": \"folder1;folder2\",\n                    \"AdditionalManifestDependencies\": \"file1;file2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"AddModuleNamesToAssembly\": \"file1;file2\",\n                    \"AllowIsolation\": \"true\",\n                    \"AssemblyDebug\": \"\",\n                    \"AssemblyLinkResource\": \"file1;file2\",\n                    \"BaseAddress\": \"a string1\",\n                    \"BuildingInIDE\": \"true\",\n                    \"CLRImageType\": \"ForceIJWImage\",\n                    \"CLRSupportLastError\": \"Enabled\",\n                    \"CLRThreadAttribute\": \"MTAThreadingAttribute\",\n                    \"CLRUnmanagedCodeCheck\": \"true\",\n                    \"CreateHotPatchableImage\": \"X86Image\",\n                    \"DataExecutionPrevention\": \"false\",\n                    \"DelayLoadDLLs\": \"file1;file2\",\n                    \"DelaySign\": \"true\",\n                    \"Driver\": \"NotSet\",\n                    \"EmbedManagedResourceFile\": \"file1;file2\",\n                    \"EnableCOMDATFolding\": \"false\",\n                    \"EnableUAC\": \"true\",\n                    \"EntryPointSymbol\": \"a string1\",\n                    \"FixedBaseAddress\": \"false\",\n                    \"ForceFileOutput\": \"Enabled\",\n                    \"ForceSymbolReferences\": \"file1;file2\",\n                    \"FunctionOrder\": \"a_file_name\",\n                    \"GenerateDebugInformation\": \"true\",\n                    \"GenerateMapFile\": \"true\",\n                    \"HeapCommitSize\": \"a string1\",\n                    \"HeapReserveSize\": \"a string1\",\n                    \"IgnoreAllDefaultLibraries\": \"true\",\n                    \"IgnoreEmbeddedIDL\": \"true\",\n                    \"IgnoreSpecificDefaultLibraries\": \"a_file_list\",\n                    \"ImageHasSafeExceptionHandlers\": \"true\",\n                    \"ImportLibrary\": \"a_file_name\",\n                    \"KeyContainer\": \"a_file_name\",\n                    \"KeyFile\": \"a_file_name\",\n                    \"LargeAddressAware\": \"false\",\n                    \"LinkDLL\": \"true\",\n                    \"LinkErrorReporting\": \"SendErrorReport\",\n                    \"LinkStatus\": \"true\",\n                    \"LinkTimeCodeGeneration\": \"UseLinkTimeCodeGeneration\",\n                    \"ManifestFile\": \"a_file_name\",\n                    \"MapExports\": \"true\",\n                    \"MapFileName\": \"a_file_name\",\n                    \"MergedIDLBaseFileName\": \"a_file_name\",\n                    \"MergeSections\": \"a string1\",\n                    \"MidlCommandFile\": \"a_file_name\",\n                    \"MinimumRequiredVersion\": \"a string1\",\n                    \"ModuleDefinitionFile\": \"a_file_name\",\n                    \"MSDOSStubFileName\": \"a_file_name\",\n                    \"NoEntryPoint\": \"true\",\n                    \"OptimizeReferences\": \"false\",\n                    \"OutputFile\": \"a_file_name\",\n                    \"PerUserRedirection\": \"true\",\n                    \"PreventDllBinding\": \"true\",\n                    \"Profile\": \"true\",\n                    \"ProfileGuidedDatabase\": \"a_file_name\",\n                    \"ProgramDatabaseFile\": \"a_file_name\",\n                    \"RandomizedBaseAddress\": \"false\",\n                    \"RegisterOutput\": \"true\",\n                    \"SectionAlignment\": \"33\",\n                    \"SetChecksum\": \"true\",\n                    \"ShowProgress\": \"LinkVerboseREF\",\n                    \"SpecifySectionAttributes\": \"a string1\",\n                    \"StackCommitSize\": \"a string1\",\n                    \"StackReserveSize\": \"a string1\",\n                    \"StripPrivateSymbols\": \"a_file_name\",\n                    \"SubSystem\": \"Console\",\n                    \"SupportNobindOfDelayLoadedDLL\": \"true\",\n                    \"SupportUnloadOfDelayLoadedDLL\": \"true\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"SwapRunFromCD\": \"true\",\n                    \"SwapRunFromNET\": \"true\",\n                    \"TargetMachine\": \"MachineX86\",\n                    \"TerminalServerAware\": \"false\",\n                    \"TrackerLogDirectory\": \"a_folder\",\n                    \"TreatLinkerWarningAsErrors\": \"true\",\n                    \"TurnOffAssemblyGeneration\": \"true\",\n                    \"TypeLibraryFile\": \"a_file_name\",\n                    \"TypeLibraryResourceID\": \"33\",\n                    \"UACExecutionLevel\": \"AsInvoker\",\n                    \"UACUIAccess\": \"true\",\n                    \"Version\": \"a string1\",\n                },\n                \"ResourceCompile\": {\n                    \"AdditionalIncludeDirectories\": \"folder1;folder2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"Culture\": \"0x236\",\n                    \"IgnoreStandardIncludePath\": \"true\",\n                    \"NullTerminateStrings\": \"true\",\n                    \"PreprocessorDefinitions\": \"string1;string2\",\n                    \"ResourceOutputFileName\": \"a string1\",\n                    \"ShowProgress\": \"true\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"TrackerLogDirectory\": \"a_folder\",\n                    \"UndefinePreprocessorDefinitions\": \"string1;string2\",\n                },\n                \"Midl\": {\n                    \"AdditionalIncludeDirectories\": \"folder1;folder2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"ApplicationConfigurationMode\": \"true\",\n                    \"ClientStubFile\": \"a_file_name\",\n                    \"CPreprocessOptions\": \"a string1\",\n                    \"DefaultCharType\": \"Signed\",\n                    \"DllDataFileName\": \"a_file_name\",\n                    \"EnableErrorChecks\": \"EnableCustom\",\n                    \"ErrorCheckAllocations\": \"true\",\n                    \"ErrorCheckBounds\": \"true\",\n                    \"ErrorCheckEnumRange\": \"true\",\n                    \"ErrorCheckRefPointers\": \"true\",\n                    \"ErrorCheckStubData\": \"true\",\n                    \"GenerateClientFiles\": \"Stub\",\n                    \"GenerateServerFiles\": \"None\",\n                    \"GenerateStublessProxies\": \"true\",\n                    \"GenerateTypeLibrary\": \"true\",\n                    \"HeaderFileName\": \"a_file_name\",\n                    \"IgnoreStandardIncludePath\": \"true\",\n                    \"InterfaceIdentifierFileName\": \"a_file_name\",\n                    \"LocaleID\": \"33\",\n                    \"MkTypLibCompatible\": \"true\",\n                    \"OutputDirectory\": \"a string1\",\n                    \"PreprocessorDefinitions\": \"string1;string2\",\n                    \"ProxyFileName\": \"a_file_name\",\n                    \"RedirectOutputAndErrors\": \"a_file_name\",\n                    \"ServerStubFile\": \"a_file_name\",\n                    \"StructMemberAlignment\": \"NotSet\",\n                    \"SuppressCompilerWarnings\": \"true\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"TargetEnvironment\": \"Itanium\",\n                    \"TrackerLogDirectory\": \"a_folder\",\n                    \"TypeLibFormat\": \"NewFormat\",\n                    \"TypeLibraryName\": \"a_file_name\",\n                    \"UndefinePreprocessorDefinitions\": \"string1;string2\",\n                    \"ValidateAllParameters\": \"true\",\n                    \"WarnAsError\": \"true\",\n                    \"WarningLevel\": \"1\",\n                },\n                \"Lib\": {\n                    \"AdditionalDependencies\": \"file1;file2\",\n                    \"AdditionalLibraryDirectories\": \"folder1;folder2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"DisplayLibrary\": \"a string1\",\n                    \"ErrorReporting\": \"PromptImmediately\",\n                    \"ExportNamedFunctions\": \"string1;string2\",\n                    \"ForceSymbolReferences\": \"a string1\",\n                    \"IgnoreAllDefaultLibraries\": \"true\",\n                    \"IgnoreSpecificDefaultLibraries\": \"file1;file2\",\n                    \"LinkTimeCodeGeneration\": \"true\",\n                    \"MinimumRequiredVersion\": \"a string1\",\n                    \"ModuleDefinitionFile\": \"a_file_name\",\n                    \"Name\": \"a_file_name\",\n                    \"OutputFile\": \"a_file_name\",\n                    \"RemoveObjects\": \"file1;file2\",\n                    \"SubSystem\": \"Console\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"TargetMachine\": \"MachineX86i\",\n                    \"TrackerLogDirectory\": \"a_folder\",\n                    \"TreatLibWarningAsErrors\": \"true\",\n                    \"UseUnicodeResponseFiles\": \"true\",\n                    \"Verbose\": \"true\",\n                },\n                \"Manifest\": {\n                    \"AdditionalManifestFiles\": \"file1;file2\",\n                    \"AdditionalOptions\": \"a string1\",\n                    \"AssemblyIdentity\": \"a string1\",\n                    \"ComponentFileName\": \"a_file_name\",\n                    \"EnableDPIAwareness\": \"fal\",\n                    \"GenerateCatalogFiles\": \"truel\",\n                    \"GenerateCategoryTags\": \"true\",\n                    \"InputResourceManifests\": \"a string1\",\n                    \"ManifestFromManagedAssembly\": \"a_file_name\",\n                    \"notgood3\": \"bogus\",\n                    \"OutputManifestFile\": \"a_file_name\",\n                    \"OutputResourceManifests\": \"a string1\",\n                    \"RegistrarScriptFile\": \"a_file_name\",\n                    \"ReplacementsFile\": \"a_file_name\",\n                    \"SuppressDependencyElement\": \"true\",\n                    \"SuppressStartupBanner\": \"true\",\n                    \"TrackerLogDirectory\": \"a_folder\",\n                    \"TypeLibraryFile\": \"a_file_name\",\n                    \"UpdateFileHashes\": \"true\",\n                    \"UpdateFileHashesSearchPath\": \"a_file_name\",\n                    \"VerboseOutput\": \"true\",\n                },\n                \"ProjectReference\": {\n                    \"LinkLibraryDependencies\": \"true\",\n                    \"UseLibraryDependencyInputs\": \"true\",\n                },\n                \"ManifestResourceCompile\": {\"ResourceOutputFileName\": \"a_file_name\"},\n                \"\": {\n                    \"EmbedManifest\": \"true\",\n                    \"GenerateManifest\": \"true\",\n                    \"IgnoreImportLibrary\": \"true\",\n                    \"LinkIncremental\": \"false\",\n                },\n            },\n            self.stderr,\n        )\n        self._ExpectedWarnings(\n            [\n                \"Warning: unrecognized setting ClCompile/Enableprefast\",\n                \"Warning: unrecognized setting ClCompile/ZZXYZ\",\n                \"Warning: unrecognized setting Manifest/notgood3\",\n                \"Warning: for Manifest/GenerateCatalogFiles, \"\n                \"expected bool; got 'truel'\",\n                \"Warning: for Lib/TargetMachine, unrecognized enumerated value \"\n                \"MachineX86i\",\n                \"Warning: for Manifest/EnableDPIAwareness, expected bool; got 'fal'\",\n            ]\n        )\n\n    def testConvertToMSBuildSettings_empty(self):\n        \"\"\"Tests an empty conversion.\"\"\"\n        msvs_settings = {}\n        expected_msbuild_settings = {}\n        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(\n            msvs_settings, self.stderr\n        )\n        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)\n        self._ExpectedWarnings([])\n\n    def testConvertToMSBuildSettings_minimal(self):\n        \"\"\"Tests a minimal conversion.\"\"\"\n        msvs_settings = {\n            \"VCCLCompilerTool\": {\n                \"AdditionalIncludeDirectories\": \"dir1\",\n                \"AdditionalOptions\": \"/foo\",\n                \"BasicRuntimeChecks\": \"0\",\n            },\n            \"VCLinkerTool\": {\n                \"LinkTimeCodeGeneration\": \"1\",\n                \"ErrorReporting\": \"1\",\n                \"DataExecutionPrevention\": \"2\",\n            },\n        }\n        expected_msbuild_settings = {\n            \"ClCompile\": {\n                \"AdditionalIncludeDirectories\": \"dir1\",\n                \"AdditionalOptions\": \"/foo\",\n                \"BasicRuntimeChecks\": \"Default\",\n            },\n            \"Link\": {\n                \"LinkTimeCodeGeneration\": \"UseLinkTimeCodeGeneration\",\n                \"LinkErrorReporting\": \"PromptImmediately\",\n                \"DataExecutionPrevention\": \"true\",\n            },\n        }\n        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(\n            msvs_settings, self.stderr\n        )\n        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)\n        self._ExpectedWarnings([])\n\n    def testConvertToMSBuildSettings_warnings(self):\n        \"\"\"Tests conversion that generates warnings.\"\"\"\n        msvs_settings = {\n            \"VCCLCompilerTool\": {\n                \"AdditionalIncludeDirectories\": \"1\",\n                \"AdditionalOptions\": \"2\",\n                # These are incorrect values:\n                \"BasicRuntimeChecks\": \"12\",\n                \"BrowseInformation\": \"21\",\n                \"UsePrecompiledHeader\": \"13\",\n                \"GeneratePreprocessedFile\": \"14\",\n            },\n            \"VCLinkerTool\": {\n                # These are incorrect values:\n                \"Driver\": \"10\",\n                \"LinkTimeCodeGeneration\": \"31\",\n                \"ErrorReporting\": \"21\",\n                \"FixedBaseAddress\": \"6\",\n            },\n            \"VCResourceCompilerTool\": {\n                # Custom\n                \"Culture\": \"1003\"\n            },\n        }\n        expected_msbuild_settings = {\n            \"ClCompile\": {\n                \"AdditionalIncludeDirectories\": \"1\",\n                \"AdditionalOptions\": \"2\",\n            },\n            \"Link\": {},\n            \"ResourceCompile\": {\n                # Custom\n                \"Culture\": \"0x03eb\"\n            },\n        }\n        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(\n            msvs_settings, self.stderr\n        )\n        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)\n        self._ExpectedWarnings(\n            [\n                \"Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to \"\n                \"MSBuild, index value (12) not in expected range [0, 4)\",\n                \"Warning: while converting VCCLCompilerTool/BrowseInformation to \"\n                \"MSBuild, index value (21) not in expected range [0, 3)\",\n                \"Warning: while converting VCCLCompilerTool/UsePrecompiledHeader to \"\n                \"MSBuild, index value (13) not in expected range [0, 3)\",\n                \"Warning: while converting \"\n                \"VCCLCompilerTool/GeneratePreprocessedFile to \"\n                \"MSBuild, value must be one of [0, 1, 2]; got 14\",\n                \"Warning: while converting VCLinkerTool/Driver to \"\n                \"MSBuild, index value (10) not in expected range [0, 4)\",\n                \"Warning: while converting VCLinkerTool/LinkTimeCodeGeneration to \"\n                \"MSBuild, index value (31) not in expected range [0, 5)\",\n                \"Warning: while converting VCLinkerTool/ErrorReporting to \"\n                \"MSBuild, index value (21) not in expected range [0, 3)\",\n                \"Warning: while converting VCLinkerTool/FixedBaseAddress to \"\n                \"MSBuild, index value (6) not in expected range [0, 3)\",\n            ]\n        )\n\n    def testConvertToMSBuildSettings_full_synthetic(self):\n        \"\"\"Tests conversion of all the MSBuild settings.\"\"\"\n        msvs_settings = {\n            \"VCCLCompilerTool\": {\n                \"AdditionalIncludeDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"AdditionalUsingDirectories\": \"folder1;folder2;folder3\",\n                \"AssemblerListingLocation\": \"a_file_name\",\n                \"AssemblerOutput\": \"0\",\n                \"BasicRuntimeChecks\": \"1\",\n                \"BrowseInformation\": \"2\",\n                \"BrowseInformationFile\": \"a_file_name\",\n                \"BufferSecurityCheck\": \"true\",\n                \"CallingConvention\": \"0\",\n                \"CompileAs\": \"1\",\n                \"DebugInformationFormat\": \"4\",\n                \"DefaultCharIsUnsigned\": \"true\",\n                \"Detect64BitPortabilityProblems\": \"true\",\n                \"DisableLanguageExtensions\": \"true\",\n                \"DisableSpecificWarnings\": \"d1;d2;d3\",\n                \"EnableEnhancedInstructionSet\": \"0\",\n                \"EnableFiberSafeOptimizations\": \"true\",\n                \"EnableFunctionLevelLinking\": \"true\",\n                \"EnableIntrinsicFunctions\": \"true\",\n                \"EnablePREfast\": \"true\",\n                \"ErrorReporting\": \"1\",\n                \"ExceptionHandling\": \"2\",\n                \"ExpandAttributedSource\": \"true\",\n                \"FavorSizeOrSpeed\": \"0\",\n                \"FloatingPointExceptions\": \"true\",\n                \"FloatingPointModel\": \"1\",\n                \"ForceConformanceInForLoopScope\": \"true\",\n                \"ForcedIncludeFiles\": \"file1;file2;file3\",\n                \"ForcedUsingFiles\": \"file1;file2;file3\",\n                \"GeneratePreprocessedFile\": \"1\",\n                \"GenerateXMLDocumentationFiles\": \"true\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"InlineFunctionExpansion\": \"2\",\n                \"KeepComments\": \"true\",\n                \"MinimalRebuild\": \"true\",\n                \"ObjectFile\": \"a_file_name\",\n                \"OmitDefaultLibName\": \"true\",\n                \"OmitFramePointers\": \"true\",\n                \"OpenMP\": \"true\",\n                \"Optimization\": \"3\",\n                \"PrecompiledHeaderFile\": \"a_file_name\",\n                \"PrecompiledHeaderThrough\": \"a_file_name\",\n                \"PreprocessorDefinitions\": \"d1;d2;d3\",\n                \"ProgramDataBaseFileName\": \"a_file_name\",\n                \"RuntimeLibrary\": \"0\",\n                \"RuntimeTypeInfo\": \"true\",\n                \"ShowIncludes\": \"true\",\n                \"SmallerTypeCheck\": \"true\",\n                \"StringPooling\": \"true\",\n                \"StructMemberAlignment\": \"1\",\n                \"SuppressStartupBanner\": \"true\",\n                \"TreatWChar_tAsBuiltInType\": \"true\",\n                \"UndefineAllPreprocessorDefinitions\": \"true\",\n                \"UndefinePreprocessorDefinitions\": \"d1;d2;d3\",\n                \"UseFullPaths\": \"true\",\n                \"UsePrecompiledHeader\": \"1\",\n                \"UseUnicodeResponseFiles\": \"true\",\n                \"WarnAsError\": \"true\",\n                \"WarningLevel\": \"2\",\n                \"WholeProgramOptimization\": \"true\",\n                \"XMLDocumentationFileName\": \"a_file_name\",\n            },\n            \"VCLinkerTool\": {\n                \"AdditionalDependencies\": \"file1;file2;file3\",\n                \"AdditionalLibraryDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalLibraryDirectories_excluded\": \"folder1;folder2;folder3\",\n                \"AdditionalManifestDependencies\": \"file1;file2;file3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"AddModuleNamesToAssembly\": \"file1;file2;file3\",\n                \"AllowIsolation\": \"true\",\n                \"AssemblyDebug\": \"0\",\n                \"AssemblyLinkResource\": \"file1;file2;file3\",\n                \"BaseAddress\": \"a_string\",\n                \"CLRImageType\": \"1\",\n                \"CLRThreadAttribute\": \"2\",\n                \"CLRUnmanagedCodeCheck\": \"true\",\n                \"DataExecutionPrevention\": \"0\",\n                \"DelayLoadDLLs\": \"file1;file2;file3\",\n                \"DelaySign\": \"true\",\n                \"Driver\": \"1\",\n                \"EmbedManagedResourceFile\": \"file1;file2;file3\",\n                \"EnableCOMDATFolding\": \"0\",\n                \"EnableUAC\": \"true\",\n                \"EntryPointSymbol\": \"a_string\",\n                \"ErrorReporting\": \"0\",\n                \"FixedBaseAddress\": \"1\",\n                \"ForceSymbolReferences\": \"file1;file2;file3\",\n                \"FunctionOrder\": \"a_file_name\",\n                \"GenerateDebugInformation\": \"true\",\n                \"GenerateManifest\": \"true\",\n                \"GenerateMapFile\": \"true\",\n                \"HeapCommitSize\": \"a_string\",\n                \"HeapReserveSize\": \"a_string\",\n                \"IgnoreAllDefaultLibraries\": \"true\",\n                \"IgnoreDefaultLibraryNames\": \"file1;file2;file3\",\n                \"IgnoreEmbeddedIDL\": \"true\",\n                \"IgnoreImportLibrary\": \"true\",\n                \"ImportLibrary\": \"a_file_name\",\n                \"KeyContainer\": \"a_file_name\",\n                \"KeyFile\": \"a_file_name\",\n                \"LargeAddressAware\": \"2\",\n                \"LinkIncremental\": \"1\",\n                \"LinkLibraryDependencies\": \"true\",\n                \"LinkTimeCodeGeneration\": \"2\",\n                \"ManifestFile\": \"a_file_name\",\n                \"MapExports\": \"true\",\n                \"MapFileName\": \"a_file_name\",\n                \"MergedIDLBaseFileName\": \"a_file_name\",\n                \"MergeSections\": \"a_string\",\n                \"MidlCommandFile\": \"a_file_name\",\n                \"ModuleDefinitionFile\": \"a_file_name\",\n                \"OptimizeForWindows98\": \"1\",\n                \"OptimizeReferences\": \"0\",\n                \"OutputFile\": \"a_file_name\",\n                \"PerUserRedirection\": \"true\",\n                \"Profile\": \"true\",\n                \"ProfileGuidedDatabase\": \"a_file_name\",\n                \"ProgramDatabaseFile\": \"a_file_name\",\n                \"RandomizedBaseAddress\": \"1\",\n                \"RegisterOutput\": \"true\",\n                \"ResourceOnlyDLL\": \"true\",\n                \"SetChecksum\": \"true\",\n                \"ShowProgress\": \"0\",\n                \"StackCommitSize\": \"a_string\",\n                \"StackReserveSize\": \"a_string\",\n                \"StripPrivateSymbols\": \"a_file_name\",\n                \"SubSystem\": \"2\",\n                \"SupportUnloadOfDelayLoadedDLL\": \"true\",\n                \"SuppressStartupBanner\": \"true\",\n                \"SwapRunFromCD\": \"true\",\n                \"SwapRunFromNet\": \"true\",\n                \"TargetMachine\": \"3\",\n                \"TerminalServerAware\": \"2\",\n                \"TurnOffAssemblyGeneration\": \"true\",\n                \"TypeLibraryFile\": \"a_file_name\",\n                \"TypeLibraryResourceID\": \"33\",\n                \"UACExecutionLevel\": \"1\",\n                \"UACUIAccess\": \"true\",\n                \"UseLibraryDependencyInputs\": \"false\",\n                \"UseUnicodeResponseFiles\": \"true\",\n                \"Version\": \"a_string\",\n            },\n            \"VCResourceCompilerTool\": {\n                \"AdditionalIncludeDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"Culture\": \"1003\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"PreprocessorDefinitions\": \"d1;d2;d3\",\n                \"ResourceOutputFileName\": \"a_string\",\n                \"ShowProgress\": \"true\",\n                \"SuppressStartupBanner\": \"true\",\n                \"UndefinePreprocessorDefinitions\": \"d1;d2;d3\",\n            },\n            \"VCMIDLTool\": {\n                \"AdditionalIncludeDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"CPreprocessOptions\": \"a_string\",\n                \"DefaultCharType\": \"0\",\n                \"DLLDataFileName\": \"a_file_name\",\n                \"EnableErrorChecks\": \"2\",\n                \"ErrorCheckAllocations\": \"true\",\n                \"ErrorCheckBounds\": \"true\",\n                \"ErrorCheckEnumRange\": \"true\",\n                \"ErrorCheckRefPointers\": \"true\",\n                \"ErrorCheckStubData\": \"true\",\n                \"GenerateStublessProxies\": \"true\",\n                \"GenerateTypeLibrary\": \"true\",\n                \"HeaderFileName\": \"a_file_name\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"InterfaceIdentifierFileName\": \"a_file_name\",\n                \"MkTypLibCompatible\": \"true\",\n                \"OutputDirectory\": \"a_string\",\n                \"PreprocessorDefinitions\": \"d1;d2;d3\",\n                \"ProxyFileName\": \"a_file_name\",\n                \"RedirectOutputAndErrors\": \"a_file_name\",\n                \"StructMemberAlignment\": \"3\",\n                \"SuppressStartupBanner\": \"true\",\n                \"TargetEnvironment\": \"1\",\n                \"TypeLibraryName\": \"a_file_name\",\n                \"UndefinePreprocessorDefinitions\": \"d1;d2;d3\",\n                \"ValidateParameters\": \"true\",\n                \"WarnAsError\": \"true\",\n                \"WarningLevel\": \"4\",\n            },\n            \"VCLibrarianTool\": {\n                \"AdditionalDependencies\": \"file1;file2;file3\",\n                \"AdditionalLibraryDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalLibraryDirectories_excluded\": \"folder1;folder2;folder3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"ExportNamedFunctions\": \"d1;d2;d3\",\n                \"ForceSymbolReferences\": \"a_string\",\n                \"IgnoreAllDefaultLibraries\": \"true\",\n                \"IgnoreSpecificDefaultLibraries\": \"file1;file2;file3\",\n                \"LinkLibraryDependencies\": \"true\",\n                \"ModuleDefinitionFile\": \"a_file_name\",\n                \"OutputFile\": \"a_file_name\",\n                \"SuppressStartupBanner\": \"true\",\n                \"UseUnicodeResponseFiles\": \"true\",\n            },\n            \"VCManifestTool\": {\n                \"AdditionalManifestFiles\": \"file1;file2;file3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"AssemblyIdentity\": \"a_string\",\n                \"ComponentFileName\": \"a_file_name\",\n                \"DependencyInformationFile\": \"a_file_name\",\n                \"EmbedManifest\": \"true\",\n                \"GenerateCatalogFiles\": \"true\",\n                \"InputResourceManifests\": \"a_string\",\n                \"ManifestResourceFile\": \"my_name\",\n                \"OutputManifestFile\": \"a_file_name\",\n                \"RegistrarScriptFile\": \"a_file_name\",\n                \"ReplacementsFile\": \"a_file_name\",\n                \"SuppressStartupBanner\": \"true\",\n                \"TypeLibraryFile\": \"a_file_name\",\n                \"UpdateFileHashes\": \"true\",\n                \"UpdateFileHashesSearchPath\": \"a_file_name\",\n                \"UseFAT32Workaround\": \"true\",\n                \"UseUnicodeResponseFiles\": \"true\",\n                \"VerboseOutput\": \"true\",\n            },\n        }\n        expected_msbuild_settings = {\n            \"ClCompile\": {\n                \"AdditionalIncludeDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalOptions\": \"a_string /J\",\n                \"AdditionalUsingDirectories\": \"folder1;folder2;folder3\",\n                \"AssemblerListingLocation\": \"a_file_name\",\n                \"AssemblerOutput\": \"NoListing\",\n                \"BasicRuntimeChecks\": \"StackFrameRuntimeCheck\",\n                \"BrowseInformation\": \"true\",\n                \"BrowseInformationFile\": \"a_file_name\",\n                \"BufferSecurityCheck\": \"true\",\n                \"CallingConvention\": \"Cdecl\",\n                \"CompileAs\": \"CompileAsC\",\n                \"DebugInformationFormat\": \"EditAndContinue\",\n                \"DisableLanguageExtensions\": \"true\",\n                \"DisableSpecificWarnings\": \"d1;d2;d3\",\n                \"EnableEnhancedInstructionSet\": \"NotSet\",\n                \"EnableFiberSafeOptimizations\": \"true\",\n                \"EnablePREfast\": \"true\",\n                \"ErrorReporting\": \"Prompt\",\n                \"ExceptionHandling\": \"Async\",\n                \"ExpandAttributedSource\": \"true\",\n                \"FavorSizeOrSpeed\": \"Neither\",\n                \"FloatingPointExceptions\": \"true\",\n                \"FloatingPointModel\": \"Strict\",\n                \"ForceConformanceInForLoopScope\": \"true\",\n                \"ForcedIncludeFiles\": \"file1;file2;file3\",\n                \"ForcedUsingFiles\": \"file1;file2;file3\",\n                \"FunctionLevelLinking\": \"true\",\n                \"GenerateXMLDocumentationFiles\": \"true\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"InlineFunctionExpansion\": \"AnySuitable\",\n                \"IntrinsicFunctions\": \"true\",\n                \"MinimalRebuild\": \"true\",\n                \"ObjectFileName\": \"a_file_name\",\n                \"OmitDefaultLibName\": \"true\",\n                \"OmitFramePointers\": \"true\",\n                \"OpenMPSupport\": \"true\",\n                \"Optimization\": \"Full\",\n                \"PrecompiledHeader\": \"Create\",\n                \"PrecompiledHeaderFile\": \"a_file_name\",\n                \"PrecompiledHeaderOutputFile\": \"a_file_name\",\n                \"PreprocessKeepComments\": \"true\",\n                \"PreprocessorDefinitions\": \"d1;d2;d3\",\n                \"PreprocessSuppressLineNumbers\": \"false\",\n                \"PreprocessToFile\": \"true\",\n                \"ProgramDataBaseFileName\": \"a_file_name\",\n                \"RuntimeLibrary\": \"MultiThreaded\",\n                \"RuntimeTypeInfo\": \"true\",\n                \"ShowIncludes\": \"true\",\n                \"SmallerTypeCheck\": \"true\",\n                \"StringPooling\": \"true\",\n                \"StructMemberAlignment\": \"1Byte\",\n                \"SuppressStartupBanner\": \"true\",\n                \"TreatWarningAsError\": \"true\",\n                \"TreatWChar_tAsBuiltInType\": \"true\",\n                \"UndefineAllPreprocessorDefinitions\": \"true\",\n                \"UndefinePreprocessorDefinitions\": \"d1;d2;d3\",\n                \"UseFullPaths\": \"true\",\n                \"WarningLevel\": \"Level2\",\n                \"WholeProgramOptimization\": \"true\",\n                \"XMLDocumentationFileName\": \"a_file_name\",\n            },\n            \"Link\": {\n                \"AdditionalDependencies\": \"file1;file2;file3\",\n                \"AdditionalLibraryDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalManifestDependencies\": \"file1;file2;file3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"AddModuleNamesToAssembly\": \"file1;file2;file3\",\n                \"AllowIsolation\": \"true\",\n                \"AssemblyDebug\": \"\",\n                \"AssemblyLinkResource\": \"file1;file2;file3\",\n                \"BaseAddress\": \"a_string\",\n                \"CLRImageType\": \"ForceIJWImage\",\n                \"CLRThreadAttribute\": \"STAThreadingAttribute\",\n                \"CLRUnmanagedCodeCheck\": \"true\",\n                \"DataExecutionPrevention\": \"\",\n                \"DelayLoadDLLs\": \"file1;file2;file3\",\n                \"DelaySign\": \"true\",\n                \"Driver\": \"Driver\",\n                \"EmbedManagedResourceFile\": \"file1;file2;file3\",\n                \"EnableCOMDATFolding\": \"\",\n                \"EnableUAC\": \"true\",\n                \"EntryPointSymbol\": \"a_string\",\n                \"FixedBaseAddress\": \"false\",\n                \"ForceSymbolReferences\": \"file1;file2;file3\",\n                \"FunctionOrder\": \"a_file_name\",\n                \"GenerateDebugInformation\": \"true\",\n                \"GenerateMapFile\": \"true\",\n                \"HeapCommitSize\": \"a_string\",\n                \"HeapReserveSize\": \"a_string\",\n                \"IgnoreAllDefaultLibraries\": \"true\",\n                \"IgnoreEmbeddedIDL\": \"true\",\n                \"IgnoreSpecificDefaultLibraries\": \"file1;file2;file3\",\n                \"ImportLibrary\": \"a_file_name\",\n                \"KeyContainer\": \"a_file_name\",\n                \"KeyFile\": \"a_file_name\",\n                \"LargeAddressAware\": \"true\",\n                \"LinkErrorReporting\": \"NoErrorReport\",\n                \"LinkTimeCodeGeneration\": \"PGInstrument\",\n                \"ManifestFile\": \"a_file_name\",\n                \"MapExports\": \"true\",\n                \"MapFileName\": \"a_file_name\",\n                \"MergedIDLBaseFileName\": \"a_file_name\",\n                \"MergeSections\": \"a_string\",\n                \"MidlCommandFile\": \"a_file_name\",\n                \"ModuleDefinitionFile\": \"a_file_name\",\n                \"NoEntryPoint\": \"true\",\n                \"OptimizeReferences\": \"\",\n                \"OutputFile\": \"a_file_name\",\n                \"PerUserRedirection\": \"true\",\n                \"Profile\": \"true\",\n                \"ProfileGuidedDatabase\": \"a_file_name\",\n                \"ProgramDatabaseFile\": \"a_file_name\",\n                \"RandomizedBaseAddress\": \"false\",\n                \"RegisterOutput\": \"true\",\n                \"SetChecksum\": \"true\",\n                \"ShowProgress\": \"NotSet\",\n                \"StackCommitSize\": \"a_string\",\n                \"StackReserveSize\": \"a_string\",\n                \"StripPrivateSymbols\": \"a_file_name\",\n                \"SubSystem\": \"Windows\",\n                \"SupportUnloadOfDelayLoadedDLL\": \"true\",\n                \"SuppressStartupBanner\": \"true\",\n                \"SwapRunFromCD\": \"true\",\n                \"SwapRunFromNET\": \"true\",\n                \"TargetMachine\": \"MachineARM\",\n                \"TerminalServerAware\": \"true\",\n                \"TurnOffAssemblyGeneration\": \"true\",\n                \"TypeLibraryFile\": \"a_file_name\",\n                \"TypeLibraryResourceID\": \"33\",\n                \"UACExecutionLevel\": \"HighestAvailable\",\n                \"UACUIAccess\": \"true\",\n                \"Version\": \"a_string\",\n            },\n            \"ResourceCompile\": {\n                \"AdditionalIncludeDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"Culture\": \"0x03eb\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"PreprocessorDefinitions\": \"d1;d2;d3\",\n                \"ResourceOutputFileName\": \"a_string\",\n                \"ShowProgress\": \"true\",\n                \"SuppressStartupBanner\": \"true\",\n                \"UndefinePreprocessorDefinitions\": \"d1;d2;d3\",\n            },\n            \"Midl\": {\n                \"AdditionalIncludeDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"CPreprocessOptions\": \"a_string\",\n                \"DefaultCharType\": \"Unsigned\",\n                \"DllDataFileName\": \"a_file_name\",\n                \"EnableErrorChecks\": \"All\",\n                \"ErrorCheckAllocations\": \"true\",\n                \"ErrorCheckBounds\": \"true\",\n                \"ErrorCheckEnumRange\": \"true\",\n                \"ErrorCheckRefPointers\": \"true\",\n                \"ErrorCheckStubData\": \"true\",\n                \"GenerateStublessProxies\": \"true\",\n                \"GenerateTypeLibrary\": \"true\",\n                \"HeaderFileName\": \"a_file_name\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"InterfaceIdentifierFileName\": \"a_file_name\",\n                \"MkTypLibCompatible\": \"true\",\n                \"OutputDirectory\": \"a_string\",\n                \"PreprocessorDefinitions\": \"d1;d2;d3\",\n                \"ProxyFileName\": \"a_file_name\",\n                \"RedirectOutputAndErrors\": \"a_file_name\",\n                \"StructMemberAlignment\": \"4\",\n                \"SuppressStartupBanner\": \"true\",\n                \"TargetEnvironment\": \"Win32\",\n                \"TypeLibraryName\": \"a_file_name\",\n                \"UndefinePreprocessorDefinitions\": \"d1;d2;d3\",\n                \"ValidateAllParameters\": \"true\",\n                \"WarnAsError\": \"true\",\n                \"WarningLevel\": \"4\",\n            },\n            \"Lib\": {\n                \"AdditionalDependencies\": \"file1;file2;file3\",\n                \"AdditionalLibraryDirectories\": \"folder1;folder2;folder3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"ExportNamedFunctions\": \"d1;d2;d3\",\n                \"ForceSymbolReferences\": \"a_string\",\n                \"IgnoreAllDefaultLibraries\": \"true\",\n                \"IgnoreSpecificDefaultLibraries\": \"file1;file2;file3\",\n                \"ModuleDefinitionFile\": \"a_file_name\",\n                \"OutputFile\": \"a_file_name\",\n                \"SuppressStartupBanner\": \"true\",\n                \"UseUnicodeResponseFiles\": \"true\",\n            },\n            \"Manifest\": {\n                \"AdditionalManifestFiles\": \"file1;file2;file3\",\n                \"AdditionalOptions\": \"a_string\",\n                \"AssemblyIdentity\": \"a_string\",\n                \"ComponentFileName\": \"a_file_name\",\n                \"GenerateCatalogFiles\": \"true\",\n                \"InputResourceManifests\": \"a_string\",\n                \"OutputManifestFile\": \"a_file_name\",\n                \"RegistrarScriptFile\": \"a_file_name\",\n                \"ReplacementsFile\": \"a_file_name\",\n                \"SuppressStartupBanner\": \"true\",\n                \"TypeLibraryFile\": \"a_file_name\",\n                \"UpdateFileHashes\": \"true\",\n                \"UpdateFileHashesSearchPath\": \"a_file_name\",\n                \"VerboseOutput\": \"true\",\n            },\n            \"ManifestResourceCompile\": {\"ResourceOutputFileName\": \"my_name\"},\n            \"ProjectReference\": {\n                \"LinkLibraryDependencies\": \"true\",\n                \"UseLibraryDependencyInputs\": \"false\",\n            },\n            \"\": {\n                \"EmbedManifest\": \"true\",\n                \"GenerateManifest\": \"true\",\n                \"IgnoreImportLibrary\": \"true\",\n                \"LinkIncremental\": \"false\",\n            },\n        }\n        self.maxDiff = 9999  # on failure display a long diff\n        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(\n            msvs_settings, self.stderr\n        )\n        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)\n        self._ExpectedWarnings([])\n\n    def testConvertToMSBuildSettings_actual(self):\n        \"\"\"Tests the conversion of an actual project.\n\n        A VS2008 project with most of the options defined was created through the\n        VS2008 IDE.  It was then converted to VS2010.  The tool settings found in\n        the .vcproj and .vcxproj files were converted to the two dictionaries\n        msvs_settings and expected_msbuild_settings.\n\n        Note that for many settings, the VS2010 converter adds macros like\n        %(AdditionalIncludeDirectories) to make sure than inherited values are\n        included.  Since the Gyp projects we generate do not use inheritance,\n        we removed these macros.  They were:\n            ClCompile:\n                AdditionalIncludeDirectories:  ';%(AdditionalIncludeDirectories)'\n                AdditionalOptions:  ' %(AdditionalOptions)'\n                AdditionalUsingDirectories:  ';%(AdditionalUsingDirectories)'\n                DisableSpecificWarnings: ';%(DisableSpecificWarnings)',\n                ForcedIncludeFiles:  ';%(ForcedIncludeFiles)',\n                ForcedUsingFiles:  ';%(ForcedUsingFiles)',\n                PreprocessorDefinitions:  ';%(PreprocessorDefinitions)',\n                UndefinePreprocessorDefinitions:\n                    ';%(UndefinePreprocessorDefinitions)',\n            Link:\n                AdditionalDependencies:  ';%(AdditionalDependencies)',\n                AdditionalLibraryDirectories:  ';%(AdditionalLibraryDirectories)',\n                AdditionalManifestDependencies:\n                    ';%(AdditionalManifestDependencies)',\n                AdditionalOptions:  ' %(AdditionalOptions)',\n                AddModuleNamesToAssembly:  ';%(AddModuleNamesToAssembly)',\n                AssemblyLinkResource:  ';%(AssemblyLinkResource)',\n                DelayLoadDLLs:  ';%(DelayLoadDLLs)',\n                EmbedManagedResourceFile:  ';%(EmbedManagedResourceFile)',\n                ForceSymbolReferences:  ';%(ForceSymbolReferences)',\n                IgnoreSpecificDefaultLibraries:\n                    ';%(IgnoreSpecificDefaultLibraries)',\n            ResourceCompile:\n                AdditionalIncludeDirectories:  ';%(AdditionalIncludeDirectories)',\n                AdditionalOptions:  ' %(AdditionalOptions)',\n                PreprocessorDefinitions:  ';%(PreprocessorDefinitions)',\n            Manifest:\n                AdditionalManifestFiles:  ';%(AdditionalManifestFiles)',\n                AdditionalOptions:  ' %(AdditionalOptions)',\n                InputResourceManifests:  ';%(InputResourceManifests)',\n        \"\"\"\n        msvs_settings = {\n            \"VCCLCompilerTool\": {\n                \"AdditionalIncludeDirectories\": \"dir1\",\n                \"AdditionalOptions\": \"/more\",\n                \"AdditionalUsingDirectories\": \"test\",\n                \"AssemblerListingLocation\": \"$(IntDir)\\\\a\",\n                \"AssemblerOutput\": \"1\",\n                \"BasicRuntimeChecks\": \"3\",\n                \"BrowseInformation\": \"1\",\n                \"BrowseInformationFile\": \"$(IntDir)\\\\e\",\n                \"BufferSecurityCheck\": \"false\",\n                \"CallingConvention\": \"1\",\n                \"CompileAs\": \"1\",\n                \"DebugInformationFormat\": \"4\",\n                \"DefaultCharIsUnsigned\": \"true\",\n                \"Detect64BitPortabilityProblems\": \"true\",\n                \"DisableLanguageExtensions\": \"true\",\n                \"DisableSpecificWarnings\": \"abc\",\n                \"EnableEnhancedInstructionSet\": \"1\",\n                \"EnableFiberSafeOptimizations\": \"true\",\n                \"EnableFunctionLevelLinking\": \"true\",\n                \"EnableIntrinsicFunctions\": \"true\",\n                \"EnablePREfast\": \"true\",\n                \"ErrorReporting\": \"2\",\n                \"ExceptionHandling\": \"2\",\n                \"ExpandAttributedSource\": \"true\",\n                \"FavorSizeOrSpeed\": \"2\",\n                \"FloatingPointExceptions\": \"true\",\n                \"FloatingPointModel\": \"1\",\n                \"ForceConformanceInForLoopScope\": \"false\",\n                \"ForcedIncludeFiles\": \"def\",\n                \"ForcedUsingFiles\": \"ge\",\n                \"GeneratePreprocessedFile\": \"2\",\n                \"GenerateXMLDocumentationFiles\": \"true\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"InlineFunctionExpansion\": \"1\",\n                \"KeepComments\": \"true\",\n                \"MinimalRebuild\": \"true\",\n                \"ObjectFile\": \"$(IntDir)\\\\b\",\n                \"OmitDefaultLibName\": \"true\",\n                \"OmitFramePointers\": \"true\",\n                \"OpenMP\": \"true\",\n                \"Optimization\": \"3\",\n                \"PrecompiledHeaderFile\": \"$(IntDir)\\\\$(TargetName).pche\",\n                \"PrecompiledHeaderThrough\": \"StdAfx.hd\",\n                \"PreprocessorDefinitions\": \"WIN32;_DEBUG;_CONSOLE\",\n                \"ProgramDataBaseFileName\": \"$(IntDir)\\\\vc90b.pdb\",\n                \"RuntimeLibrary\": \"3\",\n                \"RuntimeTypeInfo\": \"false\",\n                \"ShowIncludes\": \"true\",\n                \"SmallerTypeCheck\": \"true\",\n                \"StringPooling\": \"true\",\n                \"StructMemberAlignment\": \"3\",\n                \"SuppressStartupBanner\": \"false\",\n                \"TreatWChar_tAsBuiltInType\": \"false\",\n                \"UndefineAllPreprocessorDefinitions\": \"true\",\n                \"UndefinePreprocessorDefinitions\": \"wer\",\n                \"UseFullPaths\": \"true\",\n                \"UsePrecompiledHeader\": \"0\",\n                \"UseUnicodeResponseFiles\": \"false\",\n                \"WarnAsError\": \"true\",\n                \"WarningLevel\": \"3\",\n                \"WholeProgramOptimization\": \"true\",\n                \"XMLDocumentationFileName\": \"$(IntDir)\\\\c\",\n            },\n            \"VCLinkerTool\": {\n                \"AdditionalDependencies\": \"zx\",\n                \"AdditionalLibraryDirectories\": \"asd\",\n                \"AdditionalManifestDependencies\": \"s2\",\n                \"AdditionalOptions\": \"/mor2\",\n                \"AddModuleNamesToAssembly\": \"d1\",\n                \"AllowIsolation\": \"false\",\n                \"AssemblyDebug\": \"1\",\n                \"AssemblyLinkResource\": \"d5\",\n                \"BaseAddress\": \"23423\",\n                \"CLRImageType\": \"3\",\n                \"CLRThreadAttribute\": \"1\",\n                \"CLRUnmanagedCodeCheck\": \"true\",\n                \"DataExecutionPrevention\": \"0\",\n                \"DelayLoadDLLs\": \"d4\",\n                \"DelaySign\": \"true\",\n                \"Driver\": \"2\",\n                \"EmbedManagedResourceFile\": \"d2\",\n                \"EnableCOMDATFolding\": \"1\",\n                \"EnableUAC\": \"false\",\n                \"EntryPointSymbol\": \"f5\",\n                \"ErrorReporting\": \"2\",\n                \"FixedBaseAddress\": \"1\",\n                \"ForceSymbolReferences\": \"d3\",\n                \"FunctionOrder\": \"fssdfsd\",\n                \"GenerateDebugInformation\": \"true\",\n                \"GenerateManifest\": \"false\",\n                \"GenerateMapFile\": \"true\",\n                \"HeapCommitSize\": \"13\",\n                \"HeapReserveSize\": \"12\",\n                \"IgnoreAllDefaultLibraries\": \"true\",\n                \"IgnoreDefaultLibraryNames\": \"flob;flok\",\n                \"IgnoreEmbeddedIDL\": \"true\",\n                \"IgnoreImportLibrary\": \"true\",\n                \"ImportLibrary\": \"f4\",\n                \"KeyContainer\": \"f7\",\n                \"KeyFile\": \"f6\",\n                \"LargeAddressAware\": \"2\",\n                \"LinkIncremental\": \"0\",\n                \"LinkLibraryDependencies\": \"false\",\n                \"LinkTimeCodeGeneration\": \"1\",\n                \"ManifestFile\": \"$(IntDir)\\\\$(TargetFileName).2intermediate.manifest\",\n                \"MapExports\": \"true\",\n                \"MapFileName\": \"d5\",\n                \"MergedIDLBaseFileName\": \"f2\",\n                \"MergeSections\": \"f5\",\n                \"MidlCommandFile\": \"f1\",\n                \"ModuleDefinitionFile\": \"sdsd\",\n                \"OptimizeForWindows98\": \"2\",\n                \"OptimizeReferences\": \"2\",\n                \"OutputFile\": \"$(OutDir)\\\\$(ProjectName)2.exe\",\n                \"PerUserRedirection\": \"true\",\n                \"Profile\": \"true\",\n                \"ProfileGuidedDatabase\": \"$(TargetDir)$(TargetName).pgdd\",\n                \"ProgramDatabaseFile\": \"Flob.pdb\",\n                \"RandomizedBaseAddress\": \"1\",\n                \"RegisterOutput\": \"true\",\n                \"ResourceOnlyDLL\": \"true\",\n                \"SetChecksum\": \"false\",\n                \"ShowProgress\": \"1\",\n                \"StackCommitSize\": \"15\",\n                \"StackReserveSize\": \"14\",\n                \"StripPrivateSymbols\": \"d3\",\n                \"SubSystem\": \"1\",\n                \"SupportUnloadOfDelayLoadedDLL\": \"true\",\n                \"SuppressStartupBanner\": \"false\",\n                \"SwapRunFromCD\": \"true\",\n                \"SwapRunFromNet\": \"true\",\n                \"TargetMachine\": \"1\",\n                \"TerminalServerAware\": \"1\",\n                \"TurnOffAssemblyGeneration\": \"true\",\n                \"TypeLibraryFile\": \"f3\",\n                \"TypeLibraryResourceID\": \"12\",\n                \"UACExecutionLevel\": \"2\",\n                \"UACUIAccess\": \"true\",\n                \"UseLibraryDependencyInputs\": \"true\",\n                \"UseUnicodeResponseFiles\": \"false\",\n                \"Version\": \"333\",\n            },\n            \"VCResourceCompilerTool\": {\n                \"AdditionalIncludeDirectories\": \"f3\",\n                \"AdditionalOptions\": \"/more3\",\n                \"Culture\": \"3084\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"PreprocessorDefinitions\": \"_UNICODE;UNICODE2\",\n                \"ResourceOutputFileName\": \"$(IntDir)/$(InputName)3.res\",\n                \"ShowProgress\": \"true\",\n            },\n            \"VCManifestTool\": {\n                \"AdditionalManifestFiles\": \"sfsdfsd\",\n                \"AdditionalOptions\": \"afdsdafsd\",\n                \"AssemblyIdentity\": \"sddfdsadfsa\",\n                \"ComponentFileName\": \"fsdfds\",\n                \"DependencyInformationFile\": \"$(IntDir)\\\\mt.depdfd\",\n                \"EmbedManifest\": \"false\",\n                \"GenerateCatalogFiles\": \"true\",\n                \"InputResourceManifests\": \"asfsfdafs\",\n                \"ManifestResourceFile\": \"$(IntDir)\\\\$(TargetFileName).embed.manifest.resfdsf\",  # noqa: E501\n                \"OutputManifestFile\": \"$(TargetPath).manifestdfs\",\n                \"RegistrarScriptFile\": \"sdfsfd\",\n                \"ReplacementsFile\": \"sdffsd\",\n                \"SuppressStartupBanner\": \"false\",\n                \"TypeLibraryFile\": \"sfsd\",\n                \"UpdateFileHashes\": \"true\",\n                \"UpdateFileHashesSearchPath\": \"sfsd\",\n                \"UseFAT32Workaround\": \"true\",\n                \"UseUnicodeResponseFiles\": \"false\",\n                \"VerboseOutput\": \"true\",\n            },\n        }\n        expected_msbuild_settings = {\n            \"ClCompile\": {\n                \"AdditionalIncludeDirectories\": \"dir1\",\n                \"AdditionalOptions\": \"/more /J\",\n                \"AdditionalUsingDirectories\": \"test\",\n                \"AssemblerListingLocation\": \"$(IntDir)a\",\n                \"AssemblerOutput\": \"AssemblyCode\",\n                \"BasicRuntimeChecks\": \"EnableFastChecks\",\n                \"BrowseInformation\": \"true\",\n                \"BrowseInformationFile\": \"$(IntDir)e\",\n                \"BufferSecurityCheck\": \"false\",\n                \"CallingConvention\": \"FastCall\",\n                \"CompileAs\": \"CompileAsC\",\n                \"DebugInformationFormat\": \"EditAndContinue\",\n                \"DisableLanguageExtensions\": \"true\",\n                \"DisableSpecificWarnings\": \"abc\",\n                \"EnableEnhancedInstructionSet\": \"StreamingSIMDExtensions\",\n                \"EnableFiberSafeOptimizations\": \"true\",\n                \"EnablePREfast\": \"true\",\n                \"ErrorReporting\": \"Queue\",\n                \"ExceptionHandling\": \"Async\",\n                \"ExpandAttributedSource\": \"true\",\n                \"FavorSizeOrSpeed\": \"Size\",\n                \"FloatingPointExceptions\": \"true\",\n                \"FloatingPointModel\": \"Strict\",\n                \"ForceConformanceInForLoopScope\": \"false\",\n                \"ForcedIncludeFiles\": \"def\",\n                \"ForcedUsingFiles\": \"ge\",\n                \"FunctionLevelLinking\": \"true\",\n                \"GenerateXMLDocumentationFiles\": \"true\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"InlineFunctionExpansion\": \"OnlyExplicitInline\",\n                \"IntrinsicFunctions\": \"true\",\n                \"MinimalRebuild\": \"true\",\n                \"ObjectFileName\": \"$(IntDir)b\",\n                \"OmitDefaultLibName\": \"true\",\n                \"OmitFramePointers\": \"true\",\n                \"OpenMPSupport\": \"true\",\n                \"Optimization\": \"Full\",\n                \"PrecompiledHeader\": \"NotUsing\",  # Actual conversion gives ''\n                \"PrecompiledHeaderFile\": \"StdAfx.hd\",\n                \"PrecompiledHeaderOutputFile\": \"$(IntDir)$(TargetName).pche\",\n                \"PreprocessKeepComments\": \"true\",\n                \"PreprocessorDefinitions\": \"WIN32;_DEBUG;_CONSOLE\",\n                \"PreprocessSuppressLineNumbers\": \"true\",\n                \"PreprocessToFile\": \"true\",\n                \"ProgramDataBaseFileName\": \"$(IntDir)vc90b.pdb\",\n                \"RuntimeLibrary\": \"MultiThreadedDebugDLL\",\n                \"RuntimeTypeInfo\": \"false\",\n                \"ShowIncludes\": \"true\",\n                \"SmallerTypeCheck\": \"true\",\n                \"StringPooling\": \"true\",\n                \"StructMemberAlignment\": \"4Bytes\",\n                \"SuppressStartupBanner\": \"false\",\n                \"TreatWarningAsError\": \"true\",\n                \"TreatWChar_tAsBuiltInType\": \"false\",\n                \"UndefineAllPreprocessorDefinitions\": \"true\",\n                \"UndefinePreprocessorDefinitions\": \"wer\",\n                \"UseFullPaths\": \"true\",\n                \"WarningLevel\": \"Level3\",\n                \"WholeProgramOptimization\": \"true\",\n                \"XMLDocumentationFileName\": \"$(IntDir)c\",\n            },\n            \"Link\": {\n                \"AdditionalDependencies\": \"zx\",\n                \"AdditionalLibraryDirectories\": \"asd\",\n                \"AdditionalManifestDependencies\": \"s2\",\n                \"AdditionalOptions\": \"/mor2\",\n                \"AddModuleNamesToAssembly\": \"d1\",\n                \"AllowIsolation\": \"false\",\n                \"AssemblyDebug\": \"true\",\n                \"AssemblyLinkResource\": \"d5\",\n                \"BaseAddress\": \"23423\",\n                \"CLRImageType\": \"ForceSafeILImage\",\n                \"CLRThreadAttribute\": \"MTAThreadingAttribute\",\n                \"CLRUnmanagedCodeCheck\": \"true\",\n                \"DataExecutionPrevention\": \"\",\n                \"DelayLoadDLLs\": \"d4\",\n                \"DelaySign\": \"true\",\n                \"Driver\": \"UpOnly\",\n                \"EmbedManagedResourceFile\": \"d2\",\n                \"EnableCOMDATFolding\": \"false\",\n                \"EnableUAC\": \"false\",\n                \"EntryPointSymbol\": \"f5\",\n                \"FixedBaseAddress\": \"false\",\n                \"ForceSymbolReferences\": \"d3\",\n                \"FunctionOrder\": \"fssdfsd\",\n                \"GenerateDebugInformation\": \"true\",\n                \"GenerateMapFile\": \"true\",\n                \"HeapCommitSize\": \"13\",\n                \"HeapReserveSize\": \"12\",\n                \"IgnoreAllDefaultLibraries\": \"true\",\n                \"IgnoreEmbeddedIDL\": \"true\",\n                \"IgnoreSpecificDefaultLibraries\": \"flob;flok\",\n                \"ImportLibrary\": \"f4\",\n                \"KeyContainer\": \"f7\",\n                \"KeyFile\": \"f6\",\n                \"LargeAddressAware\": \"true\",\n                \"LinkErrorReporting\": \"QueueForNextLogin\",\n                \"LinkTimeCodeGeneration\": \"UseLinkTimeCodeGeneration\",\n                \"ManifestFile\": \"$(IntDir)$(TargetFileName).2intermediate.manifest\",\n                \"MapExports\": \"true\",\n                \"MapFileName\": \"d5\",\n                \"MergedIDLBaseFileName\": \"f2\",\n                \"MergeSections\": \"f5\",\n                \"MidlCommandFile\": \"f1\",\n                \"ModuleDefinitionFile\": \"sdsd\",\n                \"NoEntryPoint\": \"true\",\n                \"OptimizeReferences\": \"true\",\n                \"OutputFile\": \"$(OutDir)$(ProjectName)2.exe\",\n                \"PerUserRedirection\": \"true\",\n                \"Profile\": \"true\",\n                \"ProfileGuidedDatabase\": \"$(TargetDir)$(TargetName).pgdd\",\n                \"ProgramDatabaseFile\": \"Flob.pdb\",\n                \"RandomizedBaseAddress\": \"false\",\n                \"RegisterOutput\": \"true\",\n                \"SetChecksum\": \"false\",\n                \"ShowProgress\": \"LinkVerbose\",\n                \"StackCommitSize\": \"15\",\n                \"StackReserveSize\": \"14\",\n                \"StripPrivateSymbols\": \"d3\",\n                \"SubSystem\": \"Console\",\n                \"SupportUnloadOfDelayLoadedDLL\": \"true\",\n                \"SuppressStartupBanner\": \"false\",\n                \"SwapRunFromCD\": \"true\",\n                \"SwapRunFromNET\": \"true\",\n                \"TargetMachine\": \"MachineX86\",\n                \"TerminalServerAware\": \"false\",\n                \"TurnOffAssemblyGeneration\": \"true\",\n                \"TypeLibraryFile\": \"f3\",\n                \"TypeLibraryResourceID\": \"12\",\n                \"UACExecutionLevel\": \"RequireAdministrator\",\n                \"UACUIAccess\": \"true\",\n                \"Version\": \"333\",\n            },\n            \"ResourceCompile\": {\n                \"AdditionalIncludeDirectories\": \"f3\",\n                \"AdditionalOptions\": \"/more3\",\n                \"Culture\": \"0x0c0c\",\n                \"IgnoreStandardIncludePath\": \"true\",\n                \"PreprocessorDefinitions\": \"_UNICODE;UNICODE2\",\n                \"ResourceOutputFileName\": \"$(IntDir)%(Filename)3.res\",\n                \"ShowProgress\": \"true\",\n            },\n            \"Manifest\": {\n                \"AdditionalManifestFiles\": \"sfsdfsd\",\n                \"AdditionalOptions\": \"afdsdafsd\",\n                \"AssemblyIdentity\": \"sddfdsadfsa\",\n                \"ComponentFileName\": \"fsdfds\",\n                \"GenerateCatalogFiles\": \"true\",\n                \"InputResourceManifests\": \"asfsfdafs\",\n                \"OutputManifestFile\": \"$(TargetPath).manifestdfs\",\n                \"RegistrarScriptFile\": \"sdfsfd\",\n                \"ReplacementsFile\": \"sdffsd\",\n                \"SuppressStartupBanner\": \"false\",\n                \"TypeLibraryFile\": \"sfsd\",\n                \"UpdateFileHashes\": \"true\",\n                \"UpdateFileHashesSearchPath\": \"sfsd\",\n                \"VerboseOutput\": \"true\",\n            },\n            \"ProjectReference\": {\n                \"LinkLibraryDependencies\": \"false\",\n                \"UseLibraryDependencyInputs\": \"true\",\n            },\n            \"\": {\n                \"EmbedManifest\": \"false\",\n                \"GenerateManifest\": \"false\",\n                \"IgnoreImportLibrary\": \"true\",\n                \"LinkIncremental\": \"\",\n            },\n            \"ManifestResourceCompile\": {\n                \"ResourceOutputFileName\": \"$(IntDir)$(TargetFileName).embed.manifest.resfdsf\"  # noqa: E501\n            },\n        }\n        self.maxDiff = 9999  # on failure display a long diff\n        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(\n            msvs_settings, self.stderr\n        )\n        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)\n        self._ExpectedWarnings([])\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
  },
  {
    "path": "gyp/pylib/gyp/MSVSToolFile.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Visual Studio project reader/writer.\"\"\"\n\nfrom gyp import easy_xml\n\n\nclass Writer:\n    \"\"\"Visual Studio XML tool file writer.\"\"\"\n\n    def __init__(self, tool_file_path, name):\n        \"\"\"Initializes the tool file.\n\n        Args:\n          tool_file_path: Path to the tool file.\n          name: Name of the tool file.\n        \"\"\"\n        self.tool_file_path = tool_file_path\n        self.name = name\n        self.rules_section = [\"Rules\"]\n\n    def AddCustomBuildRule(\n        self, name, cmd, description, additional_dependencies, outputs, extensions\n    ):\n        \"\"\"Adds a rule to the tool file.\n\n        Args:\n          name: Name of the rule.\n          description: Description of the rule.\n          cmd: Command line of the rule.\n          additional_dependencies: other files which may trigger the rule.\n          outputs: outputs of the rule.\n          extensions: extensions handled by the rule.\n        \"\"\"\n        rule = [\n            \"CustomBuildRule\",\n            {\n                \"Name\": name,\n                \"ExecutionDescription\": description,\n                \"CommandLine\": cmd,\n                \"Outputs\": \";\".join(outputs),\n                \"FileExtensions\": \";\".join(extensions),\n                \"AdditionalDependencies\": \";\".join(additional_dependencies),\n            },\n        ]\n        self.rules_section.append(rule)\n\n    def WriteIfChanged(self):\n        \"\"\"Writes the tool file.\"\"\"\n        content = [\n            \"VisualStudioToolFile\",\n            {\"Version\": \"8.00\", \"Name\": self.name},\n            self.rules_section,\n        ]\n        easy_xml.WriteXmlIfChanged(\n            content, self.tool_file_path, encoding=\"Windows-1252\"\n        )\n"
  },
  {
    "path": "gyp/pylib/gyp/MSVSUserFile.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Visual Studio user preferences file writer.\"\"\"\n\nimport os\nimport re\nimport socket  # for gethostname\n\nfrom gyp import easy_xml\n\n# ------------------------------------------------------------------------------\n\n\ndef _FindCommandInPath(command):\n    \"\"\"If there are no slashes in the command given, this function\n    searches the PATH env to find the given command, and converts it\n    to an absolute path.  We have to do this because MSVS is looking\n    for an actual file to launch a debugger on, not just a command\n    line.  Note that this happens at GYP time, so anything needing to\n    be built needs to have a full path.\"\"\"\n    if \"/\" in command or \"\\\\\" in command:\n        # If the command already has path elements (either relative or\n        # absolute), then assume it is constructed properly.\n        return command\n    else:\n        # Search through the path list and find an existing file that\n        # we can access.\n        paths = os.environ.get(\"PATH\", \"\").split(os.pathsep)\n        for path in paths:\n            item = os.path.join(path, command)\n            if os.path.isfile(item) and os.access(item, os.X_OK):\n                return item\n    return command\n\n\ndef _QuoteWin32CommandLineArgs(args):\n    new_args = []\n    for arg in args:\n        # Replace all double-quotes with double-double-quotes to escape\n        # them for cmd shell, and then quote the whole thing if there\n        # are any.\n        if arg.find('\"') != -1:\n            arg = '\"\"'.join(arg.split('\"'))\n            arg = '\"%s\"' % arg\n\n        # Otherwise, if there are any spaces, quote the whole arg.\n        elif re.search(r\"[ \\t\\n]\", arg):\n            arg = '\"%s\"' % arg\n        new_args.append(arg)\n    return new_args\n\n\nclass Writer:\n    \"\"\"Visual Studio XML user user file writer.\"\"\"\n\n    def __init__(self, user_file_path, version, name):\n        \"\"\"Initializes the user file.\n\n        Args:\n          user_file_path: Path to the user file.\n          version: Version info.\n          name: Name of the user file.\n        \"\"\"\n        self.user_file_path = user_file_path\n        self.version = version\n        self.name = name\n        self.configurations = {}\n\n    def AddConfig(self, name):\n        \"\"\"Adds a configuration to the project.\n\n        Args:\n          name: Configuration name.\n        \"\"\"\n        self.configurations[name] = [\"Configuration\", {\"Name\": name}]\n\n    def AddDebugSettings(\n        self, config_name, command, environment={}, working_directory=\"\"\n    ):\n        \"\"\"Adds a DebugSettings node to the user file for a particular config.\n\n        Args:\n          command: command line to run.  First element in the list is the\n            executable.  All elements of the command will be quoted if\n            necessary.\n          working_directory: other files which may trigger the rule. (optional)\n        \"\"\"\n        command = _QuoteWin32CommandLineArgs(command)\n\n        abs_command = _FindCommandInPath(command[0])\n\n        if environment and isinstance(environment, dict):\n            env_list = [f'{key}=\"{val}\"' for (key, val) in environment.items()]\n            environment = \" \".join(env_list)\n        else:\n            environment = \"\"\n\n        n_cmd = [\n            \"DebugSettings\",\n            {\n                \"Command\": abs_command,\n                \"WorkingDirectory\": working_directory,\n                \"CommandArguments\": \" \".join(command[1:]),\n                \"RemoteMachine\": socket.gethostname(),\n                \"Environment\": environment,\n                \"EnvironmentMerge\": \"true\",\n                # Currently these are all \"dummy\" values that we're just setting\n                # in the default manner that MSVS does it.  We could use some of\n                # these to add additional capabilities, I suppose, but they might\n                # not have parity with other platforms then.\n                \"Attach\": \"false\",\n                \"DebuggerType\": \"3\",  # 'auto' debugger\n                \"Remote\": \"1\",\n                \"RemoteCommand\": \"\",\n                \"HttpUrl\": \"\",\n                \"PDBPath\": \"\",\n                \"SQLDebugging\": \"\",\n                \"DebuggerFlavor\": \"0\",\n                \"MPIRunCommand\": \"\",\n                \"MPIRunArguments\": \"\",\n                \"MPIRunWorkingDirectory\": \"\",\n                \"ApplicationCommand\": \"\",\n                \"ApplicationArguments\": \"\",\n                \"ShimCommand\": \"\",\n                \"MPIAcceptMode\": \"\",\n                \"MPIAcceptFilter\": \"\",\n            },\n        ]\n\n        # Find the config, and add it if it doesn't exist.\n        if config_name not in self.configurations:\n            self.AddConfig(config_name)\n\n        # Add the DebugSettings onto the appropriate config.\n        self.configurations[config_name].append(n_cmd)\n\n    def WriteIfChanged(self):\n        \"\"\"Writes the user file.\"\"\"\n        configs = [\"Configurations\"]\n        for config, spec in sorted(self.configurations.items()):\n            configs.append(spec)\n\n        content = [\n            \"VisualStudioUserFile\",\n            {\"Version\": self.version.ProjectVersion(), \"Name\": self.name},\n            configs,\n        ]\n        easy_xml.WriteXmlIfChanged(\n            content, self.user_file_path, encoding=\"Windows-1252\"\n        )\n"
  },
  {
    "path": "gyp/pylib/gyp/MSVSUtil.py",
    "content": "# Copyright (c) 2013 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Utility functions shared amongst the Windows generators.\"\"\"\n\nimport copy\nimport os\n\n# A dictionary mapping supported target types to extensions.\nTARGET_TYPE_EXT = {\n    \"executable\": \"exe\",\n    \"loadable_module\": \"dll\",\n    \"shared_library\": \"dll\",\n    \"static_library\": \"lib\",\n    \"windows_driver\": \"sys\",\n}\n\n\ndef _GetLargePdbShimCcPath():\n    \"\"\"Returns the path of the large_pdb_shim.cc file.\"\"\"\n    this_dir = os.path.abspath(os.path.dirname(__file__))\n    src_dir = os.path.abspath(os.path.join(this_dir, \"..\", \"..\"))\n    win_data_dir = os.path.join(src_dir, \"data\", \"win\")\n    large_pdb_shim_cc = os.path.join(win_data_dir, \"large-pdb-shim.cc\")\n    return large_pdb_shim_cc\n\n\ndef _DeepCopySomeKeys(in_dict, keys):\n    \"\"\"Performs a partial deep-copy on |in_dict|, only copying the keys in |keys|.\n\n    Arguments:\n      in_dict: The dictionary to copy.\n      keys: The keys to be copied. If a key is in this list and doesn't exist in\n          |in_dict| this is not an error.\n    Returns:\n      The partially deep-copied dictionary.\n    \"\"\"\n    d = {}\n    for key in keys:\n        if key not in in_dict:\n            continue\n        d[key] = copy.deepcopy(in_dict[key])\n    return d\n\n\ndef _SuffixName(name, suffix):\n    \"\"\"Add a suffix to the end of a target.\n\n    Arguments:\n      name: name of the target (foo#target)\n      suffix: the suffix to be added\n    Returns:\n      Target name with suffix added (foo_suffix#target)\n    \"\"\"\n    parts = name.rsplit(\"#\", 1)\n    parts[0] = f\"{parts[0]}_{suffix}\"\n    return \"#\".join(parts)\n\n\ndef _ShardName(name, number):\n    \"\"\"Add a shard number to the end of a target.\n\n    Arguments:\n      name: name of the target (foo#target)\n      number: shard number\n    Returns:\n      Target name with shard added (foo_1#target)\n    \"\"\"\n    return _SuffixName(name, str(number))\n\n\ndef ShardTargets(target_list, target_dicts):\n    \"\"\"Shard some targets apart to work around the linkers limits.\n\n    Arguments:\n      target_list: List of target pairs: 'base/base.gyp:base'.\n      target_dicts: Dict of target properties keyed on target pair.\n    Returns:\n      Tuple of the new sharded versions of the inputs.\n    \"\"\"\n    # Gather the targets to shard, and how many pieces.\n    targets_to_shard = {}\n    for t in target_dicts:\n        shards = int(target_dicts[t].get(\"msvs_shard\", 0))\n        if shards:\n            targets_to_shard[t] = shards\n    # Shard target_list.\n    new_target_list = []\n    for t in target_list:\n        if t in targets_to_shard:\n            for i in range(targets_to_shard[t]):\n                new_target_list.append(_ShardName(t, i))\n        else:\n            new_target_list.append(t)\n    # Shard target_dict.\n    new_target_dicts = {}\n    for t in target_dicts:\n        if t in targets_to_shard:\n            for i in range(targets_to_shard[t]):\n                name = _ShardName(t, i)\n                new_target_dicts[name] = copy.copy(target_dicts[t])\n                new_target_dicts[name][\"target_name\"] = _ShardName(\n                    new_target_dicts[name][\"target_name\"], i\n                )\n                sources = new_target_dicts[name].get(\"sources\", [])\n                new_sources = []\n                for pos in range(i, len(sources), targets_to_shard[t]):\n                    new_sources.append(sources[pos])\n                new_target_dicts[name][\"sources\"] = new_sources\n        else:\n            new_target_dicts[t] = target_dicts[t]\n    # Shard dependencies.\n    for t in sorted(new_target_dicts):\n        for deptype in (\"dependencies\", \"dependencies_original\"):\n            dependencies = copy.copy(new_target_dicts[t].get(deptype, []))\n            new_dependencies = []\n            for d in dependencies:\n                if d in targets_to_shard:\n                    for i in range(targets_to_shard[d]):\n                        new_dependencies.append(_ShardName(d, i))\n                else:\n                    new_dependencies.append(d)\n            new_target_dicts[t][deptype] = new_dependencies\n\n    return (new_target_list, new_target_dicts)\n\n\ndef _GetPdbPath(target_dict, config_name, vars):\n    \"\"\"Returns the path to the PDB file that will be generated by a given\n    configuration.\n\n    The lookup proceeds as follows:\n      - Look for an explicit path in the VCLinkerTool configuration block.\n      - Look for an 'msvs_large_pdb_path' variable.\n      - Use '<(PRODUCT_DIR)/<(product_name).(exe|dll).pdb' if 'product_name' is\n        specified.\n      - Use '<(PRODUCT_DIR)/<(target_name).(exe|dll).pdb'.\n\n    Arguments:\n      target_dict: The target dictionary to be searched.\n      config_name: The name of the configuration of interest.\n      vars: A dictionary of common GYP variables with generator-specific values.\n    Returns:\n      The path of the corresponding PDB file.\n    \"\"\"\n    config = target_dict[\"configurations\"][config_name]\n    msvs = config.setdefault(\"msvs_settings\", {})\n\n    linker = msvs.get(\"VCLinkerTool\", {})\n\n    pdb_path = linker.get(\"ProgramDatabaseFile\")\n    if pdb_path:\n        return pdb_path\n\n    variables = target_dict.get(\"variables\", {})\n    pdb_path = variables.get(\"msvs_large_pdb_path\", None)\n    if pdb_path:\n        return pdb_path\n\n    pdb_base = target_dict.get(\"product_name\", target_dict[\"target_name\"])\n    pdb_base = \"{}.{}.pdb\".format(pdb_base, TARGET_TYPE_EXT[target_dict[\"type\"]])\n    pdb_path = vars[\"PRODUCT_DIR\"] + \"/\" + pdb_base\n\n    return pdb_path\n\n\ndef InsertLargePdbShims(target_list, target_dicts, vars):\n    \"\"\"Insert a shim target that forces the linker to use 4KB pagesize PDBs.\n\n    This is a workaround for targets with PDBs greater than 1GB in size, the\n    limit for the 1KB pagesize PDBs created by the linker by default.\n\n    Arguments:\n      target_list: List of target pairs: 'base/base.gyp:base'.\n      target_dicts: Dict of target properties keyed on target pair.\n      vars: A dictionary of common GYP variables with generator-specific values.\n    Returns:\n      Tuple of the shimmed version of the inputs.\n    \"\"\"\n    # Determine which targets need shimming.\n    targets_to_shim = []\n    for t in target_dicts:\n        target_dict = target_dicts[t]\n\n        # We only want to shim targets that have msvs_large_pdb enabled.\n        if not int(target_dict.get(\"msvs_large_pdb\", 0)):\n            continue\n        # This is intended for executable, shared_library and loadable_module\n        # targets where every configuration is set up to produce a PDB output.\n        # If any of these conditions is not true then the shim logic will fail\n        # below.\n        targets_to_shim.append(t)\n\n    large_pdb_shim_cc = _GetLargePdbShimCcPath()\n\n    for t in targets_to_shim:\n        target_dict = target_dicts[t]\n        target_name = target_dict.get(\"target_name\")\n\n        base_dict = _DeepCopySomeKeys(\n            target_dict, [\"configurations\", \"default_configuration\", \"toolset\"]\n        )\n\n        # This is the dict for copying the source file (part of the GYP tree)\n        # to the intermediate directory of the project. This is necessary because\n        # we can't always build a relative path to the shim source file (on Windows\n        # GYP and the project may be on different drives), and Ninja hates absolute\n        # paths (it ends up generating the .obj and .obj.d alongside the source\n        # file, polluting GYPs tree).\n        copy_suffix = \"large_pdb_copy\"\n        copy_target_name = target_name + \"_\" + copy_suffix\n        full_copy_target_name = _SuffixName(t, copy_suffix)\n        shim_cc_basename = os.path.basename(large_pdb_shim_cc)\n        shim_cc_dir = vars[\"SHARED_INTERMEDIATE_DIR\"] + \"/\" + copy_target_name\n        shim_cc_path = shim_cc_dir + \"/\" + shim_cc_basename\n        copy_dict = copy.deepcopy(base_dict)\n        copy_dict[\"target_name\"] = copy_target_name\n        copy_dict[\"type\"] = \"none\"\n        copy_dict[\"sources\"] = [large_pdb_shim_cc]\n        copy_dict[\"copies\"] = [\n            {\"destination\": shim_cc_dir, \"files\": [large_pdb_shim_cc]}\n        ]\n\n        # This is the dict for the PDB generating shim target. It depends on the\n        # copy target.\n        shim_suffix = \"large_pdb_shim\"\n        shim_target_name = target_name + \"_\" + shim_suffix\n        full_shim_target_name = _SuffixName(t, shim_suffix)\n        shim_dict = copy.deepcopy(base_dict)\n        shim_dict[\"target_name\"] = shim_target_name\n        shim_dict[\"type\"] = \"static_library\"\n        shim_dict[\"sources\"] = [shim_cc_path]\n        shim_dict[\"dependencies\"] = [full_copy_target_name]\n\n        # Set up the shim to output its PDB to the same location as the final linker\n        # target.\n        for config_name, config in shim_dict.get(\"configurations\").items():\n            pdb_path = _GetPdbPath(target_dict, config_name, vars)\n\n            # A few keys that we don't want to propagate.\n            for key in [\"msvs_precompiled_header\", \"msvs_precompiled_source\", \"test\"]:\n                config.pop(key, None)\n\n            msvs = config.setdefault(\"msvs_settings\", {})\n\n            # Update the compiler directives in the shim target.\n            compiler = msvs.setdefault(\"VCCLCompilerTool\", {})\n            compiler[\"DebugInformationFormat\"] = \"3\"\n            compiler[\"ProgramDataBaseFileName\"] = pdb_path\n\n            # Set the explicit PDB path in the appropriate configuration of the\n            # original target.\n            config = target_dict[\"configurations\"][config_name]\n            msvs = config.setdefault(\"msvs_settings\", {})\n            linker = msvs.setdefault(\"VCLinkerTool\", {})\n            linker[\"GenerateDebugInformation\"] = \"true\"\n            linker[\"ProgramDatabaseFile\"] = pdb_path\n\n        # Add the new targets. They must go to the beginning of the list so that\n        # the dependency generation works as expected in ninja.\n        target_list.insert(0, full_copy_target_name)\n        target_list.insert(0, full_shim_target_name)\n        target_dicts[full_copy_target_name] = copy_dict\n        target_dicts[full_shim_target_name] = shim_dict\n\n        # Update the original target to depend on the shim target.\n        target_dict.setdefault(\"dependencies\", []).append(full_shim_target_name)\n\n    return (target_list, target_dicts)\n"
  },
  {
    "path": "gyp/pylib/gyp/MSVSVersion.py",
    "content": "# Copyright (c) 2013 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Handle version information related to Visual Stuio.\"\"\"\n\nimport errno\nimport glob\nimport os\nimport re\nimport subprocess\nimport sys\n\n\ndef JoinPath(*args):\n    return os.path.normpath(os.path.join(*args))\n\n\nclass VisualStudioVersion:\n    \"\"\"Information regarding a version of Visual Studio.\"\"\"\n\n    def __init__(\n        self,\n        short_name,\n        description,\n        solution_version,\n        project_version,\n        flat_sln,\n        uses_vcxproj,\n        path,\n        sdk_based,\n        default_toolset=None,\n        compatible_sdks=None,\n    ):\n        self.short_name = short_name\n        self.description = description\n        self.solution_version = solution_version\n        self.project_version = project_version\n        self.flat_sln = flat_sln\n        self.uses_vcxproj = uses_vcxproj\n        self.path = path\n        self.sdk_based = sdk_based\n        self.default_toolset = default_toolset\n        compatible_sdks = compatible_sdks or []\n        compatible_sdks.sort(key=lambda v: float(v.replace(\"v\", \"\")), reverse=True)\n        self.compatible_sdks = compatible_sdks\n\n    def ShortName(self):\n        return self.short_name\n\n    def Description(self):\n        \"\"\"Get the full description of the version.\"\"\"\n        return self.description\n\n    def SolutionVersion(self):\n        \"\"\"Get the version number of the sln files.\"\"\"\n        return self.solution_version\n\n    def ProjectVersion(self):\n        \"\"\"Get the version number of the vcproj or vcxproj files.\"\"\"\n        return self.project_version\n\n    def FlatSolution(self):\n        return self.flat_sln\n\n    def UsesVcxproj(self):\n        \"\"\"Returns true if this version uses a vcxproj file.\"\"\"\n        return self.uses_vcxproj\n\n    def ProjectExtension(self):\n        \"\"\"Returns the file extension for the project.\"\"\"\n        return (self.uses_vcxproj and \".vcxproj\") or \".vcproj\"\n\n    def Path(self):\n        \"\"\"Returns the path to Visual Studio installation.\"\"\"\n        return self.path\n\n    def ToolPath(self, tool):\n        \"\"\"Returns the path to a given compiler tool.\"\"\"\n        return os.path.normpath(os.path.join(self.path, \"VC/bin\", tool))\n\n    def DefaultToolset(self):\n        \"\"\"Returns the msbuild toolset version that will be used in the absence\n        of a user override.\"\"\"\n        return self.default_toolset\n\n    def _SetupScriptInternal(self, target_arch):\n        \"\"\"Returns a command (with arguments) to be used to set up the\n        environment.\"\"\"\n        assert target_arch in (\"x86\", \"x64\"), \"target_arch not supported\"\n        # If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the\n        # depot_tools build tools and should run SetEnv.Cmd to set up the\n        # environment. The check for WindowsSDKDir alone is not sufficient because\n        # this is set by running vcvarsall.bat.\n        sdk_dir = os.environ.get(\"WindowsSDKDir\", \"\")\n        setup_path = JoinPath(sdk_dir, \"Bin\", \"SetEnv.Cmd\")\n        if self.sdk_based and sdk_dir and os.path.exists(setup_path):\n            return [setup_path, \"/\" + target_arch]\n\n        is_host_arch_x64 = (\n            os.environ.get(\"PROCESSOR_ARCHITECTURE\") == \"AMD64\"\n            or os.environ.get(\"PROCESSOR_ARCHITEW6432\") == \"AMD64\"\n        )\n\n        # For VS2017 (and newer) it's fairly easy\n        if self.short_name >= \"2017\":\n            script_path = JoinPath(\n                self.path, \"VC\", \"Auxiliary\", \"Build\", \"vcvarsall.bat\"\n            )\n\n            # Always use a native executable, cross-compiling if necessary.\n            host_arch = \"amd64\" if is_host_arch_x64 else \"x86\"\n            msvc_target_arch = \"amd64\" if target_arch == \"x64\" else \"x86\"\n            arg = host_arch\n            if host_arch != msvc_target_arch:\n                arg += \"_\" + msvc_target_arch\n\n            return [script_path, arg]\n\n        # We try to find the best version of the env setup batch.\n        vcvarsall = JoinPath(self.path, \"VC\", \"vcvarsall.bat\")\n        if target_arch == \"x86\":\n            if (\n                self.short_name >= \"2013\"\n                and self.short_name[-1] != \"e\"\n                and is_host_arch_x64\n            ):\n                # VS2013 and later, non-Express have a x64-x86 cross that we want\n                # to prefer.\n                return [vcvarsall, \"amd64_x86\"]\n            else:\n                # Otherwise, the standard x86 compiler. We don't use VC/vcvarsall.bat\n                # for x86 because vcvarsall calls vcvars32, which it can only find if\n                # VS??COMNTOOLS is set, which isn't guaranteed.\n                return [JoinPath(self.path, \"Common7\", \"Tools\", \"vsvars32.bat\")]\n        elif target_arch == \"x64\":\n            arg = \"x86_amd64\"\n            # Use the 64-on-64 compiler if we're not using an express edition and\n            # we're running on a 64bit OS.\n            if self.short_name[-1] != \"e\" and is_host_arch_x64:\n                arg = \"amd64\"\n            return [vcvarsall, arg]\n\n    def SetupScript(self, target_arch):\n        script_data = self._SetupScriptInternal(target_arch)\n        script_path = script_data[0]\n        if not os.path.exists(script_path):\n            raise Exception(\n                \"%s is missing - make sure VC++ tools are installed.\" % script_path\n            )\n        return script_data\n\n\ndef _RegistryQueryBase(sysdir, key, value):\n    \"\"\"Use reg.exe to read a particular key.\n\n    While ideally we might use the win32 module, we would like gyp to be\n    python neutral, so for instance cygwin python lacks this module.\n\n    Arguments:\n      sysdir: The system subdirectory to attempt to launch reg.exe from.\n      key: The registry key to read from.\n      value: The particular value to read.\n    Return:\n      stdout from reg.exe, or None for failure.\n    \"\"\"\n    # Skip if not on Windows or Python Win32 setup issue\n    if sys.platform not in (\"win32\", \"cygwin\"):\n        return None\n    # Setup params to pass to and attempt to launch reg.exe\n    cmd = [os.path.join(os.environ.get(\"WINDIR\", \"\"), sysdir, \"reg.exe\"), \"query\", key]\n    if value:\n        cmd.extend([\"/v\", value])\n    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n    # Obtain the stdout from reg.exe, reading to the end so p.returncode is valid\n    # Note that the error text may be in [1] in some cases\n    text = p.communicate()[0].decode(\"utf-8\")\n    # Check return code from reg.exe; officially 0==success and 1==error\n    if p.returncode:\n        return None\n    return text\n\n\ndef _RegistryQuery(key, value=None):\n    r\"\"\"Use reg.exe to read a particular key through _RegistryQueryBase.\n\n    First tries to launch from %WinDir%\\Sysnative to avoid WoW64 redirection. If\n    that fails, it falls back to System32.  Sysnative is available on Vista and\n    up and available on Windows Server 2003 and XP through KB patch 942589. Note\n    that Sysnative will always fail if using 64-bit python due to it being a\n    virtual directory and System32 will work correctly in the first place.\n\n    KB 942589 - http://support.microsoft.com/kb/942589/en-us.\n\n    Arguments:\n      key: The registry key.\n      value: The particular registry value to read (optional).\n    Return:\n      stdout from reg.exe, or None for failure.\n    \"\"\"\n    text = None\n    try:\n        text = _RegistryQueryBase(\"Sysnative\", key, value)\n    except OSError as e:\n        if e.errno == errno.ENOENT:\n            text = _RegistryQueryBase(\"System32\", key, value)\n        else:\n            raise\n    return text\n\n\ndef _RegistryGetValueUsingWinReg(key, value):\n    \"\"\"Use the _winreg module to obtain the value of a registry key.\n\n    Args:\n      key: The registry key.\n      value: The particular registry value to read.\n    Return:\n      contents of the registry key's value, or None on failure.  Throws\n      ImportError if winreg is unavailable.\n    \"\"\"\n    from winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx  # noqa: PLC0415\n\n    try:\n        root, subkey = key.split(\"\\\\\", 1)\n        assert root == \"HKLM\"  # Only need HKLM for now.\n        with OpenKey(HKEY_LOCAL_MACHINE, subkey) as hkey:\n            return QueryValueEx(hkey, value)[0]\n    except OSError:\n        return None\n\n\ndef _RegistryGetValue(key, value):\n    \"\"\"Use _winreg or reg.exe to obtain the value of a registry key.\n\n    Using _winreg is preferable because it solves an issue on some corporate\n    environments where access to reg.exe is locked down. However, we still need\n    to fallback to reg.exe for the case where the _winreg module is not available\n    (for example in cygwin python).\n\n    Args:\n      key: The registry key.\n      value: The particular registry value to read.\n    Return:\n      contents of the registry key's value, or None on failure.\n    \"\"\"\n    try:\n        return _RegistryGetValueUsingWinReg(key, value)\n    except ImportError:\n        pass\n\n    # Fallback to reg.exe if we fail to import _winreg.\n    text = _RegistryQuery(key, value)\n    if not text:\n        return None\n    # Extract value.\n    match = re.search(r\"REG_\\w+\\s+([^\\r]+)\\r\\n\", text)\n    if not match:\n        return None\n    return match.group(1)\n\n\ndef _CreateVersion(name, path, sdk_based=False):\n    \"\"\"Sets up MSVS project generation.\n\n    Setup is based off the GYP_MSVS_VERSION environment variable or whatever is\n    autodetected if GYP_MSVS_VERSION is not explicitly specified. If a version is\n    passed in that doesn't match a value in versions python will throw a error.\n    \"\"\"\n    if path:\n        path = os.path.normpath(path)\n    versions = {\n        \"2026\": VisualStudioVersion(\n            \"2026\",\n            \"Visual Studio 2026\",\n            solution_version=\"12.00\",\n            project_version=\"18.0\",\n            flat_sln=False,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v145\",\n            compatible_sdks=[\"v8.1\", \"v10.0\"],\n        ),\n        \"2022\": VisualStudioVersion(\n            \"2022\",\n            \"Visual Studio 2022\",\n            solution_version=\"12.00\",\n            project_version=\"17.0\",\n            flat_sln=False,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v143\",\n            compatible_sdks=[\"v8.1\", \"v10.0\"],\n        ),\n        \"2019\": VisualStudioVersion(\n            \"2019\",\n            \"Visual Studio 2019\",\n            solution_version=\"12.00\",\n            project_version=\"16.0\",\n            flat_sln=False,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v142\",\n            compatible_sdks=[\"v8.1\", \"v10.0\"],\n        ),\n        \"2017\": VisualStudioVersion(\n            \"2017\",\n            \"Visual Studio 2017\",\n            solution_version=\"12.00\",\n            project_version=\"15.0\",\n            flat_sln=False,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v141\",\n            compatible_sdks=[\"v8.1\", \"v10.0\"],\n        ),\n        \"2015\": VisualStudioVersion(\n            \"2015\",\n            \"Visual Studio 2015\",\n            solution_version=\"12.00\",\n            project_version=\"14.0\",\n            flat_sln=False,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v140\",\n        ),\n        \"2013\": VisualStudioVersion(\n            \"2013\",\n            \"Visual Studio 2013\",\n            solution_version=\"13.00\",\n            project_version=\"12.0\",\n            flat_sln=False,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v120\",\n        ),\n        \"2013e\": VisualStudioVersion(\n            \"2013e\",\n            \"Visual Studio 2013\",\n            solution_version=\"13.00\",\n            project_version=\"12.0\",\n            flat_sln=True,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v120\",\n        ),\n        \"2012\": VisualStudioVersion(\n            \"2012\",\n            \"Visual Studio 2012\",\n            solution_version=\"12.00\",\n            project_version=\"4.0\",\n            flat_sln=False,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v110\",\n        ),\n        \"2012e\": VisualStudioVersion(\n            \"2012e\",\n            \"Visual Studio 2012\",\n            solution_version=\"12.00\",\n            project_version=\"4.0\",\n            flat_sln=True,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n            default_toolset=\"v110\",\n        ),\n        \"2010\": VisualStudioVersion(\n            \"2010\",\n            \"Visual Studio 2010\",\n            solution_version=\"11.00\",\n            project_version=\"4.0\",\n            flat_sln=False,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n        ),\n        \"2010e\": VisualStudioVersion(\n            \"2010e\",\n            \"Visual C++ Express 2010\",\n            solution_version=\"11.00\",\n            project_version=\"4.0\",\n            flat_sln=True,\n            uses_vcxproj=True,\n            path=path,\n            sdk_based=sdk_based,\n        ),\n        \"2008\": VisualStudioVersion(\n            \"2008\",\n            \"Visual Studio 2008\",\n            solution_version=\"10.00\",\n            project_version=\"9.00\",\n            flat_sln=False,\n            uses_vcxproj=False,\n            path=path,\n            sdk_based=sdk_based,\n        ),\n        \"2008e\": VisualStudioVersion(\n            \"2008e\",\n            \"Visual Studio 2008\",\n            solution_version=\"10.00\",\n            project_version=\"9.00\",\n            flat_sln=True,\n            uses_vcxproj=False,\n            path=path,\n            sdk_based=sdk_based,\n        ),\n        \"2005\": VisualStudioVersion(\n            \"2005\",\n            \"Visual Studio 2005\",\n            solution_version=\"9.00\",\n            project_version=\"8.00\",\n            flat_sln=False,\n            uses_vcxproj=False,\n            path=path,\n            sdk_based=sdk_based,\n        ),\n        \"2005e\": VisualStudioVersion(\n            \"2005e\",\n            \"Visual Studio 2005\",\n            solution_version=\"9.00\",\n            project_version=\"8.00\",\n            flat_sln=True,\n            uses_vcxproj=False,\n            path=path,\n            sdk_based=sdk_based,\n        ),\n    }\n    return versions[str(name)]\n\n\ndef _ConvertToCygpath(path):\n    \"\"\"Convert to cygwin path if we are using cygwin.\"\"\"\n    if sys.platform == \"cygwin\":\n        p = subprocess.Popen([\"cygpath\", path], stdout=subprocess.PIPE)\n        path = p.communicate()[0].decode(\"utf-8\").strip()\n    return path\n\n\ndef _DetectVisualStudioVersions(versions_to_check, force_express):\n    \"\"\"Collect the list of installed visual studio versions.\n\n    Returns:\n      A list of visual studio versions installed in descending order of\n      usage preference.\n      Base this on the registry and a quick check if devenv.exe exists.\n      Possibilities are:\n        2005(e) - Visual Studio 2005 (8)\n        2008(e) - Visual Studio 2008 (9)\n        2010(e) - Visual Studio 2010 (10)\n        2012(e) - Visual Studio 2012 (11)\n        2013(e) - Visual Studio 2013 (12)\n        2015    - Visual Studio 2015 (14)\n        2017    - Visual Studio 2017 (15)\n        2019    - Visual Studio 2019 (16)\n        2022    - Visual Studio 2022 (17)\n      Where (e) is e for express editions of MSVS and blank otherwise.\n    \"\"\"\n    version_to_year = {\n        \"8.0\": \"2005\",\n        \"9.0\": \"2008\",\n        \"10.0\": \"2010\",\n        \"11.0\": \"2012\",\n        \"12.0\": \"2013\",\n        \"14.0\": \"2015\",\n        \"15.0\": \"2017\",\n        \"16.0\": \"2019\",\n        \"17.0\": \"2022\",\n        \"18.0\": \"2026\",\n    }\n    versions = []\n    for version in versions_to_check:\n        # Old method of searching for which VS version is installed\n        # We don't use the 2010-encouraged-way because we also want to get the\n        # path to the binaries, which it doesn't offer.\n        keys = [\n            r\"HKLM\\Software\\Microsoft\\VisualStudio\\%s\" % version,\n            r\"HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\%s\" % version,\n            r\"HKLM\\Software\\Microsoft\\VCExpress\\%s\" % version,\n            r\"HKLM\\Software\\Wow6432Node\\Microsoft\\VCExpress\\%s\" % version,\n        ]\n        for index in range(len(keys)):\n            path = _RegistryGetValue(keys[index], \"InstallDir\")\n            if not path:\n                continue\n            path = _ConvertToCygpath(path)\n            # Check for full.\n            full_path = os.path.join(path, \"devenv.exe\")\n            express_path = os.path.join(path, \"*express.exe\")\n            if not force_express and os.path.exists(full_path):\n                # Add this one.\n                versions.append(\n                    _CreateVersion(\n                        version_to_year[version], os.path.join(path, \"..\", \"..\")\n                    )\n                )\n            # Check for express.\n            elif glob.glob(express_path):\n                # Add this one.\n                versions.append(\n                    _CreateVersion(\n                        version_to_year[version] + \"e\", os.path.join(path, \"..\", \"..\")\n                    )\n                )\n\n        # The old method above does not work when only SDK is installed.\n        keys = [\n            r\"HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7\",\n            r\"HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\",\n            r\"HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VS7\",\n            r\"HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VS7\",\n        ]\n        for index in range(len(keys)):\n            path = _RegistryGetValue(keys[index], version)\n            if not path:\n                continue\n            path = _ConvertToCygpath(path)\n            if version == \"15.0\":\n                if os.path.exists(path):\n                    versions.append(_CreateVersion(\"2017\", path))\n            elif version != \"14.0\":  # There is no Express edition for 2015.\n                versions.append(\n                    _CreateVersion(\n                        version_to_year[version] + \"e\",\n                        os.path.join(path, \"..\"),\n                        sdk_based=True,\n                    )\n                )\n\n    return versions\n\n\ndef SelectVisualStudioVersion(version=\"auto\", allow_fallback=True):\n    \"\"\"Select which version of Visual Studio projects to generate.\n\n    Arguments:\n      version: Hook to allow caller to force a particular version (vs auto).\n    Returns:\n      An object representing a visual studio project format version.\n    \"\"\"\n    # In auto mode, check environment variable for override.\n    if version == \"auto\":\n        version = os.environ.get(\"GYP_MSVS_VERSION\", \"auto\")\n    version_map = {\n        \"auto\": (\n            \"18.0\",\n            \"17.0\",\n            \"16.0\",\n            \"15.0\",\n            \"14.0\",\n            \"12.0\",\n            \"10.0\",\n            \"9.0\",\n            \"8.0\",\n            \"11.0\",\n        ),\n        \"2005\": (\"8.0\",),\n        \"2005e\": (\"8.0\",),\n        \"2008\": (\"9.0\",),\n        \"2008e\": (\"9.0\",),\n        \"2010\": (\"10.0\",),\n        \"2010e\": (\"10.0\",),\n        \"2012\": (\"11.0\",),\n        \"2012e\": (\"11.0\",),\n        \"2013\": (\"12.0\",),\n        \"2013e\": (\"12.0\",),\n        \"2015\": (\"14.0\",),\n        \"2017\": (\"15.0\",),\n        \"2019\": (\"16.0\",),\n        \"2022\": (\"17.0\",),\n        \"2026\": (\"18.0\",),\n    }\n    if override_path := os.environ.get(\"GYP_MSVS_OVERRIDE_PATH\"):\n        msvs_version = os.environ.get(\"GYP_MSVS_VERSION\")\n        if not msvs_version:\n            raise ValueError(\n                \"GYP_MSVS_OVERRIDE_PATH requires GYP_MSVS_VERSION to be \"\n                \"set to a particular version (e.g. 2010e).\"\n            )\n        return _CreateVersion(msvs_version, override_path, sdk_based=True)\n    version = str(version)\n    versions = _DetectVisualStudioVersions(version_map[version], \"e\" in version)\n    if not versions:\n        if not allow_fallback:\n            raise ValueError(\"Could not locate Visual Studio installation.\")\n        if version == \"auto\":\n            # Default to 2005 if we couldn't find anything\n            return _CreateVersion(\"2005\", None)\n        else:\n            return _CreateVersion(version, None)\n    return versions[0]\n"
  },
  {
    "path": "gyp/pylib/gyp/__init__.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\nfrom __future__ import annotations\n\nimport argparse\nimport copy\nimport os.path\nimport re\nimport shlex\nimport sys\nimport traceback\n\nimport gyp.input\nfrom gyp.common import GypError\n\n# Default debug modes for GYP\ndebug = {}\n\n# List of \"official\" debug modes, but you can use anything you like.\nDEBUG_GENERAL = \"general\"\nDEBUG_VARIABLES = \"variables\"\nDEBUG_INCLUDES = \"includes\"\n\n\ndef EscapeForCString(string: bytes | str) -> str:\n    if isinstance(string, str):\n        string = string.encode(encoding=\"utf8\")\n\n    backslash_or_double_quote = {ord(\"\\\\\"), ord('\"')}\n    result = \"\"\n    for char in string:\n        if char in backslash_or_double_quote or not 32 <= char < 127:\n            result += \"\\\\%03o\" % char\n        else:\n            result += chr(char)\n    return result\n\n\ndef DebugOutput(mode, message, *args):\n    if \"all\" in gyp.debug or mode in gyp.debug:\n        ctx = (\"unknown\", 0, \"unknown\")\n        try:\n            f = traceback.extract_stack(limit=2)\n            if f:\n                ctx = f[0][:3]\n        except Exception:\n            pass\n        if args:\n            message %= args\n        print(\n            \"%s:%s:%d:%s %s\"\n            % (mode.upper(), os.path.basename(ctx[0]), ctx[1], ctx[2], message)\n        )\n\n\ndef FindBuildFiles():\n    extension = \".gyp\"\n    files = os.listdir(os.getcwd())\n    build_files = []\n    for file in files:\n        if file.endswith(extension):\n            build_files.append(file)\n    return build_files\n\n\ndef Load(\n    build_files,\n    format,\n    default_variables={},\n    includes=[],\n    depth=\".\",\n    params=None,\n    check=False,\n    circular_check=True,\n):\n    \"\"\"\n    Loads one or more specified build files.\n    default_variables and includes will be copied before use.\n    Returns the generator for the specified format and the\n    data returned by loading the specified build files.\n    \"\"\"\n    if params is None:\n        params = {}\n\n    if \"-\" in format:\n        format, params[\"flavor\"] = format.split(\"-\", 1)\n\n    default_variables = copy.copy(default_variables)\n\n    # Default variables provided by this program and its modules should be\n    # named WITH_CAPITAL_LETTERS to provide a distinct \"best practice\" namespace,\n    # avoiding collisions with user and automatic variables.\n    default_variables[\"GENERATOR\"] = format\n    default_variables[\"GENERATOR_FLAVOR\"] = params.get(\"flavor\", \"\")\n\n    # Format can be a custom python file, or by default the name of a module\n    # within gyp.generator.\n    if format.endswith(\".py\"):\n        generator_name = os.path.splitext(format)[0]\n        path, generator_name = os.path.split(generator_name)\n\n        # Make sure the path to the custom generator is in sys.path\n        # Don't worry about removing it once we are done.  Keeping the path\n        # to each generator that is used in sys.path is likely harmless and\n        # arguably a good idea.\n        path = os.path.abspath(path)\n        if path not in sys.path:\n            sys.path.insert(0, path)\n    else:\n        generator_name = \"gyp.generator.\" + format\n\n    # These parameters are passed in order (as opposed to by key)\n    # because ActivePython cannot handle key parameters to __import__.\n    generator = __import__(generator_name, globals(), locals(), generator_name)\n    for key, val in generator.generator_default_variables.items():\n        default_variables.setdefault(key, val)\n\n    output_dir = params[\"options\"].generator_output or params[\"options\"].toplevel_dir\n    if default_variables[\"GENERATOR\"] == \"ninja\":\n        product_dir_abs = os.path.join(\n            output_dir, \"out\", default_variables.get(\"build_type\", \"default\")\n        )\n    else:\n        product_dir_abs = os.path.join(\n            output_dir, default_variables[\"CONFIGURATION_NAME\"]\n        )\n\n    default_variables.setdefault(\"PRODUCT_DIR_ABS\", product_dir_abs)\n    default_variables.setdefault(\n        \"PRODUCT_DIR_ABS_CSTR\", EscapeForCString(product_dir_abs)\n    )\n\n    # Give the generator the opportunity to set additional variables based on\n    # the params it will receive in the output phase.\n    if getattr(generator, \"CalculateVariables\", None):\n        generator.CalculateVariables(default_variables, params)\n\n    # Give the generator the opportunity to set generator_input_info based on\n    # the params it will receive in the output phase.\n    if getattr(generator, \"CalculateGeneratorInputInfo\", None):\n        generator.CalculateGeneratorInputInfo(params)\n\n    # Fetch the generator specific info that gets fed to input, we use getattr\n    # so we can default things and the generators only have to provide what\n    # they need.\n    generator_input_info = {\n        \"non_configuration_keys\": getattr(\n            generator, \"generator_additional_non_configuration_keys\", []\n        ),\n        \"path_sections\": getattr(generator, \"generator_additional_path_sections\", []),\n        \"extra_sources_for_rules\": getattr(\n            generator, \"generator_extra_sources_for_rules\", []\n        ),\n        \"generator_supports_multiple_toolsets\": getattr(\n            generator, \"generator_supports_multiple_toolsets\", False\n        ),\n        \"generator_wants_static_library_dependencies_adjusted\": getattr(\n            generator, \"generator_wants_static_library_dependencies_adjusted\", True\n        ),\n        \"generator_wants_sorted_dependencies\": getattr(\n            generator, \"generator_wants_sorted_dependencies\", False\n        ),\n        \"generator_filelist_paths\": getattr(\n            generator, \"generator_filelist_paths\", None\n        ),\n    }\n\n    # Process the input specific to this generator.\n    result = gyp.input.Load(\n        build_files,\n        default_variables,\n        includes[:],\n        depth,\n        generator_input_info,\n        check,\n        circular_check,\n        params[\"parallel\"],\n        params[\"root_targets\"],\n    )\n    return [generator] + result\n\n\ndef NameValueListToDict(name_value_list):\n    \"\"\"\n    Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary\n    of the pairs.  If a string is simply NAME, then the value in the dictionary\n    is set to True.  If VALUE can be converted to an integer, it is.\n    \"\"\"\n    result = {}\n    for item in name_value_list:\n        tokens = item.split(\"=\", 1)\n        if len(tokens) == 2:\n            # If we can make it an int, use that, otherwise, use the string.\n            try:\n                token_value = int(tokens[1])\n            except ValueError:\n                token_value = tokens[1]\n            # Set the variable to the supplied value.\n            result[tokens[0]] = token_value\n        else:\n            # No value supplied, treat it as a boolean and set it.\n            result[tokens[0]] = True\n    return result\n\n\ndef ShlexEnv(env_name):\n    if flags := os.environ.get(env_name) or []:\n        flags = shlex.split(flags)\n    return flags\n\n\ndef FormatOpt(opt, value):\n    if opt.startswith(\"--\"):\n        return f\"{opt}={value}\"\n    return opt + value\n\n\ndef RegenerateAppendFlag(flag, values, predicate, env_name, options):\n    \"\"\"Regenerate a list of command line flags, for an option of action='append'.\n\n    The |env_name|, if given, is checked in the environment and used to generate\n    an initial list of options, then the options that were specified on the\n    command line (given in |values|) are appended.  This matches the handling of\n    environment variables and command line flags where command line flags override\n    the environment, while not requiring the environment to be set when the flags\n    are used again.\n    \"\"\"\n    flags = []\n    if options.use_environment and env_name:\n        for flag_value in ShlexEnv(env_name):\n            value = FormatOpt(flag, predicate(flag_value))\n            if value in flags:\n                flags.remove(value)\n            flags.append(value)\n    if values:\n        for flag_value in values:\n            flags.append(FormatOpt(flag, predicate(flag_value)))\n    return flags\n\n\ndef RegenerateFlags(options):\n    \"\"\"Given a parsed options object, and taking the environment variables into\n    account, returns a list of flags that should regenerate an equivalent options\n    object (even in the absence of the environment variables.)\n\n    Any path options will be normalized relative to depth.\n\n    The format flag is not included, as it is assumed the calling generator will\n    set that as appropriate.\n    \"\"\"\n\n    def FixPath(path):\n        path = gyp.common.FixIfRelativePath(path, options.depth)\n        if not path:\n            return os.path.curdir\n        return path\n\n    def Noop(value):\n        return value\n\n    # We always want to ignore the environment when regenerating, to avoid\n    # duplicate or changed flags in the environment at the time of regeneration.\n    flags = [\"--ignore-environment\"]\n    for name, metadata in options._regeneration_metadata.items():\n        opt = metadata[\"opt\"]\n        value = getattr(options, name)\n        value_predicate = (metadata[\"type\"] == \"path\" and FixPath) or Noop\n        action = metadata[\"action\"]\n        env_name = metadata[\"env_name\"]\n        if action == \"append\":\n            flags.extend(\n                RegenerateAppendFlag(opt, value, value_predicate, env_name, options)\n            )\n        elif action in (\"store\", None):  # None is a synonym for 'store'.\n            if value:\n                flags.append(FormatOpt(opt, value_predicate(value)))\n            elif options.use_environment and env_name and os.environ.get(env_name):\n                flags.append(FormatOpt(opt, value_predicate(os.environ.get(env_name))))\n        elif action in (\"store_true\", \"store_false\"):\n            if (action == \"store_true\" and value) or (\n                action == \"store_false\" and not value\n            ):\n                flags.append(opt)\n            elif options.use_environment and env_name:\n                print(\n                    \"Warning: environment regeneration unimplemented \"\n                    \"for %s flag %r env_name %r\" % (action, opt, env_name),\n                    file=sys.stderr,\n                )\n        else:\n            print(\n                \"Warning: regeneration unimplemented for action %r \"\n                \"flag %r\" % (action, opt),\n                file=sys.stderr,\n            )\n\n    return flags\n\n\nclass RegeneratableOptionParser(argparse.ArgumentParser):\n    def __init__(self, usage):\n        self.__regeneratable_options = {}\n        argparse.ArgumentParser.__init__(self, usage=usage)\n\n    def add_argument(self, *args, **kw):\n        \"\"\"Add an option to the parser.\n\n        This accepts the same arguments as ArgumentParser.add_argument, plus the\n        following:\n          regenerate: can be set to False to prevent this option from being included\n                      in regeneration.\n          env_name: name of environment variable that additional values for this\n                    option come from.\n          type: adds type='path', to tell the regenerator that the values of\n                this option need to be made relative to options.depth\n        \"\"\"\n        env_name = kw.pop(\"env_name\", None)\n        if \"dest\" in kw and kw.pop(\"regenerate\", True):\n            dest = kw[\"dest\"]\n\n            # The path type is needed for regenerating, for optparse we can just treat\n            # it as a string.\n            type = kw.get(\"type\")\n            if type == \"path\":\n                kw[\"type\"] = str\n\n            self.__regeneratable_options[dest] = {\n                \"action\": kw.get(\"action\"),\n                \"type\": type,\n                \"env_name\": env_name,\n                \"opt\": args[0],\n            }\n\n        argparse.ArgumentParser.add_argument(self, *args, **kw)\n\n    def parse_args(self, *args):\n        values, args = argparse.ArgumentParser.parse_known_args(self, *args)\n        values._regeneration_metadata = self.__regeneratable_options\n        return values, args\n\n\ndef gyp_main(args):\n    my_name = os.path.basename(sys.argv[0])\n    usage = \"%(prog)s [options ...] [build_file ...]\"\n\n    parser = RegeneratableOptionParser(usage=usage.replace(\"%s\", \"%(prog)s\"))\n    parser.add_argument(\n        \"--build\",\n        dest=\"configs\",\n        action=\"append\",\n        help=\"configuration for build after project generation\",\n    )\n    parser.add_argument(\n        \"--check\", dest=\"check\", action=\"store_true\", help=\"check format of gyp files\"\n    )\n    parser.add_argument(\n        \"--config-dir\",\n        dest=\"config_dir\",\n        action=\"store\",\n        env_name=\"GYP_CONFIG_DIR\",\n        default=None,\n        help=\"The location for configuration files like include.gypi.\",\n    )\n    parser.add_argument(\n        \"-d\",\n        \"--debug\",\n        dest=\"debug\",\n        metavar=\"DEBUGMODE\",\n        action=\"append\",\n        default=[],\n        help=\"turn on a debugging \"\n        'mode for debugging GYP.  Supported modes are \"variables\", '\n        '\"includes\" and \"general\" or \"all\" for all of them.',\n    )\n    parser.add_argument(\n        \"-D\",\n        dest=\"defines\",\n        action=\"append\",\n        metavar=\"VAR=VAL\",\n        env_name=\"GYP_DEFINES\",\n        help=\"sets variable VAR to value VAL\",\n    )\n    parser.add_argument(\n        \"--depth\",\n        dest=\"depth\",\n        metavar=\"PATH\",\n        type=\"path\",\n        help=\"set DEPTH gyp variable to a relative path to PATH\",\n    )\n    parser.add_argument(\n        \"-f\",\n        \"--format\",\n        dest=\"formats\",\n        action=\"append\",\n        env_name=\"GYP_GENERATORS\",\n        regenerate=False,\n        help=\"output formats to generate\",\n    )\n    parser.add_argument(\n        \"-G\",\n        dest=\"generator_flags\",\n        action=\"append\",\n        default=[],\n        metavar=\"FLAG=VAL\",\n        env_name=\"GYP_GENERATOR_FLAGS\",\n        help=\"sets generator flag FLAG to VAL\",\n    )\n    parser.add_argument(\n        \"--generator-output\",\n        dest=\"generator_output\",\n        action=\"store\",\n        default=None,\n        metavar=\"DIR\",\n        type=\"path\",\n        env_name=\"GYP_GENERATOR_OUTPUT\",\n        help=\"puts generated build files under DIR\",\n    )\n    parser.add_argument(\n        \"--ignore-environment\",\n        dest=\"use_environment\",\n        action=\"store_false\",\n        default=True,\n        regenerate=False,\n        help=\"do not read options from environment variables\",\n    )\n    parser.add_argument(\n        \"-I\",\n        \"--include\",\n        dest=\"includes\",\n        action=\"append\",\n        metavar=\"INCLUDE\",\n        type=\"path\",\n        help=\"files to include in all loaded .gyp files\",\n    )\n    # --no-circular-check disables the check for circular relationships between\n    # .gyp files.  These relationships should not exist, but they've only been\n    # observed to be harmful with the Xcode generator.  Chromium's .gyp files\n    # currently have some circular relationships on non-Mac platforms, so this\n    # option allows the strict behavior to be used on Macs and the lenient\n    # behavior to be used elsewhere.\n    # TODO(mark): Remove this option when http://crbug.com/35878 is fixed.\n    parser.add_argument(\n        \"--no-circular-check\",\n        dest=\"circular_check\",\n        action=\"store_false\",\n        default=True,\n        regenerate=False,\n        help=\"don't check for circular relationships between files\",\n    )\n    parser.add_argument(\n        \"--no-parallel\",\n        action=\"store_true\",\n        default=False,\n        help=\"Disable multiprocessing\",\n    )\n    parser.add_argument(\n        \"-S\",\n        \"--suffix\",\n        dest=\"suffix\",\n        default=\"\",\n        help=\"suffix to add to generated files\",\n    )\n    parser.add_argument(\n        \"--toplevel-dir\",\n        dest=\"toplevel_dir\",\n        action=\"store\",\n        default=None,\n        metavar=\"DIR\",\n        type=\"path\",\n        help=\"directory to use as the root of the source tree\",\n    )\n    parser.add_argument(\n        \"-R\",\n        \"--root-target\",\n        dest=\"root_targets\",\n        action=\"append\",\n        metavar=\"TARGET\",\n        help=\"include only TARGET and its deep dependencies\",\n    )\n    parser.add_argument(\n        \"-V\",\n        \"--version\",\n        dest=\"version\",\n        action=\"store_true\",\n        help=\"Show the version and exit.\",\n    )\n\n    options, build_files_arg = parser.parse_args(args)\n    if options.version:\n        import pkg_resources  # noqa: PLC0415\n\n        print(f\"v{pkg_resources.get_distribution('gyp-next').version}\")\n        return 0\n    build_files = build_files_arg\n\n    # Set up the configuration directory (defaults to ~/.gyp)\n    if not options.config_dir:\n        home = None\n        home_dot_gyp = None\n        if options.use_environment:\n            home_dot_gyp = os.environ.get(\"GYP_CONFIG_DIR\", None)\n            if home_dot_gyp:\n                home_dot_gyp = os.path.expanduser(home_dot_gyp)\n\n        if not home_dot_gyp:\n            home_vars = [\"HOME\"]\n            if sys.platform in (\"cygwin\", \"win32\"):\n                home_vars.append(\"USERPROFILE\")\n            for home_var in home_vars:\n                home = os.getenv(home_var)\n                if home:\n                    home_dot_gyp = os.path.join(home, \".gyp\")\n                    if not os.path.exists(home_dot_gyp):\n                        home_dot_gyp = None\n                    else:\n                        break\n    else:\n        home_dot_gyp = os.path.expanduser(options.config_dir)\n\n    if home_dot_gyp and not os.path.exists(home_dot_gyp):\n        home_dot_gyp = None\n\n    if not options.formats:\n        # If no format was given on the command line, then check the env variable.\n        generate_formats = []\n        if options.use_environment:\n            generate_formats = os.environ.get(\"GYP_GENERATORS\") or []\n        if generate_formats:\n            generate_formats = re.split(r\"[\\s,]\", generate_formats)\n        if generate_formats:\n            options.formats = generate_formats\n        # Nothing in the variable, default based on platform.\n        elif sys.platform == \"darwin\":\n            options.formats = [\"xcode\"]\n        elif sys.platform in (\"win32\", \"cygwin\"):\n            options.formats = [\"msvs\"]\n        else:\n            options.formats = [\"make\"]\n\n    if not options.generator_output and options.use_environment:\n        g_o = os.environ.get(\"GYP_GENERATOR_OUTPUT\")\n        if g_o:\n            options.generator_output = g_o\n\n    options.parallel = not options.no_parallel\n\n    for mode in options.debug:\n        gyp.debug[mode] = 1\n\n    # Do an extra check to avoid work when we're not debugging.\n    if DEBUG_GENERAL in gyp.debug:\n        DebugOutput(DEBUG_GENERAL, \"running with these options:\")\n        for option, value in sorted(options.__dict__.items()):\n            if option[0] == \"_\":\n                continue\n            if isinstance(value, str):\n                DebugOutput(DEBUG_GENERAL, \"  %s: '%s'\", option, value)\n            else:\n                DebugOutput(DEBUG_GENERAL, \"  %s: %s\", option, value)\n\n    if not build_files:\n        build_files = FindBuildFiles()\n    if not build_files:\n        raise GypError((usage + \"\\n\\n%s: error: no build_file\") % (my_name, my_name))\n\n    # TODO(mark): Chromium-specific hack!\n    # For Chromium, the gyp \"depth\" variable should always be a relative path\n    # to Chromium's top-level \"src\" directory.  If no depth variable was set\n    # on the command line, try to find a \"src\" directory by looking at the\n    # absolute path to each build file's directory.  The first \"src\" component\n    # found will be treated as though it were the path used for --depth.\n    if not options.depth:\n        for build_file in build_files:\n            build_file_dir = os.path.abspath(os.path.dirname(build_file))\n            build_file_dir_components = build_file_dir.split(os.path.sep)\n            components_len = len(build_file_dir_components)\n            for index in range(components_len - 1, -1, -1):\n                if build_file_dir_components[index] == \"src\":\n                    options.depth = os.path.sep.join(build_file_dir_components)\n                    break\n                del build_file_dir_components[index]\n\n            # If the inner loop found something, break without advancing to another\n            # build file.\n            if options.depth:\n                break\n\n        if not options.depth:\n            raise GypError(\n                \"Could not automatically locate src directory.  This is\"\n                \"a temporary Chromium feature that will be removed.  Use\"\n                \"--depth as a workaround.\"\n            )\n\n    # If toplevel-dir is not set, we assume that depth is the root of our source\n    # tree.\n    if not options.toplevel_dir:\n        options.toplevel_dir = options.depth\n\n    # -D on the command line sets variable defaults - D isn't just for define,\n    # it's for default.  Perhaps there should be a way to force (-F?) a\n    # variable's value so that it can't be overridden by anything else.\n    cmdline_default_variables = {}\n    defines = []\n    if options.use_environment:\n        defines += ShlexEnv(\"GYP_DEFINES\")\n    if options.defines:\n        defines += options.defines\n    cmdline_default_variables = NameValueListToDict(defines)\n    if DEBUG_GENERAL in gyp.debug:\n        DebugOutput(\n            DEBUG_GENERAL, \"cmdline_default_variables: %s\", cmdline_default_variables\n        )\n\n    # Set up includes.\n    includes = []\n\n    # If ~/.gyp/include.gypi exists, it'll be forcibly included into every\n    # .gyp file that's loaded, before anything else is included.\n    if home_dot_gyp:\n        default_include = os.path.join(home_dot_gyp, \"include.gypi\")\n        if os.path.exists(default_include):\n            print(\"Using overrides found in \" + default_include)\n            includes.append(default_include)\n\n    # Command-line --include files come after the default include.\n    if options.includes:\n        includes.extend(options.includes)\n\n    # Generator flags should be prefixed with the target generator since they\n    # are global across all generator runs.\n    gen_flags = []\n    if options.use_environment:\n        gen_flags += ShlexEnv(\"GYP_GENERATOR_FLAGS\")\n    if options.generator_flags:\n        gen_flags += options.generator_flags\n    generator_flags = NameValueListToDict(gen_flags)\n    if DEBUG_GENERAL in gyp.debug:\n        DebugOutput(DEBUG_GENERAL, \"generator_flags: %s\", generator_flags)\n\n    # Generate all requested formats (use a set in case we got one format request\n    # twice)\n    for format in set(options.formats):\n        params = {\n            \"options\": options,\n            \"build_files\": build_files,\n            \"generator_flags\": generator_flags,\n            \"cwd\": os.getcwd(),\n            \"build_files_arg\": build_files_arg,\n            \"gyp_binary\": sys.argv[0],\n            \"home_dot_gyp\": home_dot_gyp,\n            \"parallel\": options.parallel,\n            \"root_targets\": options.root_targets,\n            \"target_arch\": cmdline_default_variables.get(\"target_arch\", \"\"),\n        }\n\n        # Start with the default variables from the command line.\n        [generator, flat_list, targets, data] = Load(\n            build_files,\n            format,\n            cmdline_default_variables,\n            includes,\n            options.depth,\n            params,\n            options.check,\n            options.circular_check,\n        )\n\n        # TODO(mark): Pass |data| for now because the generator needs a list of\n        # build files that came in.  In the future, maybe it should just accept\n        # a list, and not the whole data dict.\n        # NOTE: flat_list is the flattened dependency graph specifying the order\n        # that targets may be built.  Build systems that operate serially or that\n        # need to have dependencies defined before dependents reference them should\n        # generate targets in the order specified in flat_list.\n        generator.GenerateOutput(flat_list, targets, data, params)\n\n        if options.configs:\n            valid_configs = targets[flat_list[0]][\"configurations\"]\n            for conf in options.configs:\n                if conf not in valid_configs:\n                    raise GypError(\"Invalid config specified via --build: %s\" % conf)\n            generator.PerformBuild(data, options.configs, params)\n\n    # Done\n    return 0\n\n\ndef main(args):\n    try:\n        return gyp_main(args)\n    except GypError as e:\n        sys.stderr.write(\"gyp: %s\\n\" % e)\n        return 1\n\n\n# NOTE: console_scripts calls this function with no arguments\ndef script_main():\n    return main(sys.argv[1:])\n\n\nif __name__ == \"__main__\":\n    sys.exit(script_main())\n"
  },
  {
    "path": "gyp/pylib/gyp/common.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\nimport errno\nimport filecmp\nimport os.path\nimport re\nimport shlex\nimport subprocess\nimport sys\nimport tempfile\nfrom collections.abc import MutableSet\n\n\n# A minimal memoizing decorator. It'll blow up if the args aren't immutable,\n# among other \"problems\".\nclass memoize:\n    def __init__(self, func):\n        self.func = func\n        self.cache = {}\n\n    def __call__(self, *args):\n        try:\n            return self.cache[args]\n        except KeyError:\n            result = self.func(*args)\n            self.cache[args] = result\n            return result\n\n\nclass GypError(Exception):\n    \"\"\"Error class representing an error, which is to be presented\n    to the user.  The main entry point will catch and display this.\n    \"\"\"\n\n\ndef ExceptionAppend(e, msg):\n    \"\"\"Append a message to the given exception's message.\"\"\"\n    if not e.args:\n        e.args = (msg,)\n    elif len(e.args) == 1:\n        e.args = (str(e.args[0]) + \" \" + msg,)\n    else:\n        e.args = (str(e.args[0]) + \" \" + msg,) + e.args[1:]\n\n\ndef FindQualifiedTargets(target, qualified_list):\n    \"\"\"\n    Given a list of qualified targets, return the qualified targets for the\n    specified |target|.\n    \"\"\"\n    return [t for t in qualified_list if ParseQualifiedTarget(t)[1] == target]\n\n\ndef ParseQualifiedTarget(target):\n    # Splits a qualified target into a build file, target name and toolset.\n\n    # NOTE: rsplit is used to disambiguate the Windows drive letter separator.\n    target_split = target.rsplit(\":\", 1)\n    if len(target_split) == 2:\n        [build_file, target] = target_split\n    else:\n        build_file = None\n\n    target_split = target.rsplit(\"#\", 1)\n    if len(target_split) == 2:\n        [target, toolset] = target_split\n    else:\n        toolset = None\n\n    return [build_file, target, toolset]\n\n\ndef ResolveTarget(build_file, target, toolset):\n    # This function resolves a target into a canonical form:\n    # - a fully defined build file, either absolute or relative to the current\n    # directory\n    # - a target name\n    # - a toolset\n    #\n    # build_file is the file relative to which 'target' is defined.\n    # target is the qualified target.\n    # toolset is the default toolset for that target.\n    [parsed_build_file, target, parsed_toolset] = ParseQualifiedTarget(target)\n\n    if parsed_build_file:\n        if build_file:\n            # If a relative path, parsed_build_file is relative to the directory\n            # containing build_file.  If build_file is not in the current directory,\n            # parsed_build_file is not a usable path as-is.  Resolve it by\n            # interpreting it as relative to build_file.  If parsed_build_file is\n            # absolute, it is usable as a path regardless of the current directory,\n            # and os.path.join will return it as-is.\n            build_file = os.path.normpath(\n                os.path.join(os.path.dirname(build_file), parsed_build_file)\n            )\n            # Further (to handle cases like ../cwd), make it relative to cwd)\n            if not os.path.isabs(build_file):\n                build_file = RelativePath(build_file, \".\")\n        else:\n            build_file = parsed_build_file\n\n    if parsed_toolset:\n        toolset = parsed_toolset\n\n    return [build_file, target, toolset]\n\n\ndef BuildFile(fully_qualified_target):\n    # Extracts the build file from the fully qualified target.\n    return ParseQualifiedTarget(fully_qualified_target)[0]\n\n\ndef GetEnvironFallback(var_list, default):\n    \"\"\"Look up a key in the environment, with fallback to secondary keys\n    and finally falling back to a default value.\"\"\"\n    for var in var_list:\n        if var in os.environ:\n            return os.environ[var]\n    return default\n\n\ndef QualifiedTarget(build_file, target, toolset):\n    # \"Qualified\" means the file that a target was defined in and the target\n    # name, separated by a colon, suffixed by a # and the toolset name:\n    # /path/to/file.gyp:target_name#toolset\n    fully_qualified = build_file + \":\" + target\n    if toolset:\n        fully_qualified = fully_qualified + \"#\" + toolset\n    return fully_qualified\n\n\n@memoize\ndef RelativePath(path, relative_to, follow_path_symlink=True):\n    # Assuming both |path| and |relative_to| are relative to the current\n    # directory, returns a relative path that identifies path relative to\n    # relative_to.\n    # If |follow_symlink_path| is true (default) and |path| is a symlink, then\n    # this method returns a path to the real file represented by |path|. If it is\n    # false, this method returns a path to the symlink. If |path| is not a\n    # symlink, this option has no effect.\n\n    # Convert to normalized (and therefore absolute paths).\n    path = os.path.realpath(path) if follow_path_symlink else os.path.abspath(path)\n    relative_to = os.path.realpath(relative_to)\n\n    # On Windows, we can't create a relative path to a different drive, so just\n    # use the absolute path.\n    if sys.platform == \"win32\" and (\n        os.path.splitdrive(path)[0].lower()\n        != os.path.splitdrive(relative_to)[0].lower()\n    ):\n        return path\n\n    # Split the paths into components.\n    path_split = path.split(os.path.sep)\n    relative_to_split = relative_to.split(os.path.sep)\n\n    # Determine how much of the prefix the two paths share.\n    prefix_len = len(os.path.commonprefix([path_split, relative_to_split]))\n\n    # Put enough \"..\" components to back up out of relative_to to the common\n    # prefix, and then append the part of path_split after the common prefix.\n    relative_split = [os.path.pardir] * (\n        len(relative_to_split) - prefix_len\n    ) + path_split[prefix_len:]\n\n    if len(relative_split) == 0:\n        # The paths were the same.\n        return \"\"\n\n    # Turn it back into a string and we're done.\n    return os.path.join(*relative_split)\n\n\n@memoize\ndef InvertRelativePath(path, toplevel_dir=None):\n    \"\"\"Given a path like foo/bar that is relative to toplevel_dir, return\n    the inverse relative path back to the toplevel_dir.\n\n    E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path)))\n    should always produce the empty string, unless the path contains symlinks.\n    \"\"\"\n    if not path:\n        return path\n    toplevel_dir = \".\" if toplevel_dir is None else toplevel_dir\n    return RelativePath(toplevel_dir, os.path.join(toplevel_dir, path))\n\n\ndef FixIfRelativePath(path, relative_to):\n    # Like RelativePath but returns |path| unchanged if it is absolute.\n    if os.path.isabs(path):\n        return path\n    return RelativePath(path, relative_to)\n\n\ndef UnrelativePath(path, relative_to):\n    # Assuming that |relative_to| is relative to the current directory, and |path|\n    # is a path relative to the dirname of |relative_to|, returns a path that\n    # identifies |path| relative to the current directory.\n    rel_dir = os.path.dirname(relative_to)\n    return os.path.normpath(os.path.join(rel_dir, path))\n\n\n# re objects used by EncodePOSIXShellArgument.  See IEEE 1003.1 XCU.2.2 at\n# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_02\n# and the documentation for various shells.\n\n# _quote is a pattern that should match any argument that needs to be quoted\n# with double-quotes by EncodePOSIXShellArgument.  It matches the following\n# characters appearing anywhere in an argument:\n#   \\t, \\n, space  parameter separators\n#   #              comments\n#   $              expansions (quoted to always expand within one argument)\n#   %              called out by IEEE 1003.1 XCU.2.2\n#   &              job control\n#   '              quoting\n#   (, )           subshell execution\n#   *, ?, [        pathname expansion\n#   ;              command delimiter\n#   <, >, |        redirection\n#   =              assignment\n#   {, }           brace expansion (bash)\n#   ~              tilde expansion\n# It also matches the empty string, because \"\" (or '') is the only way to\n# represent an empty string literal argument to a POSIX shell.\n#\n# This does not match the characters in _escape, because those need to be\n# backslash-escaped regardless of whether they appear in a double-quoted\n# string.\n_quote = re.compile(\"[\\t\\n #$%&'()*;<=>?[{|}~]|^$\")\n\n# _escape is a pattern that should match any character that needs to be\n# escaped with a backslash, whether or not the argument matched the _quote\n# pattern.  _escape is used with re.sub to backslash anything in _escape's\n# first match group, hence the (parentheses) in the regular expression.\n#\n# _escape matches the following characters appearing anywhere in an argument:\n#   \"  to prevent POSIX shells from interpreting this character for quoting\n#   \\  to prevent POSIX shells from interpreting this character for escaping\n#   `  to prevent POSIX shells from interpreting this character for command\n#      substitution\n# Missing from this list is $, because the desired behavior of\n# EncodePOSIXShellArgument is to permit parameter (variable) expansion.\n#\n# Also missing from this list is !, which bash will interpret as the history\n# expansion character when history is enabled.  bash does not enable history\n# by default in non-interactive shells, so this is not thought to be a problem.\n# ! was omitted from this list because bash interprets \"\\!\" as a literal string\n# including the backslash character (avoiding history expansion but retaining\n# the backslash), which would not be correct for argument encoding.  Handling\n# this case properly would also be problematic because bash allows the history\n# character to be changed with the histchars shell variable.  Fortunately,\n# as history is not enabled in non-interactive shells and\n# EncodePOSIXShellArgument is only expected to encode for non-interactive\n# shells, there is no room for error here by ignoring !.\n_escape = re.compile(r'([\"\\\\`])')\n\n\ndef EncodePOSIXShellArgument(argument):\n    \"\"\"Encodes |argument| suitably for consumption by POSIX shells.\n\n    argument may be quoted and escaped as necessary to ensure that POSIX shells\n    treat the returned value as a literal representing the argument passed to\n    this function.  Parameter (variable) expansions beginning with $ are allowed\n    to remain intact without escaping the $, to allow the argument to contain\n    references to variables to be expanded by the shell.\n    \"\"\"\n\n    if not isinstance(argument, str):\n        argument = str(argument)\n\n    quote = '\"' if _quote.search(argument) else \"\"\n\n    encoded = quote + re.sub(_escape, r\"\\\\\\1\", argument) + quote\n\n    return encoded\n\n\ndef EncodePOSIXShellList(list):\n    \"\"\"Encodes |list| suitably for consumption by POSIX shells.\n\n    Returns EncodePOSIXShellArgument for each item in list, and joins them\n    together using the space character as an argument separator.\n    \"\"\"\n\n    encoded_arguments = []\n    for argument in list:\n        encoded_arguments.append(EncodePOSIXShellArgument(argument))\n    return \" \".join(encoded_arguments)\n\n\ndef DeepDependencyTargets(target_dicts, roots):\n    \"\"\"Returns the recursive list of target dependencies.\"\"\"\n    dependencies = set()\n    pending = set(roots)\n    while pending:\n        # Pluck out one.\n        r = pending.pop()\n        # Skip if visited already.\n        if r in dependencies:\n            continue\n        # Add it.\n        dependencies.add(r)\n        # Add its children.\n        spec = target_dicts[r]\n        pending.update(set(spec.get(\"dependencies\", [])))\n        pending.update(set(spec.get(\"dependencies_original\", [])))\n    return list(dependencies - set(roots))\n\n\ndef BuildFileTargets(target_list, build_file):\n    \"\"\"From a target_list, returns the subset from the specified build_file.\"\"\"\n    return [p for p in target_list if BuildFile(p) == build_file]\n\n\ndef AllTargets(target_list, target_dicts, build_file):\n    \"\"\"Returns all targets (direct and dependencies) for the specified build_file.\"\"\"\n    bftargets = BuildFileTargets(target_list, build_file)\n    deptargets = DeepDependencyTargets(target_dicts, bftargets)\n    return bftargets + deptargets\n\n\ndef WriteOnDiff(filename):\n    \"\"\"Write to a file only if the new contents differ.\n\n    Arguments:\n      filename: name of the file to potentially write to.\n    Returns:\n      A file like object which will write to temporary file and only overwrite\n      the target if it differs (on close).\n    \"\"\"\n\n    class Writer:\n        \"\"\"Wrapper around file which only covers the target if it differs.\"\"\"\n\n        def __init__(self):\n            # On Cygwin remove the \"dir\" argument\n            # `C:` prefixed paths are treated as relative,\n            # consequently ending up with current dir \"/cygdrive/c/...\"\n            # being prefixed to those, which was\n            # obviously a non-existent path,\n            # for example: \"/cygdrive/c/<some folder>/C:\\<my win style abs path>\".\n            # For more details see:\n            # https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp\n            base_temp_dir = \"\" if IsCygwin() else os.path.dirname(filename)\n            # Pick temporary file.\n            tmp_fd, self.tmp_path = tempfile.mkstemp(\n                suffix=\".tmp\",\n                prefix=os.path.split(filename)[1] + \".gyp.\",\n                dir=base_temp_dir,\n            )\n            try:\n                self.tmp_file = os.fdopen(tmp_fd, \"wb\")\n            except Exception:\n                # Don't leave turds behind.\n                os.unlink(self.tmp_path)\n                raise\n\n        def __getattr__(self, attrname):\n            # Delegate everything else to self.tmp_file\n            return getattr(self.tmp_file, attrname)\n\n        def close(self):\n            try:\n                # Close tmp file.\n                self.tmp_file.close()\n                # Determine if different.\n                same = False\n                try:\n                    same = filecmp.cmp(self.tmp_path, filename, False)\n                except OSError as e:\n                    if e.errno != errno.ENOENT:\n                        raise\n\n                if same:\n                    # The new file is identical to the old one, just get rid of the new\n                    # one.\n                    os.unlink(self.tmp_path)\n                else:\n                    # The new file is different from the old one,\n                    # or there is no old one.\n                    # Rename the new file to the permanent name.\n                    #\n                    # tempfile.mkstemp uses an overly restrictive mode, resulting in a\n                    # file that can only be read by the owner, regardless of the umask.\n                    # There's no reason to not respect the umask here,\n                    # which means that an extra hoop is required\n                    # to fetch it and reset the new file's mode.\n                    #\n                    # No way to get the umask without setting a new one?  Set a safe one\n                    # and then set it back to the old value.\n                    umask = os.umask(0o77)\n                    os.umask(umask)\n                    os.chmod(self.tmp_path, 0o666 & ~umask)\n                    if sys.platform == \"win32\" and os.path.exists(filename):\n                        # NOTE: on windows (but not cygwin) rename will not replace an\n                        # existing file, so it must be preceded with a remove.\n                        # Sadly there is no way to make the switch atomic.\n                        os.remove(filename)\n                    os.rename(self.tmp_path, filename)\n            except Exception:\n                # Don't leave turds behind.\n                os.unlink(self.tmp_path)\n                raise\n\n        def write(self, s):\n            self.tmp_file.write(s.encode(\"utf-8\"))\n\n    return Writer()\n\n\ndef EnsureDirExists(path):\n    \"\"\"Make sure the directory for |path| exists.\"\"\"\n    try:\n        os.makedirs(os.path.dirname(path))\n    except OSError:\n        pass\n\n\ndef GetCompilerPredefines():  # -> dict\n    cmd = []\n    defines = {}\n\n    # shlex.split() will eat '\\' in posix mode, but\n    # setting posix=False will preserve extra '\"' cause CreateProcess fail on Windows\n    # this makes '\\' in %CC_target% and %CFLAGS% work\n    def replace_sep(s):\n        return s.replace(os.sep, \"/\") if os.sep != \"/\" else s\n\n    if CC := os.environ.get(\"CC_target\") or os.environ.get(\"CC\"):\n        cmd += shlex.split(replace_sep(CC))\n        if CFLAGS := os.environ.get(\"CFLAGS\"):\n            cmd += shlex.split(replace_sep(CFLAGS))\n    elif CXX := os.environ.get(\"CXX_target\") or os.environ.get(\"CXX\"):\n        cmd += shlex.split(replace_sep(CXX))\n        if CXXFLAGS := os.environ.get(\"CXXFLAGS\"):\n            cmd += shlex.split(replace_sep(CXXFLAGS))\n    else:\n        return defines\n\n    if sys.platform == \"win32\":\n        fd, input = tempfile.mkstemp(suffix=\".c\")\n        real_cmd = [*cmd, \"-dM\", \"-E\", \"-x\", \"c\", input]\n        try:\n            os.close(fd)\n            stdout = subprocess.run(\n                real_cmd, shell=True, capture_output=True, check=True\n            ).stdout\n        except subprocess.CalledProcessError as e:\n            print(\n                \"Warning: failed to get compiler predefines\\n\"\n                \"cmd: %s\\n\"\n                \"status: %d\" % (e.cmd, e.returncode),\n                file=sys.stderr,\n            )\n            return defines\n        finally:\n            os.unlink(input)\n    else:\n        input = \"/dev/null\"\n        real_cmd = [*cmd, \"-dM\", \"-E\", \"-x\", \"c\", input]\n        try:\n            stdout = subprocess.run(\n                real_cmd, shell=False, capture_output=True, check=True\n            ).stdout\n        except subprocess.CalledProcessError as e:\n            print(\n                \"Warning: failed to get compiler predefines\\n\"\n                \"cmd: %s\\n\"\n                \"status: %d\" % (e.cmd, e.returncode),\n                file=sys.stderr,\n            )\n            return defines\n\n    lines = stdout.decode(\"utf-8\").replace(\"\\r\\n\", \"\\n\").split(\"\\n\")\n    for line in lines:\n        if (line or \"\").startswith(\"#define \"):\n            _, key, *value = line.split(\" \")\n            defines[key] = \" \".join(value)\n    return defines\n\n\ndef GetFlavorByPlatform():\n    \"\"\"Returns |params.flavor| if it's set, the system's default flavor else.\"\"\"\n    flavors = {\n        \"cygwin\": \"win\",\n        \"win32\": \"win\",\n        \"darwin\": \"mac\",\n    }\n\n    if sys.platform in flavors:\n        return flavors[sys.platform]\n    if sys.platform.startswith(\"sunos\"):\n        return \"solaris\"\n    if sys.platform.startswith((\"dragonfly\", \"freebsd\")):\n        return \"freebsd\"\n    if sys.platform.startswith(\"openbsd\"):\n        return \"openbsd\"\n    if sys.platform.startswith(\"netbsd\"):\n        return \"netbsd\"\n    if sys.platform.startswith(\"aix\"):\n        return \"aix\"\n    if sys.platform.startswith((\"os390\", \"zos\")):\n        return \"zos\"\n    if sys.platform == \"os400\":\n        return \"os400\"\n\n    return \"linux\"\n\n\ndef GetFlavor(params):\n    if \"flavor\" in params:\n        return params[\"flavor\"]\n\n    defines = GetCompilerPredefines()\n    if \"__EMSCRIPTEN__\" in defines:\n        return \"emscripten\"\n    if \"__wasm__\" in defines:\n        return \"wasi\" if \"__wasi__\" in defines else \"wasm\"\n\n    return GetFlavorByPlatform()\n\n\ndef CopyTool(flavor, out_path, generator_flags={}):\n    \"\"\"Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it\n    to |out_path|.\"\"\"\n    # aix and solaris just need flock emulation. mac and win use more complicated\n    # support scripts.\n    prefix = {\n        \"aix\": \"flock\",\n        \"os400\": \"flock\",\n        \"solaris\": \"flock\",\n        \"mac\": \"mac\",\n        \"ios\": \"mac\",\n        \"win\": \"win\",\n    }.get(flavor, None)\n    if not prefix:\n        return\n\n    # Slurp input file.\n    source_path = os.path.join(\n        os.path.dirname(os.path.abspath(__file__)), \"%s_tool.py\" % prefix\n    )\n    with open(source_path) as source_file:\n        source = source_file.readlines()\n\n    # Set custom header flags.\n    header = \"# Generated by gyp. Do not edit.\\n\"\n    mac_toolchain_dir = generator_flags.get(\"mac_toolchain_dir\", None)\n    if flavor == \"mac\" and mac_toolchain_dir:\n        header += \"import os;\\nos.environ['DEVELOPER_DIR']='%s'\\n\" % mac_toolchain_dir\n\n    # Add header and write it out.\n    tool_path = os.path.join(out_path, \"gyp-%s-tool\" % prefix)\n    with open(tool_path, \"w\") as tool_file:\n        tool_file.write(\"\".join([source[0], header] + source[1:]))\n\n    # Make file executable.\n    os.chmod(tool_path, 0o755)\n\n\n# From Alex Martelli,\n# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560\n# ASPN: Python Cookbook: Remove duplicates from a sequence\n# First comment, dated 2001/10/13.\n# (Also in the printed Python Cookbook.)\n\n\ndef uniquer(seq, idfun=lambda x: x):\n    seen = {}\n    result = []\n    for item in seq:\n        marker = idfun(item)\n        if marker in seen:\n            continue\n        seen[marker] = 1\n        result.append(item)\n    return result\n\n\n# Based on http://code.activestate.com/recipes/576694/.\nclass OrderedSet(MutableSet):  # noqa: PLW1641\n    # TODO (cclauss): Fix eq-without-hash ruff rule PLW1641\n    def __init__(self, iterable=None):\n        self.end = end = []\n        end += [None, end, end]  # sentinel node for doubly linked list\n        self.map = {}  # key --> [key, prev, next]\n        if iterable is not None:\n            self |= iterable\n\n    def __len__(self):\n        return len(self.map)\n\n    def __contains__(self, key):\n        return key in self.map\n\n    def add(self, key):\n        if key not in self.map:\n            end = self.end\n            curr = end[1]\n            curr[2] = end[1] = self.map[key] = [key, curr, end]\n\n    def discard(self, key):\n        if key in self.map:\n            key, prev_item, next_item = self.map.pop(key)\n            prev_item[2] = next_item\n            next_item[1] = prev_item\n\n    def __iter__(self):\n        end = self.end\n        curr = end[2]\n        while curr is not end:\n            yield curr[0]\n            curr = curr[2]\n\n    def __reversed__(self):\n        end = self.end\n        curr = end[1]\n        while curr is not end:\n            yield curr[0]\n            curr = curr[1]\n\n    # The second argument is an addition that causes a pylint warning.\n    def pop(self, last=True):  # pylint: disable=W0221\n        if not self:\n            raise KeyError(\"set is empty\")\n        key = self.end[1][0] if last else self.end[2][0]\n        self.discard(key)\n        return key\n\n    def __repr__(self):\n        if not self:\n            return f\"{self.__class__.__name__}()\"\n        return f\"{self.__class__.__name__}({list(self)!r})\"\n\n    def __eq__(self, other):\n        if isinstance(other, OrderedSet):\n            return len(self) == len(other) and list(self) == list(other)\n        return set(self) == set(other)\n\n    # Extensions to the recipe.\n    def update(self, iterable):\n        for i in iterable:\n            if i not in self:\n                self.add(i)\n\n\nclass CycleError(Exception):\n    \"\"\"An exception raised when an unexpected cycle is detected.\"\"\"\n\n    def __init__(self, nodes):\n        self.nodes = nodes\n\n    def __str__(self):\n        return \"CycleError: cycle involving: \" + str(self.nodes)\n\n\ndef TopologicallySorted(graph, get_edges):\n    r\"\"\"Topologically sort based on a user provided edge definition.\n\n    Args:\n      graph: A list of node names.\n      get_edges: A function mapping from node name to a hashable collection\n                 of node names which this node has outgoing edges to.\n    Returns:\n      A list containing all of the node in graph in topological order.\n      It is assumed that calling get_edges once for each node and caching is\n      cheaper than repeatedly calling get_edges.\n    Raises:\n      CycleError in the event of a cycle.\n    Example:\n      graph = {'a': '$(b) $(c)', 'b': 'hi', 'c': '$(b)'}\n      def GetEdges(node):\n        return re.findall(r'\\$\\(([^))]\\)', graph[node])\n      print TopologicallySorted(graph.keys(), GetEdges)\n      ==>\n      ['a', 'c', b']\n    \"\"\"\n    get_edges = memoize(get_edges)\n    visited = set()\n    visiting = set()\n    ordered_nodes = []\n\n    def Visit(node):\n        if node in visiting:\n            raise CycleError(visiting)\n        if node in visited:\n            return\n        visited.add(node)\n        visiting.add(node)\n        for neighbor in get_edges(node):\n            Visit(neighbor)\n        visiting.remove(node)\n        ordered_nodes.insert(0, node)\n\n    for node in sorted(graph):\n        Visit(node)\n    return ordered_nodes\n\n\ndef CrossCompileRequested():\n    # TODO: figure out how to not build extra host objects in the\n    # non-cross-compile case when this is enabled, and enable unconditionally.\n    return (\n        os.environ.get(\"GYP_CROSSCOMPILE\")\n        or os.environ.get(\"AR_host\")\n        or os.environ.get(\"CC_host\")\n        or os.environ.get(\"CXX_host\")\n        or os.environ.get(\"AR_target\")\n        or os.environ.get(\"CC_target\")\n        or os.environ.get(\"CXX_target\")\n    )\n\n\ndef IsCygwin():\n    try:\n        out = subprocess.Popen(\n            \"uname\", stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n        )\n        stdout = out.communicate()[0].decode(\"utf-8\")\n        return \"CYGWIN\" in str(stdout)\n    except Exception:\n        return False\n"
  },
  {
    "path": "gyp/pylib/gyp/common_test.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Unit tests for the common.py file.\"\"\"\n\nimport os\nimport subprocess\nimport sys\nimport unittest\nfrom unittest.mock import MagicMock, patch\n\nimport gyp.common\n\n\nclass TestTopologicallySorted(unittest.TestCase):\n    def test_Valid(self):\n        \"\"\"Test that sorting works on a valid graph with one possible order.\"\"\"\n        graph = {\n            \"a\": [\"b\", \"c\"],\n            \"b\": [],\n            \"c\": [\"d\"],\n            \"d\": [\"b\"],\n        }\n\n        def GetEdge(node):\n            return tuple(graph[node])\n\n        assert gyp.common.TopologicallySorted(graph.keys(), GetEdge) == [\n            \"a\",\n            \"c\",\n            \"d\",\n            \"b\",\n        ]\n\n    def test_Cycle(self):\n        \"\"\"Test that an exception is thrown on a cyclic graph.\"\"\"\n        graph = {\n            \"a\": [\"b\"],\n            \"b\": [\"c\"],\n            \"c\": [\"d\"],\n            \"d\": [\"a\"],\n        }\n\n        def GetEdge(node):\n            return tuple(graph[node])\n\n        self.assertRaises(\n            gyp.common.CycleError, gyp.common.TopologicallySorted, graph.keys(), GetEdge\n        )\n\n\nclass TestGetFlavor(unittest.TestCase):\n    \"\"\"Test that gyp.common.GetFlavor works as intended\"\"\"\n\n    original_platform = \"\"\n\n    def setUp(self):\n        self.original_platform = sys.platform\n\n    def tearDown(self):\n        sys.platform = self.original_platform\n\n    def assertFlavor(self, expected, argument, param):\n        sys.platform = argument\n        assert expected == gyp.common.GetFlavor(param)\n\n    def test_platform_default(self):\n        self.assertFlavor(\"freebsd\", \"freebsd9\", {})\n        self.assertFlavor(\"freebsd\", \"freebsd10\", {})\n        self.assertFlavor(\"openbsd\", \"openbsd5\", {})\n        self.assertFlavor(\"solaris\", \"sunos5\", {})\n        self.assertFlavor(\"solaris\", \"sunos\", {})\n        self.assertFlavor(\"linux\", \"linux2\", {})\n        self.assertFlavor(\"linux\", \"linux3\", {})\n        self.assertFlavor(\"linux\", \"linux\", {})\n\n    def test_param(self):\n        self.assertFlavor(\"foobar\", \"linux2\", {\"flavor\": \"foobar\"})\n\n    class MockCommunicate:\n        def __init__(self, stdout):\n            self.stdout = stdout\n\n        def decode(self, encoding):\n            return self.stdout\n\n    @patch(\"os.close\")\n    @patch(\"os.unlink\")\n    @patch(\"tempfile.mkstemp\")\n    def test_GetCompilerPredefines(self, mock_mkstemp, mock_unlink, mock_close):\n        mock_close.return_value = None\n        mock_unlink.return_value = None\n        mock_mkstemp.return_value = (0, \"temp.c\")\n\n        def mock_run(env, defines_stdout, expected_cmd, throws=False):\n            with patch(\"subprocess.run\") as mock_run:\n                expected_input = \"temp.c\" if sys.platform == \"win32\" else \"/dev/null\"\n                if throws:\n                    mock_run.side_effect = subprocess.CalledProcessError(\n                        returncode=1,\n                        cmd=[*expected_cmd, \"-dM\", \"-E\", \"-x\", \"c\", expected_input],\n                    )\n                else:\n                    mock_process = MagicMock()\n                    mock_process.returncode = 0\n                    mock_process.stdout = TestGetFlavor.MockCommunicate(defines_stdout)\n                    mock_run.return_value = mock_process\n                with patch.dict(os.environ, env):\n                    try:\n                        defines = gyp.common.GetCompilerPredefines()\n                    except Exception as e:\n                        self.fail(f\"GetCompilerPredefines raised an exception: {e}\")\n                    flavor = gyp.common.GetFlavor({})\n                if env.get(\"CC_target\") or env.get(\"CC\"):\n                    mock_run.assert_called_with(\n                        [*expected_cmd, \"-dM\", \"-E\", \"-x\", \"c\", expected_input],\n                        shell=sys.platform == \"win32\",\n                        capture_output=True,\n                        check=True,\n                    )\n                return [defines, flavor]\n\n        [defines0, _] = mock_run({\"CC\": \"cl.exe\"}, \"\", [\"cl.exe\"], True)\n        assert defines0 == {}\n\n        [defines1, _] = mock_run({}, \"\", [])\n        assert defines1 == {}\n\n        [defines2, flavor2] = mock_run(\n            {\"CC_target\": \"/opt/wasi-sdk/bin/clang\"},\n            \"#define __wasm__ 1\\n#define __wasi__ 1\\n\",\n            [\"/opt/wasi-sdk/bin/clang\"],\n        )\n        assert defines2 == {\"__wasm__\": \"1\", \"__wasi__\": \"1\"}\n        assert flavor2 == \"wasi\"\n\n        [defines3, flavor3] = mock_run(\n            {\"CC_target\": \"/opt/wasi-sdk/bin/clang --target=wasm32\"},\n            \"#define __wasm__ 1\\n\",\n            [\"/opt/wasi-sdk/bin/clang\", \"--target=wasm32\"],\n        )\n        assert defines3 == {\"__wasm__\": \"1\"}\n        assert flavor3 == \"wasm\"\n\n        [defines4, flavor4] = mock_run(\n            {\"CC_target\": \"/emsdk/upstream/emscripten/emcc\"},\n            \"#define __EMSCRIPTEN__ 1\\n\",\n            [\"/emsdk/upstream/emscripten/emcc\"],\n        )\n        assert defines4 == {\"__EMSCRIPTEN__\": \"1\"}\n        assert flavor4 == \"emscripten\"\n\n        # Test path which include white space\n        [defines5, flavor5] = mock_run(\n            {\n                \"CC_target\": '\"/Users/Toyo Li/wasi-sdk/bin/clang\" -O3',\n                \"CFLAGS\": \"--target=wasm32-wasi-threads -pthread\",\n            },\n            \"#define __wasm__ 1\\n#define __wasi__ 1\\n#define _REENTRANT 1\\n\",\n            [\n                \"/Users/Toyo Li/wasi-sdk/bin/clang\",\n                \"-O3\",\n                \"--target=wasm32-wasi-threads\",\n                \"-pthread\",\n            ],\n        )\n        assert defines5 == {\"__wasm__\": \"1\", \"__wasi__\": \"1\", \"_REENTRANT\": \"1\"}\n        assert flavor5 == \"wasi\"\n\n        original_sep = os.sep\n        os.sep = \"\\\\\"\n        [defines6, flavor6] = mock_run(\n            {\"CC_target\": '\"C:\\\\Program Files\\\\wasi-sdk\\\\clang.exe\"'},\n            \"#define __wasm__ 1\\n#define __wasi__ 1\\n\",\n            [\"C:/Program Files/wasi-sdk/clang.exe\"],\n        )\n        os.sep = original_sep\n        assert defines6 == {\"__wasm__\": \"1\", \"__wasi__\": \"1\"}\n        assert flavor6 == \"wasi\"\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
  },
  {
    "path": "gyp/pylib/gyp/easy_xml.py",
    "content": "# Copyright (c) 2011 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\nimport locale\nimport os\nimport re\nimport sys\nfrom functools import reduce\n\n\ndef XmlToString(content, encoding=\"utf-8\", pretty=False):\n    \"\"\"Writes the XML content to disk, touching the file only if it has changed.\n\n    Visual Studio files have a lot of pre-defined structures.  This function makes\n    it easy to represent these structures as Python data structures, instead of\n    having to create a lot of function calls.\n\n    Each XML element of the content is represented as a list composed of:\n    1. The name of the element, a string,\n    2. The attributes of the element, a dictionary (optional), and\n    3+. The content of the element, if any.  Strings are simple text nodes and\n        lists are child elements.\n\n    Example 1:\n        <test/>\n    becomes\n        ['test']\n\n    Example 2:\n        <myelement a='value1' b='value2'>\n           <childtype>This is</childtype>\n           <childtype>it!</childtype>\n        </myelement>\n\n    becomes\n        ['myelement', {'a':'value1', 'b':'value2'},\n           ['childtype', 'This is'],\n           ['childtype', 'it!'],\n        ]\n\n    Args:\n      content:  The structured content to be converted.\n      encoding: The encoding to report on the first XML line.\n      pretty: True if we want pretty printing with indents and new lines.\n\n    Returns:\n      The XML content as a string.\n    \"\"\"\n    # We create a huge list of all the elements of the file.\n    xml_parts = ['<?xml version=\"1.0\" encoding=\"%s\"?>' % encoding]\n    if pretty:\n        xml_parts.append(\"\\n\")\n    _ConstructContentList(xml_parts, content, pretty)\n\n    # Convert it to a string\n    return \"\".join(xml_parts)\n\n\ndef _ConstructContentList(xml_parts, specification, pretty, level=0):\n    \"\"\"Appends the XML parts corresponding to the specification.\n\n    Args:\n      xml_parts: A list of XML parts to be appended to.\n      specification:  The specification of the element.  See EasyXml docs.\n      pretty: True if we want pretty printing with indents and new lines.\n      level: Indentation level.\n    \"\"\"\n    # The first item in a specification is the name of the element.\n    if pretty:\n        indentation = \"  \" * level\n        new_line = \"\\n\"\n    else:\n        indentation = \"\"\n        new_line = \"\"\n    name = specification[0]\n    if not isinstance(name, str):\n        raise Exception(\n            \"The first item of an EasyXml specification should be \"\n            \"a string.  Specification was \" + str(specification)\n        )\n    xml_parts.append(indentation + \"<\" + name)\n\n    # Optionally in second position is a dictionary of the attributes.\n    rest = specification[1:]\n    if rest and isinstance(rest[0], dict):\n        for at, val in sorted(rest[0].items()):\n            xml_parts.append(f' {at}=\"{_XmlEscape(val, attr=True)}\"')\n        rest = rest[1:]\n    if rest:\n        xml_parts.append(\">\")\n        all_strings = reduce(lambda x, y: x and isinstance(y, str), rest, True)\n        multi_line = not all_strings\n        if multi_line and new_line:\n            xml_parts.append(new_line)\n        for child_spec in rest:\n            # If it's a string, append a text node.\n            # Otherwise recurse over that child definition\n            if isinstance(child_spec, str):\n                xml_parts.append(_XmlEscape(child_spec))\n            else:\n                _ConstructContentList(xml_parts, child_spec, pretty, level + 1)\n        if multi_line and indentation:\n            xml_parts.append(indentation)\n        xml_parts.append(f\"</{name}>{new_line}\")\n    else:\n        xml_parts.append(\"/>%s\" % new_line)\n\n\ndef WriteXmlIfChanged(\n    content, path, encoding=\"utf-8\", pretty=False, win32=(sys.platform == \"win32\")\n):\n    \"\"\"Writes the XML content to disk, touching the file only if it has changed.\n\n    Args:\n      content:  The structured content to be written.\n      path: Location of the file.\n      encoding: The encoding to report on the first line of the XML file.\n      pretty: True if we want pretty printing with indents and new lines.\n    \"\"\"\n    xml_string = XmlToString(content, encoding, pretty)\n    if win32 and os.linesep != \"\\r\\n\":\n        xml_string = xml_string.replace(\"\\n\", \"\\r\\n\")\n\n    try:  # getdefaultlocale() was removed in Python 3.11\n        default_encoding = locale.getdefaultlocale()[1]\n    except AttributeError:\n        default_encoding = locale.getencoding()\n\n    if default_encoding and default_encoding.upper() != encoding.upper():\n        xml_string = xml_string.encode(encoding)\n\n    # Get the old content\n    try:\n        with open(path) as file:\n            existing = file.read()\n    except OSError:\n        existing = None\n\n    # It has changed, write it\n    if existing != xml_string:\n        with open(path, \"wb\") as file:\n            file.write(xml_string)\n\n\n_xml_escape_map = {\n    '\"': \"&quot;\",\n    \"'\": \"&apos;\",\n    \"<\": \"&lt;\",\n    \">\": \"&gt;\",\n    \"&\": \"&amp;\",\n    \"\\n\": \"&#xA;\",\n    \"\\r\": \"&#xD;\",\n}\n\n\n_xml_escape_re = re.compile(\"(%s)\" % \"|\".join(map(re.escape, _xml_escape_map.keys())))\n\n\ndef _XmlEscape(value, attr=False):\n    \"\"\"Escape a string for inclusion in XML.\"\"\"\n\n    def replace(match):\n        m = match.string[match.start() : match.end()]\n        # don't replace single quotes in attrs\n        if attr and m == \"'\":\n            return m\n        return _xml_escape_map[m]\n\n    return _xml_escape_re.sub(replace, value)\n"
  },
  {
    "path": "gyp/pylib/gyp/easy_xml_test.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2011 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Unit tests for the easy_xml.py file.\"\"\"\n\nimport unittest\nfrom io import StringIO\n\nfrom gyp import easy_xml\n\n\nclass TestSequenceFunctions(unittest.TestCase):\n    def setUp(self):\n        self.stderr = StringIO()\n\n    def test_EasyXml_simple(self):\n        self.assertEqual(\n            easy_xml.XmlToString([\"test\"]),\n            '<?xml version=\"1.0\" encoding=\"utf-8\"?><test/>',\n        )\n\n        self.assertEqual(\n            easy_xml.XmlToString([\"test\"], encoding=\"Windows-1252\"),\n            '<?xml version=\"1.0\" encoding=\"Windows-1252\"?><test/>',\n        )\n\n    def test_EasyXml_simple_with_attributes(self):\n        self.assertEqual(\n            easy_xml.XmlToString([\"test2\", {\"a\": \"value1\", \"b\": \"value2\"}]),\n            '<?xml version=\"1.0\" encoding=\"utf-8\"?><test2 a=\"value1\" b=\"value2\"/>',\n        )\n\n    def test_EasyXml_escaping(self):\n        original = \"<test>'\\\"\\r&\\nfoo\"\n        converted = \"&lt;test&gt;'&quot;&#xD;&amp;&#xA;foo\"\n        converted_apos = converted.replace(\"'\", \"&apos;\")\n        self.assertEqual(\n            easy_xml.XmlToString([\"test3\", {\"a\": original}, original]),\n            '<?xml version=\"1.0\" encoding=\"utf-8\"?><test3 a=\"%s\">%s</test3>'\n            % (converted, converted_apos),\n        )\n\n    def test_EasyXml_pretty(self):\n        self.assertEqual(\n            easy_xml.XmlToString(\n                [\"test3\", [\"GrandParent\", [\"Parent1\", [\"Child\"]], [\"Parent2\"]]],\n                pretty=True,\n            ),\n            '<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n'\n            \"<test3>\\n\"\n            \"  <GrandParent>\\n\"\n            \"    <Parent1>\\n\"\n            \"      <Child/>\\n\"\n            \"    </Parent1>\\n\"\n            \"    <Parent2/>\\n\"\n            \"  </GrandParent>\\n\"\n            \"</test3>\\n\",\n        )\n\n    def test_EasyXml_complex(self):\n        # We want to create:\n        target = (\n            '<?xml version=\"1.0\" encoding=\"utf-8\"?>'\n            \"<Project>\"\n            '<PropertyGroup Label=\"Globals\">'\n            \"<ProjectGuid>{D2250C20-3A94-4FB9-AF73-11BC5B73884B}</ProjectGuid>\"\n            \"<Keyword>Win32Proj</Keyword>\"\n            \"<RootNamespace>automated_ui_tests</RootNamespace>\"\n            \"</PropertyGroup>\"\n            '<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.props\"/>'\n            \"<PropertyGroup \"\n            \"Condition=\\\"'$(Configuration)|$(Platform)'==\"\n            '\\'Debug|Win32\\'\" Label=\"Configuration\">'\n            \"<ConfigurationType>Application</ConfigurationType>\"\n            \"<CharacterSet>Unicode</CharacterSet>\"\n            \"<SpectreMitigation>SpectreLoadCF</SpectreMitigation>\"\n            \"<VCToolsVersion>14.36.32532</VCToolsVersion>\"\n            \"</PropertyGroup>\"\n            \"</Project>\"\n        )\n\n        xml = easy_xml.XmlToString(\n            [\n                \"Project\",\n                [\n                    \"PropertyGroup\",\n                    {\"Label\": \"Globals\"},\n                    [\"ProjectGuid\", \"{D2250C20-3A94-4FB9-AF73-11BC5B73884B}\"],\n                    [\"Keyword\", \"Win32Proj\"],\n                    [\"RootNamespace\", \"automated_ui_tests\"],\n                ],\n                [\"Import\", {\"Project\": \"$(VCTargetsPath)\\\\Microsoft.Cpp.props\"}],\n                [\n                    \"PropertyGroup\",\n                    {\n                        \"Condition\": \"'$(Configuration)|$(Platform)'=='Debug|Win32'\",\n                        \"Label\": \"Configuration\",\n                    },\n                    [\"ConfigurationType\", \"Application\"],\n                    [\"CharacterSet\", \"Unicode\"],\n                    [\"SpectreMitigation\", \"SpectreLoadCF\"],\n                    [\"VCToolsVersion\", \"14.36.32532\"],\n                ],\n            ]\n        )\n        self.assertEqual(xml, target)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
  },
  {
    "path": "gyp/pylib/gyp/flock_tool.py",
    "content": "#!/usr/bin/env python3\n# Copyright (c) 2011 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"These functions are executed via gyp-flock-tool when using the Makefile\ngenerator.  Used on systems that don't have a built-in flock.\"\"\"\n\nimport fcntl\nimport os\nimport struct\nimport subprocess\nimport sys\n\n\ndef main(args):\n    executor = FlockTool()\n    executor.Dispatch(args)\n\n\nclass FlockTool:\n    \"\"\"This class emulates the 'flock' command.\"\"\"\n\n    def Dispatch(self, args):\n        \"\"\"Dispatches a string command to a method.\"\"\"\n        if len(args) < 1:\n            raise Exception(\"Not enough arguments\")\n\n        method = \"Exec%s\" % self._CommandifyName(args[0])\n        getattr(self, method)(*args[1:])\n\n    def _CommandifyName(self, name_string):\n        \"\"\"Transforms a tool name like copy-info-plist to CopyInfoPlist\"\"\"\n        return name_string.title().replace(\"-\", \"\")\n\n    def ExecFlock(self, lockfile, *cmd_list):\n        \"\"\"Emulates the most basic behavior of Linux's flock(1).\"\"\"\n        # Rely on exception handling to report errors.\n        # Note that the stock python on SunOS has a bug\n        # where fcntl.flock(fd, LOCK_EX) always fails\n        # with EBADF, that's why we use this F_SETLK\n        # hack instead.\n        fd = os.open(lockfile, os.O_WRONLY | os.O_NOCTTY | os.O_CREAT, 0o666)\n        if sys.platform.startswith(\"aix\") or sys.platform == \"os400\":\n            # Python on AIX is compiled with LARGEFILE support, which changes the\n            # struct size.\n            op = struct.pack(\"hhIllqq\", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)\n        else:\n            op = struct.pack(\"hhllhhl\", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)\n        fcntl.fcntl(fd, fcntl.F_SETLK, op)\n        return subprocess.call(cmd_list)\n\n\nif __name__ == \"__main__\":\n    sys.exit(main(sys.argv[1:]))\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/__init__.py",
    "content": ""
  },
  {
    "path": "gyp/pylib/gyp/generator/analyzer.py",
    "content": "# Copyright (c) 2014 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"\nThis script is intended for use as a GYP_GENERATOR. It takes as input (by way of\nthe generator flag config_path) the path of a json file that dictates the files\nand targets to search for. The following keys are supported:\nfiles: list of paths (relative) of the files to search for.\ntest_targets: unqualified target names to search for. Any target in this list\nthat depends upon a file in |files| is output regardless of the type of target\nor chain of dependencies.\nadditional_compile_targets: Unqualified targets to search for in addition to\ntest_targets. Targets in the combined list that depend upon a file in |files|\nare not necessarily output. For example, if the target is of type none then the\ntarget is not output (but one of the descendants of the target will be).\n\nThe following is output:\nerror: only supplied if there is an error.\ncompile_targets: minimal set of targets that directly or indirectly (for\n  targets of type none) depend on the files in |files| and is one of the\n  supplied targets or a target that one of the supplied targets depends on.\n  The expectation is this set of targets is passed into a build step. This list\n  always contains the output of test_targets as well.\ntest_targets: set of targets from the supplied |test_targets| that either\n  directly or indirectly depend upon a file in |files|. This list if useful\n  if additional processing needs to be done for certain targets after the\n  build, such as running tests.\nstatus: outputs one of three values: none of the supplied files were found,\n  one of the include files changed so that it should be assumed everything\n  changed (in this case test_targets and compile_targets are not output) or at\n  least one file was found.\ninvalid_targets: list of supplied targets that were not found.\n\nExample:\nConsider a graph like the following:\n  A     D\n / \\\nB   C\nA depends upon both B and C, A is of type none and B and C are executables.\nD is an executable, has no dependencies and nothing depends on it.\nIf |additional_compile_targets| = [\"A\"], |test_targets| = [\"B\", \"C\"] and\nfiles = [\"b.cc\", \"d.cc\"] (B depends upon b.cc and D depends upon d.cc), then\nthe following is output:\n|compile_targets| = [\"B\"] B must built as it depends upon the changed file b.cc\nand the supplied target A depends upon it. A is not output as a build_target\nas it is of type none with no rules and actions.\n|test_targets| = [\"B\"] B directly depends upon the change file b.cc.\n\nEven though the file d.cc, which D depends upon, has changed D is not output\nas it was not supplied by way of |additional_compile_targets| or |test_targets|.\n\nIf the generator flag analyzer_output_path is specified, output is written\nthere. Otherwise output is written to stdout.\n\nIn Gyp the \"all\" target is shorthand for the root targets in the files passed\nto gyp. For example, if file \"a.gyp\" contains targets \"a1\" and\n\"a2\", and file \"b.gyp\" contains targets \"b1\" and \"b2\" and \"a2\" has a dependency\non \"b2\" and gyp is supplied \"a.gyp\" then \"all\" consists of \"a1\" and \"a2\".\nNotice that \"b1\" and \"b2\" are not in the \"all\" target as \"b.gyp\" was not\ndirectly supplied to gyp. OTOH if both \"a.gyp\" and \"b.gyp\" are supplied to gyp\nthen the \"all\" target includes \"b1\" and \"b2\".\n\"\"\"\n\nimport json\nimport os\nimport posixpath\n\nimport gyp.common\n\ndebug = False\n\nfound_dependency_string = \"Found dependency\"\nno_dependency_string = \"No dependencies\"\n# Status when it should be assumed that everything has changed.\nall_changed_string = \"Found dependency (all)\"\n\n# MatchStatus is used indicate if and how a target depends upon the supplied\n# sources.\n# The target's sources contain one of the supplied paths.\nMATCH_STATUS_MATCHES = 1\n# The target has a dependency on another target that contains one of the\n# supplied paths.\nMATCH_STATUS_MATCHES_BY_DEPENDENCY = 2\n# The target's sources weren't in the supplied paths and none of the target's\n# dependencies depend upon a target that matched.\nMATCH_STATUS_DOESNT_MATCH = 3\n# The target doesn't contain the source, but the dependent targets have not yet\n# been visited to determine a more specific status yet.\nMATCH_STATUS_TBD = 4\n\ngenerator_supports_multiple_toolsets = gyp.common.CrossCompileRequested()\n\ngenerator_wants_static_library_dependencies_adjusted = False\n\ngenerator_default_variables = {}\nfor dirname in [\n    \"INTERMEDIATE_DIR\",\n    \"SHARED_INTERMEDIATE_DIR\",\n    \"PRODUCT_DIR\",\n    \"LIB_DIR\",\n    \"SHARED_LIB_DIR\",\n]:\n    generator_default_variables[dirname] = \"!!!\"\n\nfor unused in [\n    \"RULE_INPUT_PATH\",\n    \"RULE_INPUT_ROOT\",\n    \"RULE_INPUT_NAME\",\n    \"RULE_INPUT_DIRNAME\",\n    \"RULE_INPUT_EXT\",\n    \"EXECUTABLE_PREFIX\",\n    \"EXECUTABLE_SUFFIX\",\n    \"STATIC_LIB_PREFIX\",\n    \"STATIC_LIB_SUFFIX\",\n    \"SHARED_LIB_PREFIX\",\n    \"SHARED_LIB_SUFFIX\",\n    \"CONFIGURATION_NAME\",\n]:\n    generator_default_variables[unused] = \"\"\n\n\ndef _ToGypPath(path):\n    \"\"\"Converts a path to the format used by gyp.\"\"\"\n    if os.sep == \"\\\\\" and os.altsep == \"/\":\n        return path.replace(\"\\\\\", \"/\")\n    return path\n\n\ndef _ResolveParent(path, base_path_components):\n    \"\"\"Resolves |path|, which starts with at least one '../'. Returns an empty\n    string if the path shouldn't be considered. See _AddSources() for a\n    description of |base_path_components|.\"\"\"\n    depth = 0\n    while path.startswith(\"../\"):\n        depth += 1\n        path = path[3:]\n    # Relative includes may go outside the source tree. For example, an action may\n    # have inputs in /usr/include, which are not in the source tree.\n    if depth > len(base_path_components):\n        return \"\"\n    if depth == len(base_path_components):\n        return path\n    return (\n        \"/\".join(base_path_components[0 : len(base_path_components) - depth])\n        + \"/\"\n        + path\n    )\n\n\ndef _AddSources(sources, base_path, base_path_components, result):\n    \"\"\"Extracts valid sources from |sources| and adds them to |result|. Each\n    source file is relative to |base_path|, but may contain '..'. To make\n    resolving '..' easier |base_path_components| contains each of the\n    directories in |base_path|. Additionally each source may contain variables.\n    Such sources are ignored as it is assumed dependencies on them are expressed\n    and tracked in some other means.\"\"\"\n    # NOTE: gyp paths are always posix style.\n    for source in sources:\n        if not len(source) or source.startswith((\"!!!\", \"$\")):\n            continue\n        # variable expansion may lead to //.\n        org_source = source\n        source = source[0] + source[1:].replace(\"//\", \"/\")\n        if source.startswith(\"../\"):\n            source = _ResolveParent(source, base_path_components)\n            if len(source):\n                result.append(source)\n            continue\n        result.append(base_path + source)\n        if debug:\n            print(\"AddSource\", org_source, result[len(result) - 1])\n\n\ndef _ExtractSourcesFromAction(action, base_path, base_path_components, results):\n    if \"inputs\" in action:\n        _AddSources(action[\"inputs\"], base_path, base_path_components, results)\n\n\ndef _ToLocalPath(toplevel_dir, path):\n    \"\"\"Converts |path| to a path relative to |toplevel_dir|.\"\"\"\n    if path == toplevel_dir:\n        return \"\"\n    if path.startswith(toplevel_dir + \"/\"):\n        return path[len(toplevel_dir) + len(\"/\") :]\n    return path\n\n\ndef _ExtractSources(target, target_dict, toplevel_dir):\n    # |target| is either absolute or relative and in the format of the OS. Gyp\n    # source paths are always posix. Convert |target| to a posix path relative to\n    # |toplevel_dir_|. This is done to make it easy to build source paths.\n    base_path = posixpath.dirname(_ToLocalPath(toplevel_dir, _ToGypPath(target)))\n    base_path_components = base_path.split(\"/\")\n\n    # Add a trailing '/' so that _AddSources() can easily build paths.\n    if len(base_path):\n        base_path += \"/\"\n\n    if debug:\n        print(\"ExtractSources\", target, base_path)\n\n    results = []\n    if \"sources\" in target_dict:\n        _AddSources(target_dict[\"sources\"], base_path, base_path_components, results)\n    # Include the inputs from any actions. Any changes to these affect the\n    # resulting output.\n    if \"actions\" in target_dict:\n        for action in target_dict[\"actions\"]:\n            _ExtractSourcesFromAction(action, base_path, base_path_components, results)\n    if \"rules\" in target_dict:\n        for rule in target_dict[\"rules\"]:\n            _ExtractSourcesFromAction(rule, base_path, base_path_components, results)\n\n    return results\n\n\nclass Target:\n    \"\"\"Holds information about a particular target:\n    deps: set of Targets this Target depends upon. This is not recursive, only the\n      direct dependent Targets.\n    match_status: one of the MatchStatus values.\n    back_deps: set of Targets that have a dependency on this Target.\n    visited: used during iteration to indicate whether we've visited this target.\n      This is used for two iterations, once in building the set of Targets and\n      again in _GetBuildTargets().\n    name: fully qualified name of the target.\n    requires_build: True if the target type is such that it needs to be built.\n      See _DoesTargetTypeRequireBuild for details.\n    added_to_compile_targets: used when determining if the target was added to the\n      set of targets that needs to be built.\n    in_roots: true if this target is a descendant of one of the root nodes.\n    is_executable: true if the type of target is executable.\n    is_static_library: true if the type of target is static_library.\n    is_or_has_linked_ancestor: true if the target does a link (eg executable), or\n      if there is a target in back_deps that does a link.\"\"\"\n\n    def __init__(self, name):\n        self.deps = set()\n        self.match_status = MATCH_STATUS_TBD\n        self.back_deps = set()\n        self.name = name\n        # TODO(sky): I don't like hanging this off Target. This state is specific\n        # to certain functions and should be isolated there.\n        self.visited = False\n        self.requires_build = False\n        self.added_to_compile_targets = False\n        self.in_roots = False\n        self.is_executable = False\n        self.is_static_library = False\n        self.is_or_has_linked_ancestor = False\n\n\nclass Config:\n    \"\"\"Details what we're looking for\n    files: set of files to search for\n    targets: see file description for details.\"\"\"\n\n    def __init__(self):\n        self.files = []\n        self.targets = set()\n        self.additional_compile_target_names = set()\n        self.test_target_names = set()\n\n    def Init(self, params):\n        \"\"\"Initializes Config. This is a separate method as it raises an exception\n        if there is a parse error.\"\"\"\n        generator_flags = params.get(\"generator_flags\", {})\n        config_path = generator_flags.get(\"config_path\", None)\n        if not config_path:\n            return\n        try:\n            f = open(config_path)\n            config = json.load(f)\n            f.close()\n        except OSError:\n            raise Exception(\"Unable to open file \" + config_path)\n        except ValueError as e:\n            raise Exception(\"Unable to parse config file \" + config_path + str(e))\n        if not isinstance(config, dict):\n            raise Exception(\"config_path must be a JSON file containing a dictionary\")\n        self.files = config.get(\"files\", [])\n        self.additional_compile_target_names = set(\n            config.get(\"additional_compile_targets\", [])\n        )\n        self.test_target_names = set(config.get(\"test_targets\", []))\n\n\ndef _WasBuildFileModified(build_file, data, files, toplevel_dir):\n    \"\"\"Returns true if the build file |build_file| is either in |files| or\n    one of the files included by |build_file| is in |files|. |toplevel_dir| is\n    the root of the source tree.\"\"\"\n    if _ToLocalPath(toplevel_dir, _ToGypPath(build_file)) in files:\n        if debug:\n            print(\"gyp file modified\", build_file)\n        return True\n\n    # First element of included_files is the file itself.\n    if len(data[build_file][\"included_files\"]) <= 1:\n        return False\n\n    for include_file in data[build_file][\"included_files\"][1:]:\n        # |included_files| are relative to the directory of the |build_file|.\n        rel_include_file = _ToGypPath(\n            gyp.common.UnrelativePath(include_file, build_file)\n        )\n        if _ToLocalPath(toplevel_dir, rel_include_file) in files:\n            if debug:\n                print(\n                    \"included gyp file modified, gyp_file=\",\n                    build_file,\n                    \"included file=\",\n                    rel_include_file,\n                )\n            return True\n    return False\n\n\ndef _GetOrCreateTargetByName(targets, target_name):\n    \"\"\"Creates or returns the Target at targets[target_name]. If there is no\n    Target for |target_name| one is created. Returns a tuple of whether a new\n    Target was created and the Target.\"\"\"\n    if target_name in targets:\n        return False, targets[target_name]\n    target = Target(target_name)\n    targets[target_name] = target\n    return True, target\n\n\ndef _DoesTargetTypeRequireBuild(target_dict):\n    \"\"\"Returns true if the target type is such that it needs to be built.\"\"\"\n    # If a 'none' target has rules or actions we assume it requires a build.\n    return bool(\n        target_dict[\"type\"] != \"none\"\n        or target_dict.get(\"actions\")\n        or target_dict.get(\"rules\")\n    )\n\n\ndef _GenerateTargets(data, target_list, target_dicts, toplevel_dir, files, build_files):\n    \"\"\"Returns a tuple of the following:\n    . A dictionary mapping from fully qualified name to Target.\n    . A list of the targets that have a source file in |files|.\n    . Targets that constitute the 'all' target. See description at top of file\n      for details on the 'all' target.\n    This sets the |match_status| of the targets that contain any of the source\n    files in |files| to MATCH_STATUS_MATCHES.\n    |toplevel_dir| is the root of the source tree.\"\"\"\n    # Maps from target name to Target.\n    name_to_target = {}\n\n    # Targets that matched.\n    matching_targets = []\n\n    # Queue of targets to visit.\n    targets_to_visit = target_list[:]\n\n    # Maps from build file to a boolean indicating whether the build file is in\n    # |files|.\n    build_file_in_files = {}\n\n    # Root targets across all files.\n    roots = set()\n\n    # Set of Targets in |build_files|.\n    build_file_targets = set()\n\n    while len(targets_to_visit) > 0:\n        target_name = targets_to_visit.pop()\n        created_target, target = _GetOrCreateTargetByName(name_to_target, target_name)\n        if created_target:\n            roots.add(target)\n        elif target.visited:\n            continue\n\n        target.visited = True\n        target.requires_build = _DoesTargetTypeRequireBuild(target_dicts[target_name])\n        target_type = target_dicts[target_name][\"type\"]\n        target.is_executable = target_type == \"executable\"\n        target.is_static_library = target_type == \"static_library\"\n        target.is_or_has_linked_ancestor = target_type in {\n            \"executable\",\n            \"shared_library\",\n        }\n\n        build_file = gyp.common.ParseQualifiedTarget(target_name)[0]\n        if build_file not in build_file_in_files:\n            build_file_in_files[build_file] = _WasBuildFileModified(\n                build_file, data, files, toplevel_dir\n            )\n\n        if build_file in build_files:\n            build_file_targets.add(target)\n\n        # If a build file (or any of its included files) is modified we assume all\n        # targets in the file are modified.\n        if build_file_in_files[build_file]:\n            print(\"matching target from modified build file\", target_name)\n            target.match_status = MATCH_STATUS_MATCHES\n            matching_targets.append(target)\n        else:\n            sources = _ExtractSources(\n                target_name, target_dicts[target_name], toplevel_dir\n            )\n            for source in sources:\n                if _ToGypPath(os.path.normpath(source)) in files:\n                    print(\"target\", target_name, \"matches\", source)\n                    target.match_status = MATCH_STATUS_MATCHES\n                    matching_targets.append(target)\n                    break\n\n        # Add dependencies to visit as well as updating back pointers for deps.\n        for dep in target_dicts[target_name].get(\"dependencies\", []):\n            targets_to_visit.append(dep)\n\n            created_dep_target, dep_target = _GetOrCreateTargetByName(\n                name_to_target, dep\n            )\n            if not created_dep_target:\n                roots.discard(dep_target)\n\n            target.deps.add(dep_target)\n            dep_target.back_deps.add(target)\n\n    return name_to_target, matching_targets, roots & build_file_targets\n\n\ndef _GetUnqualifiedToTargetMapping(all_targets, to_find):\n    \"\"\"Returns a tuple of the following:\n    . mapping (dictionary) from unqualified name to Target for all the\n      Targets in |to_find|.\n    . any target names not found. If this is empty all targets were found.\"\"\"\n    result = {}\n    if not to_find:\n        return {}, []\n    to_find = set(to_find)\n    for target_name in all_targets:\n        extracted = gyp.common.ParseQualifiedTarget(target_name)\n        if len(extracted) > 1 and extracted[1] in to_find:\n            to_find.remove(extracted[1])\n            result[extracted[1]] = all_targets[target_name]\n            if not to_find:\n                return result, []\n    return result, list(to_find)\n\n\ndef _DoesTargetDependOnMatchingTargets(target):\n    \"\"\"Returns true if |target| or any of its dependencies is one of the\n    targets containing the files supplied as input to analyzer. This updates\n    |matches| of the Targets as it recurses.\n    target: the Target to look for.\"\"\"\n    if target.match_status == MATCH_STATUS_DOESNT_MATCH:\n        return False\n    if target.match_status in {\n        MATCH_STATUS_MATCHES,\n        MATCH_STATUS_MATCHES_BY_DEPENDENCY,\n    }:\n        return True\n    for dep in target.deps:\n        if _DoesTargetDependOnMatchingTargets(dep):\n            target.match_status = MATCH_STATUS_MATCHES_BY_DEPENDENCY\n            print(\"\\t\", target.name, \"matches by dep\", dep.name)\n            return True\n    target.match_status = MATCH_STATUS_DOESNT_MATCH\n    return False\n\n\ndef _GetTargetsDependingOnMatchingTargets(possible_targets):\n    \"\"\"Returns the list of Targets in |possible_targets| that depend (either\n    directly on indirectly) on at least one of the targets containing the files\n    supplied as input to analyzer.\n    possible_targets: targets to search from.\"\"\"\n    found = []\n    print(\"Targets that matched by dependency:\")\n    for target in possible_targets:\n        if _DoesTargetDependOnMatchingTargets(target):\n            found.append(target)\n    return found\n\n\ndef _AddCompileTargets(target, roots, add_if_no_ancestor, result):\n    \"\"\"Recurses through all targets that depend on |target|, adding all targets\n    that need to be built (and are in |roots|) to |result|.\n    roots: set of root targets.\n    add_if_no_ancestor: If true and there are no ancestors of |target| then add\n    |target| to |result|. |target| must still be in |roots|.\n    result: targets that need to be built are added here.\"\"\"\n    if target.visited:\n        return\n\n    target.visited = True\n    target.in_roots = target in roots\n\n    for back_dep_target in target.back_deps:\n        _AddCompileTargets(back_dep_target, roots, False, result)\n        target.added_to_compile_targets |= back_dep_target.added_to_compile_targets\n        target.in_roots |= back_dep_target.in_roots\n        target.is_or_has_linked_ancestor |= back_dep_target.is_or_has_linked_ancestor\n\n    # Always add 'executable' targets. Even though they may be built by other\n    # targets that depend upon them it makes detection of what is going to be\n    # built easier.\n    # And always add static_libraries that have no dependencies on them from\n    # linkables. This is necessary as the other dependencies on them may be\n    # static libraries themselves, which are not compile time dependencies.\n    if target.in_roots and (\n        target.is_executable\n        or (\n            not target.added_to_compile_targets\n            and (add_if_no_ancestor or target.requires_build)\n        )\n        or (\n            target.is_static_library\n            and add_if_no_ancestor\n            and not target.is_or_has_linked_ancestor\n        )\n    ):\n        print(\n            \"\\t\\tadding to compile targets\",\n            target.name,\n            \"executable\",\n            target.is_executable,\n            \"added_to_compile_targets\",\n            target.added_to_compile_targets,\n            \"add_if_no_ancestor\",\n            add_if_no_ancestor,\n            \"requires_build\",\n            target.requires_build,\n            \"is_static_library\",\n            target.is_static_library,\n            \"is_or_has_linked_ancestor\",\n            target.is_or_has_linked_ancestor,\n        )\n        result.add(target)\n        target.added_to_compile_targets = True\n\n\ndef _GetCompileTargets(matching_targets, supplied_targets):\n    \"\"\"Returns the set of Targets that require a build.\n    matching_targets: targets that changed and need to be built.\n    supplied_targets: set of targets supplied to analyzer to search from.\"\"\"\n    result = set()\n    for target in matching_targets:\n        print(\"finding compile targets for match\", target.name)\n        _AddCompileTargets(target, supplied_targets, True, result)\n    return result\n\n\ndef _WriteOutput(params, **values):\n    \"\"\"Writes the output, either to stdout or a file is specified.\"\"\"\n    if \"error\" in values:\n        print(\"Error:\", values[\"error\"])\n    if \"status\" in values:\n        print(values[\"status\"])\n    if \"targets\" in values:\n        values[\"targets\"].sort()\n        print(\"Supplied targets that depend on changed files:\")\n        for target in values[\"targets\"]:\n            print(\"\\t\", target)\n    if \"invalid_targets\" in values:\n        values[\"invalid_targets\"].sort()\n        print(\"The following targets were not found:\")\n        for target in values[\"invalid_targets\"]:\n            print(\"\\t\", target)\n    if \"build_targets\" in values:\n        values[\"build_targets\"].sort()\n        print(\"Targets that require a build:\")\n        for target in values[\"build_targets\"]:\n            print(\"\\t\", target)\n    if \"compile_targets\" in values:\n        values[\"compile_targets\"].sort()\n        print(\"Targets that need to be built:\")\n        for target in values[\"compile_targets\"]:\n            print(\"\\t\", target)\n    if \"test_targets\" in values:\n        values[\"test_targets\"].sort()\n        print(\"Test targets:\")\n        for target in values[\"test_targets\"]:\n            print(\"\\t\", target)\n\n    output_path = params.get(\"generator_flags\", {}).get(\"analyzer_output_path\", None)\n    if not output_path:\n        print(json.dumps(values))\n        return\n    try:\n        f = open(output_path, \"w\")\n        f.write(json.dumps(values) + \"\\n\")\n        f.close()\n    except OSError as e:\n        print(\"Error writing to output file\", output_path, str(e))\n\n\ndef _WasGypIncludeFileModified(params, files):\n    \"\"\"Returns true if one of the files in |files| is in the set of included\n    files.\"\"\"\n    if params[\"options\"].includes:\n        for include in params[\"options\"].includes:\n            if _ToGypPath(os.path.normpath(include)) in files:\n                print(\"Include file modified, assuming all changed\", include)\n                return True\n    return False\n\n\ndef _NamesNotIn(names, mapping):\n    \"\"\"Returns a list of the values in |names| that are not in |mapping|.\"\"\"\n    return [name for name in names if name not in mapping]\n\n\ndef _LookupTargets(names, mapping):\n    \"\"\"Returns a list of the mapping[name] for each value in |names| that is in\n    |mapping|.\"\"\"\n    return [mapping[name] for name in names if name in mapping]\n\n\ndef CalculateVariables(default_variables, params):\n    \"\"\"Calculate additional variables for use in the build (called by gyp).\"\"\"\n    flavor = gyp.common.GetFlavor(params)\n    if flavor == \"mac\":\n        default_variables.setdefault(\"OS\", \"mac\")\n    elif flavor == \"win\":\n        default_variables.setdefault(\"OS\", \"win\")\n        gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)\n    else:\n        operating_system = flavor\n        if flavor == \"android\":\n            operating_system = \"linux\"  # Keep this legacy behavior for now.\n        default_variables.setdefault(\"OS\", operating_system)\n\n\nclass TargetCalculator:\n    \"\"\"Calculates the matching test_targets and matching compile_targets.\"\"\"\n\n    def __init__(\n        self,\n        files,\n        additional_compile_target_names,\n        test_target_names,\n        data,\n        target_list,\n        target_dicts,\n        toplevel_dir,\n        build_files,\n    ):\n        self._additional_compile_target_names = set(additional_compile_target_names)\n        self._test_target_names = set(test_target_names)\n        (\n            self._name_to_target,\n            self._changed_targets,\n            self._root_targets,\n        ) = _GenerateTargets(\n            data, target_list, target_dicts, toplevel_dir, frozenset(files), build_files\n        )\n        (\n            self._unqualified_mapping,\n            self.invalid_targets,\n        ) = _GetUnqualifiedToTargetMapping(\n            self._name_to_target, self._supplied_target_names_no_all()\n        )\n\n    def _supplied_target_names(self):\n        return self._additional_compile_target_names | self._test_target_names\n\n    def _supplied_target_names_no_all(self):\n        \"\"\"Returns the supplied test targets without 'all'.\"\"\"\n        result = self._supplied_target_names()\n        result.discard(\"all\")\n        return result\n\n    def is_build_impacted(self):\n        \"\"\"Returns true if the supplied files impact the build at all.\"\"\"\n        return self._changed_targets\n\n    def find_matching_test_target_names(self):\n        \"\"\"Returns the set of output test targets.\"\"\"\n        assert self.is_build_impacted()\n        # Find the test targets first. 'all' is special cased to mean all the\n        # root targets. To deal with all the supplied |test_targets| are expanded\n        # to include the root targets during lookup. If any of the root targets\n        # match, we remove it and replace it with 'all'.\n        test_target_names_no_all = set(self._test_target_names)\n        test_target_names_no_all.discard(\"all\")\n        test_targets_no_all = _LookupTargets(\n            test_target_names_no_all, self._unqualified_mapping\n        )\n        test_target_names_contains_all = \"all\" in self._test_target_names\n        if test_target_names_contains_all:\n            test_targets = list(set(test_targets_no_all) | set(self._root_targets))\n        else:\n            test_targets = list(test_targets_no_all)\n        print(\"supplied test_targets\")\n        for target_name in self._test_target_names:\n            print(\"\\t\", target_name)\n        print(\"found test_targets\")\n        for target in test_targets:\n            print(\"\\t\", target.name)\n        print(\"searching for matching test targets\")\n        matching_test_targets = _GetTargetsDependingOnMatchingTargets(test_targets)\n        matching_test_targets_contains_all = test_target_names_contains_all and set(\n            matching_test_targets\n        ) & set(self._root_targets)\n        if matching_test_targets_contains_all:\n            # Remove any of the targets for all that were not explicitly supplied,\n            # 'all' is subsequently added to the matching names below.\n            matching_test_targets = list(\n                set(matching_test_targets) & set(test_targets_no_all)\n            )\n        print(\"matched test_targets\")\n        for target in matching_test_targets:\n            print(\"\\t\", target.name)\n        matching_target_names = [\n            gyp.common.ParseQualifiedTarget(target.name)[1]\n            for target in matching_test_targets\n        ]\n        if matching_test_targets_contains_all:\n            matching_target_names.append(\"all\")\n            print(\"\\tall\")\n        return matching_target_names\n\n    def find_matching_compile_target_names(self):\n        \"\"\"Returns the set of output compile targets.\"\"\"\n        assert self.is_build_impacted()\n        # Compile targets are found by searching up from changed targets.\n        # Reset the visited status for _GetBuildTargets.\n        for target in self._name_to_target.values():\n            target.visited = False\n\n        supplied_targets = _LookupTargets(\n            self._supplied_target_names_no_all(), self._unqualified_mapping\n        )\n        if \"all\" in self._supplied_target_names():\n            supplied_targets = list(set(supplied_targets) | set(self._root_targets))\n        print(\"Supplied test_targets & compile_targets\")\n        for target in supplied_targets:\n            print(\"\\t\", target.name)\n        print(\"Finding compile targets\")\n        compile_targets = _GetCompileTargets(self._changed_targets, supplied_targets)\n        return [\n            gyp.common.ParseQualifiedTarget(target.name)[1]\n            for target in compile_targets\n        ]\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    \"\"\"Called by gyp as the final stage. Outputs results.\"\"\"\n    config = Config()\n    try:\n        config.Init(params)\n\n        if not config.files:\n            raise Exception(\n                \"Must specify files to analyze via config_path generator flag\"\n            )\n\n        toplevel_dir = _ToGypPath(os.path.abspath(params[\"options\"].toplevel_dir))\n        if debug:\n            print(\"toplevel_dir\", toplevel_dir)\n\n        if _WasGypIncludeFileModified(params, config.files):\n            result_dict = {\n                \"status\": all_changed_string,\n                \"test_targets\": list(config.test_target_names),\n                \"compile_targets\": list(\n                    config.additional_compile_target_names | config.test_target_names\n                ),\n            }\n            _WriteOutput(params, **result_dict)\n            return\n\n        calculator = TargetCalculator(\n            config.files,\n            config.additional_compile_target_names,\n            config.test_target_names,\n            data,\n            target_list,\n            target_dicts,\n            toplevel_dir,\n            params[\"build_files\"],\n        )\n        if not calculator.is_build_impacted():\n            result_dict = {\n                \"status\": no_dependency_string,\n                \"test_targets\": [],\n                \"compile_targets\": [],\n            }\n            if calculator.invalid_targets:\n                result_dict[\"invalid_targets\"] = calculator.invalid_targets\n            _WriteOutput(params, **result_dict)\n            return\n\n        test_target_names = calculator.find_matching_test_target_names()\n        compile_target_names = calculator.find_matching_compile_target_names()\n        found_at_least_one_target = compile_target_names or test_target_names\n        result_dict = {\n            \"test_targets\": test_target_names,\n            \"status\": found_dependency_string\n            if found_at_least_one_target\n            else no_dependency_string,\n            \"compile_targets\": list(set(compile_target_names) | set(test_target_names)),\n        }\n        if calculator.invalid_targets:\n            result_dict[\"invalid_targets\"] = calculator.invalid_targets\n        _WriteOutput(params, **result_dict)\n\n    except Exception as e:\n        _WriteOutput(params, error=str(e))\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/android.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n# Notes:\n#\n# This generates makefiles suitable for inclusion into the Android build system\n# via an Android.mk file. It is based on make.py, the standard makefile\n# generator.\n#\n# The code below generates a separate .mk file for each target, but\n# all are sourced by the top-level GypAndroid.mk.  This means that all\n# variables in .mk-files clobber one another, and furthermore that any\n# variables set potentially clash with other Android build system variables.\n# Try to avoid setting global variables where possible.\n\n\nimport os\nimport re\nimport subprocess\n\nimport gyp\nimport gyp.common\nfrom gyp.generator import make  # Reuse global functions from make backend.\n\ngenerator_default_variables = {\n    \"OS\": \"android\",\n    \"EXECUTABLE_PREFIX\": \"\",\n    \"EXECUTABLE_SUFFIX\": \"\",\n    \"STATIC_LIB_PREFIX\": \"lib\",\n    \"SHARED_LIB_PREFIX\": \"lib\",\n    \"STATIC_LIB_SUFFIX\": \".a\",\n    \"SHARED_LIB_SUFFIX\": \".so\",\n    \"INTERMEDIATE_DIR\": \"$(gyp_intermediate_dir)\",\n    \"SHARED_INTERMEDIATE_DIR\": \"$(gyp_shared_intermediate_dir)\",\n    \"PRODUCT_DIR\": \"$(gyp_shared_intermediate_dir)\",\n    \"SHARED_LIB_DIR\": \"$(builddir)/lib.$(TOOLSET)\",\n    \"LIB_DIR\": \"$(obj).$(TOOLSET)\",\n    \"RULE_INPUT_ROOT\": \"%(INPUT_ROOT)s\",  # This gets expanded by Python.\n    \"RULE_INPUT_DIRNAME\": \"%(INPUT_DIRNAME)s\",  # This gets expanded by Python.\n    \"RULE_INPUT_PATH\": \"$(RULE_SOURCES)\",\n    \"RULE_INPUT_EXT\": \"$(suffix $<)\",\n    \"RULE_INPUT_NAME\": \"$(notdir $<)\",\n    \"CONFIGURATION_NAME\": \"$(GYP_CONFIGURATION)\",\n}\n\n# Make supports multiple toolsets\ngenerator_supports_multiple_toolsets = True\n\n\n# Generator-specific gyp specs.\ngenerator_additional_non_configuration_keys = [\n    # Boolean to declare that this target does not want its name mangled.\n    \"android_unmangled_name\",\n    # Map of android build system variables to set.\n    \"aosp_build_settings\",\n]\ngenerator_additional_path_sections = []\ngenerator_extra_sources_for_rules = []\n\n\nALL_MODULES_FOOTER = \"\"\"\\\n# \"gyp_all_modules\" is a concatenation of the \"gyp_all_modules\" targets from\n# all the included sub-makefiles. This is just here to clarify.\ngyp_all_modules:\n\"\"\"\n\nheader = \"\"\"\\\n# This file is generated by gyp; do not edit.\n\n\"\"\"\n\n# Map gyp target types to Android module classes.\nMODULE_CLASSES = {\n    \"static_library\": \"STATIC_LIBRARIES\",\n    \"shared_library\": \"SHARED_LIBRARIES\",\n    \"executable\": \"EXECUTABLES\",\n}\n\n\ndef IsCPPExtension(ext):\n    return make.COMPILABLE_EXTENSIONS.get(ext) == \"cxx\"\n\n\ndef Sourceify(path):\n    \"\"\"Convert a path to its source directory form. The Android backend does not\n    support options.generator_output, so this function is a noop.\"\"\"\n    return path\n\n\n# Map from qualified target to path to output.\n# For Android, the target of these maps is a tuple ('static', 'modulename'),\n# ('dynamic', 'modulename'), or ('path', 'some/path') instead of a string,\n# since we link by module.\ntarget_outputs = {}\n# Map from qualified target to any linkable output.  A subset\n# of target_outputs.  E.g. when mybinary depends on liba, we want to\n# include liba in the linker line; when otherbinary depends on\n# mybinary, we just want to build mybinary first.\ntarget_link_deps = {}\n\n\nclass AndroidMkWriter:\n    \"\"\"AndroidMkWriter packages up the writing of one target-specific Android.mk.\n\n    Its only real entry point is Write(), and is mostly used for namespacing.\n    \"\"\"\n\n    def __init__(self, android_top_dir):\n        self.android_top_dir = android_top_dir\n\n    def Write(\n        self,\n        qualified_target,\n        relative_target,\n        base_path,\n        output_filename,\n        spec,\n        configs,\n        part_of_all,\n        write_alias_target,\n        sdk_version,\n    ):\n        \"\"\"The main entry point: writes a .mk file for a single target.\n\n        Arguments:\n          qualified_target: target we're generating\n          relative_target: qualified target name relative to the root\n          base_path: path relative to source root we're building in, used to resolve\n                     target-relative paths\n          output_filename: output .mk file name to write\n          spec, configs: gyp info\n          part_of_all: flag indicating this target is part of 'all'\n          write_alias_target: flag indicating whether to create short aliases for\n                              this target\n          sdk_version: what to emit for LOCAL_SDK_VERSION in output\n        \"\"\"\n        gyp.common.EnsureDirExists(output_filename)\n\n        self.fp = open(output_filename, \"w\")\n\n        self.fp.write(header)\n\n        self.qualified_target = qualified_target\n        self.relative_target = relative_target\n        self.path = base_path\n        self.target = spec[\"target_name\"]\n        self.type = spec[\"type\"]\n        self.toolset = spec[\"toolset\"]\n\n        deps, link_deps = self.ComputeDeps(spec)\n\n        # Some of the generation below can add extra output, sources, or\n        # link dependencies.  All of the out params of the functions that\n        # follow use names like extra_foo.\n        extra_outputs = []\n        extra_sources = []\n\n        self.android_class = MODULE_CLASSES.get(self.type, \"GYP\")\n        self.android_module = self.ComputeAndroidModule(spec)\n        (self.android_stem, self.android_suffix) = self.ComputeOutputParts(spec)\n        self.output = self.output_binary = self.ComputeOutput(spec)\n\n        # Standard header.\n        self.WriteLn(\"include $(CLEAR_VARS)\\n\")\n\n        # Module class and name.\n        self.WriteLn(\"LOCAL_MODULE_CLASS := \" + self.android_class)\n        self.WriteLn(\"LOCAL_MODULE := \" + self.android_module)\n        # Only emit LOCAL_MODULE_STEM if it's different to LOCAL_MODULE.\n        # The library module classes fail if the stem is set. ComputeOutputParts\n        # makes sure that stem == modulename in these cases.\n        if self.android_stem != self.android_module:\n            self.WriteLn(\"LOCAL_MODULE_STEM := \" + self.android_stem)\n        self.WriteLn(\"LOCAL_MODULE_SUFFIX := \" + self.android_suffix)\n        if self.toolset == \"host\":\n            self.WriteLn(\"LOCAL_IS_HOST_MODULE := true\")\n            self.WriteLn(\"LOCAL_MULTILIB := $(GYP_HOST_MULTILIB)\")\n        elif sdk_version > 0:\n            self.WriteLn(\"LOCAL_MODULE_TARGET_ARCH := $(TARGET_$(GYP_VAR_PREFIX)ARCH)\")\n            self.WriteLn(\"LOCAL_SDK_VERSION := %s\" % sdk_version)\n\n        # Grab output directories; needed for Actions and Rules.\n        if self.toolset == \"host\":\n            self.WriteLn(\n                \"gyp_intermediate_dir := \"\n                \"$(call local-intermediates-dir,,$(GYP_HOST_VAR_PREFIX))\"\n            )\n        else:\n            self.WriteLn(\n                \"gyp_intermediate_dir := \"\n                \"$(call local-intermediates-dir,,$(GYP_VAR_PREFIX))\"\n            )\n        self.WriteLn(\n            \"gyp_shared_intermediate_dir := \"\n            \"$(call intermediates-dir-for,GYP,shared,,,$(GYP_VAR_PREFIX))\"\n        )\n        self.WriteLn()\n\n        # List files this target depends on so that actions/rules/copies/sources\n        # can depend on the list.\n        # TODO: doesn't pull in things through transitive link deps; needed?\n        target_dependencies = [x[1] for x in deps if x[0] == \"path\"]\n        self.WriteLn(\"# Make sure our deps are built first.\")\n        self.WriteList(\n            target_dependencies, \"GYP_TARGET_DEPENDENCIES\", local_pathify=True\n        )\n\n        # Actions must come first, since they can generate more OBJs for use below.\n        if \"actions\" in spec:\n            self.WriteActions(spec[\"actions\"], extra_sources, extra_outputs)\n\n        # Rules must be early like actions.\n        if \"rules\" in spec:\n            self.WriteRules(spec[\"rules\"], extra_sources, extra_outputs)\n\n        if \"copies\" in spec:\n            self.WriteCopies(spec[\"copies\"], extra_outputs)\n\n        # GYP generated outputs.\n        self.WriteList(extra_outputs, \"GYP_GENERATED_OUTPUTS\", local_pathify=True)\n\n        # Set LOCAL_ADDITIONAL_DEPENDENCIES so that Android's build rules depend\n        # on both our dependency targets and our generated files.\n        self.WriteLn(\"# Make sure our deps and generated files are built first.\")\n        self.WriteLn(\n            \"LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) \"\n            \"$(GYP_GENERATED_OUTPUTS)\"\n        )\n        self.WriteLn()\n\n        # Sources.\n        if spec.get(\"sources\", []) or extra_sources:\n            self.WriteSources(spec, configs, extra_sources)\n\n        self.WriteTarget(\n            spec, configs, deps, link_deps, part_of_all, write_alias_target\n        )\n\n        # Update global list of target outputs, used in dependency tracking.\n        target_outputs[qualified_target] = (\"path\", self.output_binary)\n\n        # Update global list of link dependencies.\n        if self.type == \"static_library\":\n            target_link_deps[qualified_target] = (\"static\", self.android_module)\n        elif self.type == \"shared_library\":\n            target_link_deps[qualified_target] = (\"shared\", self.android_module)\n\n        self.fp.close()\n        return self.android_module\n\n    def WriteActions(self, actions, extra_sources, extra_outputs):\n        \"\"\"Write Makefile code for any 'actions' from the gyp input.\n\n        extra_sources: a list that will be filled in with newly generated source\n                       files, if any\n        extra_outputs: a list that will be filled in with any outputs of these\n                       actions (used to make other pieces dependent on these\n                       actions)\n        \"\"\"\n        for action in actions:\n            name = make.StringToMakefileVariable(\n                \"{}_{}\".format(self.relative_target, action[\"action_name\"])\n            )\n            self.WriteLn('### Rules for action \"%s\":' % action[\"action_name\"])\n            inputs = action[\"inputs\"]\n            outputs = action[\"outputs\"]\n\n            # Build up a list of outputs.\n            # Collect the output dirs we'll need.\n            dirs = set()\n            for out in outputs:\n                if not out.startswith(\"$\"):\n                    print(\n                        'WARNING: Action for target \"%s\" writes output to local path '\n                        '\"%s\".' % (self.target, out)\n                    )\n                dir = os.path.split(out)[0]\n                if dir:\n                    dirs.add(dir)\n            if int(action.get(\"process_outputs_as_sources\", False)):\n                extra_sources += outputs\n\n            # Prepare the actual command.\n            command = gyp.common.EncodePOSIXShellList(action[\"action\"])\n            if \"message\" in action:\n                quiet_cmd = \"Gyp action: %s ($@)\" % action[\"message\"]\n            else:\n                quiet_cmd = \"Gyp action: %s ($@)\" % name\n            if len(dirs) > 0:\n                command = \"mkdir -p %s\" % \" \".join(dirs) + \"; \" + command\n\n            cd_action = \"cd $(gyp_local_path)/%s; \" % self.path\n            command = cd_action + command\n\n            # The makefile rules are all relative to the top dir, but the gyp actions\n            # are defined relative to their containing dir.  This replaces the gyp_*\n            # variables for the action rule with an absolute version so that the\n            # output goes in the right place.\n            # Only write the gyp_* rules for the \"primary\" output (:1);\n            # it's superfluous for the \"extra outputs\", and this avoids accidentally\n            # writing duplicate dummy rules for those outputs.\n            main_output = make.QuoteSpaces(self.LocalPathify(outputs[0]))\n            self.WriteLn(\"%s: gyp_local_path := $(LOCAL_PATH)\" % main_output)\n            self.WriteLn(\"%s: gyp_var_prefix := $(GYP_VAR_PREFIX)\" % main_output)\n            self.WriteLn(\n                \"%s: gyp_intermediate_dir := \"\n                \"$(abspath $(gyp_intermediate_dir))\" % main_output\n            )\n            self.WriteLn(\n                \"%s: gyp_shared_intermediate_dir := \"\n                \"$(abspath $(gyp_shared_intermediate_dir))\" % main_output\n            )\n\n            # Android's envsetup.sh adds a number of directories to the path including\n            # the built host binary directory. This causes actions/rules invoked by\n            # gyp to sometimes use these instead of system versions, e.g. bison.\n            # The built host binaries may not be suitable, and can cause errors.\n            # So, we remove them from the PATH using the ANDROID_BUILD_PATHS variable\n            # set by envsetup.\n            self.WriteLn(\n                \"%s: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))\"\n                % main_output\n            )\n\n            # Don't allow spaces in input/output filenames, but make an exception for\n            # filenames which start with '$(' since it's okay for there to be spaces\n            # inside of make function/macro invocations.\n            for input in inputs:\n                if not input.startswith(\"$(\") and \" \" in input:\n                    raise gyp.common.GypError(\n                        'Action input filename \"%s\" in target %s contains a space'\n                        % (input, self.target)\n                    )\n            for output in outputs:\n                if not output.startswith(\"$(\") and \" \" in output:\n                    raise gyp.common.GypError(\n                        'Action output filename \"%s\" in target %s contains a space'\n                        % (output, self.target)\n                    )\n\n            self.WriteLn(\n                \"%s: %s $(GYP_TARGET_DEPENDENCIES)\"\n                % (main_output, \" \".join(map(self.LocalPathify, inputs)))\n            )\n            self.WriteLn('\\t@echo \"%s\"' % quiet_cmd)\n            self.WriteLn(\"\\t$(hide)%s\\n\" % command)\n            for output in outputs[1:]:\n                # Make each output depend on the main output, with an empty command\n                # to force make to notice that the mtime has changed.\n                self.WriteLn(f\"{self.LocalPathify(output)}: {main_output} ;\")\n\n            extra_outputs += outputs\n            self.WriteLn()\n\n        self.WriteLn()\n\n    def WriteRules(self, rules, extra_sources, extra_outputs):\n        \"\"\"Write Makefile code for any 'rules' from the gyp input.\n\n        extra_sources: a list that will be filled in with newly generated source\n                       files, if any\n        extra_outputs: a list that will be filled in with any outputs of these\n                       rules (used to make other pieces dependent on these rules)\n        \"\"\"\n        if len(rules) == 0:\n            return\n\n        for rule in rules:\n            if len(rule.get(\"rule_sources\", [])) == 0:\n                continue\n            name = make.StringToMakefileVariable(\n                \"{}_{}\".format(self.relative_target, rule[\"rule_name\"])\n            )\n            self.WriteLn('\\n### Generated for rule \"%s\":' % name)\n            self.WriteLn('# \"%s\":' % rule)\n\n            inputs = rule.get(\"inputs\")\n            for rule_source in rule.get(\"rule_sources\", []):\n                (rule_source_dirname, rule_source_basename) = os.path.split(rule_source)\n                (rule_source_root, _rule_source_ext) = os.path.splitext(\n                    rule_source_basename\n                )\n\n                outputs = [\n                    self.ExpandInputRoot(out, rule_source_root, rule_source_dirname)\n                    for out in rule[\"outputs\"]\n                ]\n\n                dirs = set()\n                for out in outputs:\n                    if not out.startswith(\"$\"):\n                        print(\n                            \"WARNING: Rule for target %s writes output to local path %s\"\n                            % (self.target, out)\n                        )\n                    dir = os.path.dirname(out)\n                    if dir:\n                        dirs.add(dir)\n                extra_outputs += outputs\n                if int(rule.get(\"process_outputs_as_sources\", False)):\n                    extra_sources.extend(outputs)\n\n                components = []\n                for component in rule[\"action\"]:\n                    component = self.ExpandInputRoot(\n                        component, rule_source_root, rule_source_dirname\n                    )\n                    if \"$(RULE_SOURCES)\" in component:\n                        component = component.replace(\"$(RULE_SOURCES)\", rule_source)\n                    components.append(component)\n\n                command = gyp.common.EncodePOSIXShellList(components)\n                cd_action = \"cd $(gyp_local_path)/%s; \" % self.path\n                command = cd_action + command\n                if dirs:\n                    command = \"mkdir -p %s\" % \" \".join(dirs) + \"; \" + command\n\n                # We set up a rule to build the first output, and then set up\n                # a rule for each additional output to depend on the first.\n                outputs = map(self.LocalPathify, outputs)\n                main_output = outputs[0]\n                self.WriteLn(\"%s: gyp_local_path := $(LOCAL_PATH)\" % main_output)\n                self.WriteLn(\"%s: gyp_var_prefix := $(GYP_VAR_PREFIX)\" % main_output)\n                self.WriteLn(\n                    \"%s: gyp_intermediate_dir := \"\n                    \"$(abspath $(gyp_intermediate_dir))\" % main_output\n                )\n                self.WriteLn(\n                    \"%s: gyp_shared_intermediate_dir := \"\n                    \"$(abspath $(gyp_shared_intermediate_dir))\" % main_output\n                )\n\n                # See explanation in WriteActions.\n                self.WriteLn(\n                    \"%s: export PATH := \"\n                    \"$(subst $(ANDROID_BUILD_PATHS),,$(PATH))\" % main_output\n                )\n\n                main_output_deps = self.LocalPathify(rule_source)\n                if inputs:\n                    main_output_deps += \" \"\n                    main_output_deps += \" \".join([self.LocalPathify(f) for f in inputs])\n\n                self.WriteLn(\n                    \"%s: %s $(GYP_TARGET_DEPENDENCIES)\"\n                    % (main_output, main_output_deps)\n                )\n                self.WriteLn(\"\\t%s\\n\" % command)\n                for output in outputs[1:]:\n                    # Make each output depend on the main output, with an empty command\n                    # to force make to notice that the mtime has changed.\n                    self.WriteLn(f\"{output}: {main_output} ;\")\n                self.WriteLn()\n\n        self.WriteLn()\n\n    def WriteCopies(self, copies, extra_outputs):\n        \"\"\"Write Makefile code for any 'copies' from the gyp input.\n\n        extra_outputs: a list that will be filled in with any outputs of this action\n                       (used to make other pieces dependent on this action)\n        \"\"\"\n        self.WriteLn(\"### Generated for copy rule.\")\n\n        variable = make.StringToMakefileVariable(self.relative_target + \"_copies\")\n        outputs = []\n        for copy in copies:\n            for path in copy[\"files\"]:\n                # The Android build system does not allow generation of files into the\n                # source tree. The destination should start with a variable, which will\n                # typically be $(gyp_intermediate_dir) or\n                # $(gyp_shared_intermediate_dir). Note that we can't use an assertion\n                # because some of the gyp tests depend on this.\n                if not copy[\"destination\"].startswith(\"$\"):\n                    print(\n                        \"WARNING: Copy rule for target %s writes output to \"\n                        \"local path %s\" % (self.target, copy[\"destination\"])\n                    )\n\n                # LocalPathify() calls normpath, stripping trailing slashes.\n                path = Sourceify(self.LocalPathify(path))\n                filename = os.path.split(path)[1]\n                output = Sourceify(\n                    self.LocalPathify(os.path.join(copy[\"destination\"], filename))\n                )\n\n                self.WriteLn(f\"{output}: {path} $(GYP_TARGET_DEPENDENCIES) | $(ACP)\")\n                self.WriteLn(\"\\t@echo Copying: $@\")\n                self.WriteLn(\"\\t$(hide) mkdir -p $(dir $@)\")\n                self.WriteLn(\"\\t$(hide) $(ACP) -rpf $< $@\")\n                self.WriteLn()\n                outputs.append(output)\n        self.WriteLn(\n            \"{} = {}\".format(variable, \" \".join(map(make.QuoteSpaces, outputs)))\n        )\n        extra_outputs.append(\"$(%s)\" % variable)\n        self.WriteLn()\n\n    def WriteSourceFlags(self, spec, configs):\n        \"\"\"Write out the flags and include paths used to compile source files for\n        the current target.\n\n        Args:\n          spec, configs: input from gyp.\n        \"\"\"\n        for configname, config in sorted(configs.items()):\n            extracted_includes = []\n\n            self.WriteLn(\"\\n# Flags passed to both C and C++ files.\")\n            cflags, includes_from_cflags = self.ExtractIncludesFromCFlags(\n                config.get(\"cflags\", []) + config.get(\"cflags_c\", [])\n            )\n            extracted_includes.extend(includes_from_cflags)\n            self.WriteList(cflags, \"MY_CFLAGS_%s\" % configname)\n\n            self.WriteList(\n                config.get(\"defines\"),\n                \"MY_DEFS_%s\" % configname,\n                prefix=\"-D\",\n                quoter=make.EscapeCppDefine,\n            )\n\n            self.WriteLn(\"\\n# Include paths placed before CFLAGS/CPPFLAGS\")\n            includes = list(config.get(\"include_dirs\", []))\n            includes.extend(extracted_includes)\n            includes = map(Sourceify, map(self.LocalPathify, includes))\n            includes = self.NormalizeIncludePaths(includes)\n            self.WriteList(includes, \"LOCAL_C_INCLUDES_%s\" % configname)\n\n            self.WriteLn(\"\\n# Flags passed to only C++ (and not C) files.\")\n            self.WriteList(config.get(\"cflags_cc\"), \"LOCAL_CPPFLAGS_%s\" % configname)\n\n        self.WriteLn(\n            \"\\nLOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) \"\n            \"$(MY_DEFS_$(GYP_CONFIGURATION))\"\n        )\n        # Undefine ANDROID for host modules\n        # TODO: the source code should not use macro ANDROID to tell if it's host\n        # or target module.\n        if self.toolset == \"host\":\n            self.WriteLn(\"# Undefine ANDROID for host modules\")\n            self.WriteLn(\"LOCAL_CFLAGS += -UANDROID\")\n        self.WriteLn(\n            \"LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) \"\n            \"$(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION))\"\n        )\n        self.WriteLn(\"LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION))\")\n        # Android uses separate flags for assembly file invocations, but gyp expects\n        # the same CFLAGS to be applied:\n        self.WriteLn(\"LOCAL_ASFLAGS := $(LOCAL_CFLAGS)\")\n\n    def WriteSources(self, spec, configs, extra_sources):\n        \"\"\"Write Makefile code for any 'sources' from the gyp input.\n        These are source files necessary to build the current target.\n        We need to handle shared_intermediate directory source files as\n        a special case by copying them to the intermediate directory and\n        treating them as a generated sources. Otherwise the Android build\n        rules won't pick them up.\n\n        Args:\n          spec, configs: input from gyp.\n          extra_sources: Sources generated from Actions or Rules.\n        \"\"\"\n        sources = filter(make.Compilable, spec.get(\"sources\", []))\n        generated_not_sources = [x for x in extra_sources if not make.Compilable(x)]\n        extra_sources = filter(make.Compilable, extra_sources)\n\n        # Determine and output the C++ extension used by these sources.\n        # We simply find the first C++ file and use that extension.\n        all_sources = sources + extra_sources\n        local_cpp_extension = \".cpp\"\n        for source in all_sources:\n            (root, ext) = os.path.splitext(source)\n            if IsCPPExtension(ext):\n                local_cpp_extension = ext\n                break\n        if local_cpp_extension != \".cpp\":\n            self.WriteLn(\"LOCAL_CPP_EXTENSION := %s\" % local_cpp_extension)\n\n        # We need to move any non-generated sources that are coming from the\n        # shared intermediate directory out of LOCAL_SRC_FILES and put them\n        # into LOCAL_GENERATED_SOURCES. We also need to move over any C++ files\n        # that don't match our local_cpp_extension, since Android will only\n        # generate Makefile rules for a single LOCAL_CPP_EXTENSION.\n        local_files = []\n        for source in sources:\n            (root, ext) = os.path.splitext(source)\n            if (\n                \"$(gyp_shared_intermediate_dir)\" in source\n                or \"$(gyp_intermediate_dir)\" in source\n                or (IsCPPExtension(ext) and ext != local_cpp_extension)\n            ):\n                extra_sources.append(source)\n            else:\n                local_files.append(os.path.normpath(os.path.join(self.path, source)))\n\n        # For any generated source, if it is coming from the shared intermediate\n        # directory then we add a Make rule to copy them to the local intermediate\n        # directory first. This is because the Android LOCAL_GENERATED_SOURCES\n        # must be in the local module intermediate directory for the compile rules\n        # to work properly. If the file has the wrong C++ extension, then we add\n        # a rule to copy that to intermediates and use the new version.\n        final_generated_sources = []\n        # If a source file gets copied, we still need to add the original source\n        # directory as header search path, for GCC searches headers in the\n        # directory that contains the source file by default.\n        origin_src_dirs = []\n        for source in extra_sources:\n            local_file = source\n            if \"$(gyp_intermediate_dir)/\" not in local_file:\n                basename = os.path.basename(local_file)\n                local_file = \"$(gyp_intermediate_dir)/\" + basename\n            (root, ext) = os.path.splitext(local_file)\n            if IsCPPExtension(ext) and ext != local_cpp_extension:\n                local_file = root + local_cpp_extension\n            if local_file != source:\n                self.WriteLn(f\"{local_file}: {self.LocalPathify(source)}\")\n                self.WriteLn(\"\\tmkdir -p $(@D); cp $< $@\")\n                origin_src_dirs.append(os.path.dirname(source))\n            final_generated_sources.append(local_file)\n\n        # We add back in all of the non-compilable stuff to make sure that the\n        # make rules have dependencies on them.\n        final_generated_sources.extend(generated_not_sources)\n        self.WriteList(final_generated_sources, \"LOCAL_GENERATED_SOURCES\")\n\n        origin_src_dirs = gyp.common.uniquer(origin_src_dirs)\n        origin_src_dirs = map(Sourceify, map(self.LocalPathify, origin_src_dirs))\n        self.WriteList(origin_src_dirs, \"GYP_COPIED_SOURCE_ORIGIN_DIRS\")\n\n        self.WriteList(local_files, \"LOCAL_SRC_FILES\")\n\n        # Write out the flags used to compile the source; this must be done last\n        # so that GYP_COPIED_SOURCE_ORIGIN_DIRS can be used as an include path.\n        self.WriteSourceFlags(spec, configs)\n\n    def ComputeAndroidModule(self, spec):\n        \"\"\"Return the Android module name used for a gyp spec.\n\n        We use the complete qualified target name to avoid collisions between\n        duplicate targets in different directories. We also add a suffix to\n        distinguish gyp-generated module names.\n        \"\"\"\n\n        if int(spec.get(\"android_unmangled_name\", 0)):\n            assert self.type != \"shared_library\" or self.target.startswith(\"lib\")\n            return self.target\n\n        if self.type == \"shared_library\":\n            # For reasons of convention, the Android build system requires that all\n            # shared library modules are named 'libfoo' when generating -l flags.\n            prefix = \"lib_\"\n        else:\n            prefix = \"\"\n\n        if spec[\"toolset\"] == \"host\":\n            suffix = \"_$(TARGET_$(GYP_VAR_PREFIX)ARCH)_host_gyp\"\n        else:\n            suffix = \"_gyp\"\n\n        if self.path:\n            middle = make.StringToMakefileVariable(f\"{self.path}_{self.target}\")\n        else:\n            middle = make.StringToMakefileVariable(self.target)\n\n        return \"\".join([prefix, middle, suffix])\n\n    def ComputeOutputParts(self, spec):\n        \"\"\"Return the 'output basename' of a gyp spec, split into filename + ext.\n\n        Android libraries must be named the same thing as their module name,\n        otherwise the linker can't find them, so product_name and so on must be\n        ignored if we are building a library, and the \"lib\" prepending is\n        not done for Android.\n        \"\"\"\n        assert self.type != \"loadable_module\"  # TODO: not supported?\n\n        target = spec[\"target_name\"]\n        target_prefix = \"\"\n        target_ext = \"\"\n        if self.type == \"static_library\":\n            target = self.ComputeAndroidModule(spec)\n            target_ext = \".a\"\n        elif self.type == \"shared_library\":\n            target = self.ComputeAndroidModule(spec)\n            target_ext = \".so\"\n        elif self.type == \"none\":\n            target_ext = \".stamp\"\n        elif self.type != \"executable\":\n            print(\n                \"ERROR: What output file should be generated?\",\n                \"type\",\n                self.type,\n                \"target\",\n                target,\n            )\n\n        if self.type not in {\"static_library\", \"shared_library\"}:\n            target_prefix = spec.get(\"product_prefix\", target_prefix)\n            target = spec.get(\"product_name\", target)\n            product_ext = spec.get(\"product_extension\")\n            if product_ext:\n                target_ext = \".\" + product_ext\n\n        target_stem = target_prefix + target\n        return (target_stem, target_ext)\n\n    def ComputeOutputBasename(self, spec):\n        \"\"\"Return the 'output basename' of a gyp spec.\n\n        E.g., the loadable module 'foobar' in directory 'baz' will produce\n          'libfoobar.so'\n        \"\"\"\n        return \"\".join(self.ComputeOutputParts(spec))\n\n    def ComputeOutput(self, spec):\n        \"\"\"Return the 'output' (full output path) of a gyp spec.\n\n        E.g., the loadable module 'foobar' in directory 'baz' will produce\n          '$(obj)/baz/libfoobar.so'\n        \"\"\"\n        if self.type == \"executable\":\n            # We install host executables into shared_intermediate_dir so they can be\n            # run by gyp rules that refer to PRODUCT_DIR.\n            path = \"$(gyp_shared_intermediate_dir)\"\n        elif self.type == \"shared_library\":\n            if self.toolset == \"host\":\n                path = \"$($(GYP_HOST_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)\"\n            else:\n                path = \"$($(GYP_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)\"\n        # Other targets just get built into their intermediate dir.\n        elif self.toolset == \"host\":\n            path = (\n                \"$(call intermediates-dir-for,%s,%s,true,,\"\n                \"$(GYP_HOST_VAR_PREFIX))\" % (self.android_class, self.android_module)\n            )\n        else:\n            path = (\n                f\"$(call intermediates-dir-for,{self.android_class},\"\n                f\"{self.android_module},,,$(GYP_VAR_PREFIX))\"\n            )\n\n        assert spec.get(\"product_dir\") is None  # TODO: not supported?\n        return os.path.join(path, self.ComputeOutputBasename(spec))\n\n    def NormalizeIncludePaths(self, include_paths):\n        \"\"\"Normalize include_paths.\n        Convert absolute paths to relative to the Android top directory.\n\n        Args:\n          include_paths: A list of unprocessed include paths.\n        Returns:\n          A list of normalized include paths.\n        \"\"\"\n        normalized = []\n        for path in include_paths:\n            if path[0] == \"/\":\n                path = gyp.common.RelativePath(path, self.android_top_dir)\n            normalized.append(path)\n        return normalized\n\n    def ExtractIncludesFromCFlags(self, cflags):\n        \"\"\"Extract includes \"-I...\" out from cflags\n\n        Args:\n          cflags: A list of compiler flags, which may be mixed with \"-I..\"\n        Returns:\n          A tuple of lists: (clean_cflags, include_paths). \"-I..\" is trimmed.\n        \"\"\"\n        clean_cflags = []\n        include_paths = []\n        for flag in cflags:\n            if flag.startswith(\"-I\"):\n                include_paths.append(flag[2:])\n            else:\n                clean_cflags.append(flag)\n\n        return (clean_cflags, include_paths)\n\n    def FilterLibraries(self, libraries):\n        \"\"\"Filter the 'libraries' key to separate things that shouldn't be ldflags.\n\n        Library entries that look like filenames should be converted to android\n        module names instead of being passed to the linker as flags.\n\n        Args:\n          libraries: the value of spec.get('libraries')\n        Returns:\n          A tuple (static_lib_modules, dynamic_lib_modules, ldflags)\n        \"\"\"\n        static_lib_modules = []\n        dynamic_lib_modules = []\n        ldflags = []\n        for libs in libraries:\n            # Libs can have multiple words.\n            for lib in libs.split():\n                # Filter the system libraries, which are added by default by the Android\n                # build system.\n                if (\n                    lib == \"-lc\"\n                    or lib == \"-lstdc++\"\n                    or lib == \"-lm\"\n                    or lib.endswith(\"libgcc.a\")\n                ):\n                    continue\n                match = re.search(r\"([^/]+)\\.a$\", lib)\n                if match:\n                    static_lib_modules.append(match.group(1))\n                    continue\n                match = re.search(r\"([^/]+)\\.so$\", lib)\n                if match:\n                    dynamic_lib_modules.append(match.group(1))\n                    continue\n                if lib.startswith(\"-l\"):\n                    ldflags.append(lib)\n        return (static_lib_modules, dynamic_lib_modules, ldflags)\n\n    def ComputeDeps(self, spec):\n        \"\"\"Compute the dependencies of a gyp spec.\n\n        Returns a tuple (deps, link_deps), where each is a list of\n        filenames that will need to be put in front of make for either\n        building (deps) or linking (link_deps).\n        \"\"\"\n        deps = []\n        link_deps = []\n        if \"dependencies\" in spec:\n            deps.extend(\n                [\n                    target_outputs[dep]\n                    for dep in spec[\"dependencies\"]\n                    if target_outputs[dep]\n                ]\n            )\n            for dep in spec[\"dependencies\"]:\n                if dep in target_link_deps:\n                    link_deps.append(target_link_deps[dep])\n            deps.extend(link_deps)\n        return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps))\n\n    def WriteTargetFlags(self, spec, configs, link_deps):\n        \"\"\"Write Makefile code to specify the link flags and library dependencies.\n\n        spec, configs: input from gyp.\n        link_deps: link dependency list; see ComputeDeps()\n        \"\"\"\n        # Libraries (i.e. -lfoo)\n        # These must be included even for static libraries as some of them provide\n        # implicit include paths through the build system.\n        libraries = gyp.common.uniquer(spec.get(\"libraries\", []))\n        static_libs, dynamic_libs, ldflags_libs = self.FilterLibraries(libraries)\n\n        if self.type != \"static_library\":\n            for configname, config in sorted(configs.items()):\n                ldflags = list(config.get(\"ldflags\", []))\n                self.WriteLn(\"\")\n                self.WriteList(ldflags, \"LOCAL_LDFLAGS_%s\" % configname)\n            self.WriteList(ldflags_libs, \"LOCAL_GYP_LIBS\")\n            self.WriteLn(\n                \"LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) \"\n                \"$(LOCAL_GYP_LIBS)\"\n            )\n\n        # Link dependencies (i.e. other gyp targets this target depends on)\n        # These need not be included for static libraries as within the gyp build\n        # we do not use the implicit include path mechanism.\n        if self.type != \"static_library\":\n            static_link_deps = [x[1] for x in link_deps if x[0] == \"static\"]\n            shared_link_deps = [x[1] for x in link_deps if x[0] == \"shared\"]\n        else:\n            static_link_deps = []\n            shared_link_deps = []\n\n        # Only write the lists if they are non-empty.\n        if static_libs or static_link_deps:\n            self.WriteLn(\"\")\n            self.WriteList(static_libs + static_link_deps, \"LOCAL_STATIC_LIBRARIES\")\n            self.WriteLn(\"# Enable grouping to fix circular references\")\n            self.WriteLn(\"LOCAL_GROUP_STATIC_LIBRARIES := true\")\n        if dynamic_libs or shared_link_deps:\n            self.WriteLn(\"\")\n            self.WriteList(dynamic_libs + shared_link_deps, \"LOCAL_SHARED_LIBRARIES\")\n\n    def WriteTarget(\n        self, spec, configs, deps, link_deps, part_of_all, write_alias_target\n    ):\n        \"\"\"Write Makefile code to produce the final target of the gyp spec.\n\n        spec, configs: input from gyp.\n        deps, link_deps: dependency lists; see ComputeDeps()\n        part_of_all: flag indicating this target is part of 'all'\n        write_alias_target: flag indicating whether to create short aliases for this\n                            target\n        \"\"\"\n        self.WriteLn(\"### Rules for final target.\")\n\n        if self.type != \"none\":\n            self.WriteTargetFlags(spec, configs, link_deps)\n\n        if settings := spec.get(\"aosp_build_settings\", {}):\n            self.WriteLn(\"### Set directly by aosp_build_settings.\")\n            for k, v in settings.items():\n                if isinstance(v, list):\n                    self.WriteList(v, k)\n                else:\n                    self.WriteLn(f\"{k} := {make.QuoteIfNecessary(v)}\")\n            self.WriteLn(\"\")\n\n        # Add to the set of targets which represent the gyp 'all' target. We use the\n        # name 'gyp_all_modules' as the Android build system doesn't allow the use\n        # of the Make target 'all' and because 'all_modules' is the equivalent of\n        # the Make target 'all' on Android.\n        if part_of_all and write_alias_target:\n            self.WriteLn('# Add target alias to \"gyp_all_modules\" target.')\n            self.WriteLn(\".PHONY: gyp_all_modules\")\n            self.WriteLn(\"gyp_all_modules: %s\" % self.android_module)\n            self.WriteLn(\"\")\n\n        # Add an alias from the gyp target name to the Android module name. This\n        # simplifies manual builds of the target, and is required by the test\n        # framework.\n        if self.target != self.android_module and write_alias_target:\n            self.WriteLn(\"# Alias gyp target name.\")\n            self.WriteLn(\".PHONY: %s\" % self.target)\n            self.WriteLn(f\"{self.target}: {self.android_module}\")\n            self.WriteLn(\"\")\n\n        # Add the command to trigger build of the target type depending\n        # on the toolset. Ex: BUILD_STATIC_LIBRARY vs. BUILD_HOST_STATIC_LIBRARY\n        # NOTE: This has to come last!\n        modifier = \"\"\n        if self.toolset == \"host\":\n            modifier = \"HOST_\"\n        if self.type == \"static_library\":\n            self.WriteLn(\"include $(BUILD_%sSTATIC_LIBRARY)\" % modifier)\n        elif self.type == \"shared_library\":\n            self.WriteLn(\"LOCAL_PRELINK_MODULE := false\")\n            self.WriteLn(\"include $(BUILD_%sSHARED_LIBRARY)\" % modifier)\n        elif self.type == \"executable\":\n            self.WriteLn(\"LOCAL_CXX_STL := libc++_static\")\n            # Executables are for build and test purposes only, so they're installed\n            # to a directory that doesn't get included in the system image.\n            self.WriteLn(\"LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)\")\n            self.WriteLn(\"include $(BUILD_%sEXECUTABLE)\" % modifier)\n        else:\n            self.WriteLn(\"LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp\")\n            self.WriteLn(\"LOCAL_UNINSTALLABLE_MODULE := true\")\n            if self.toolset == \"target\":\n                self.WriteLn(\"LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_VAR_PREFIX)\")\n            else:\n                self.WriteLn(\"LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_HOST_VAR_PREFIX)\")\n            self.WriteLn()\n            self.WriteLn(\"include $(BUILD_SYSTEM)/base_rules.mk\")\n            self.WriteLn()\n            self.WriteLn(\"$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)\")\n            self.WriteLn('\\t$(hide) echo \"Gyp timestamp: $@\"')\n            self.WriteLn(\"\\t$(hide) mkdir -p $(dir $@)\")\n            self.WriteLn(\"\\t$(hide) touch $@\")\n            self.WriteLn()\n            self.WriteLn(\"LOCAL_2ND_ARCH_VAR_PREFIX :=\")\n\n    def WriteList(\n        self,\n        value_list,\n        variable=None,\n        prefix=\"\",\n        quoter=make.QuoteIfNecessary,\n        local_pathify=False,\n    ):\n        \"\"\"Write a variable definition that is a list of values.\n\n        E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out\n             foo = blaha blahb\n        but in a pretty-printed style.\n        \"\"\"\n        values = \"\"\n        if value_list:\n            value_list = [quoter(prefix + value) for value in value_list]\n            if local_pathify:\n                value_list = [self.LocalPathify(value) for value in value_list]\n            values = \" \\\\\\n\\t\" + \" \\\\\\n\\t\".join(value_list)\n        self.fp.write(f\"{variable} :={values}\\n\\n\")\n\n    def WriteLn(self, text=\"\"):\n        self.fp.write(text + \"\\n\")\n\n    def LocalPathify(self, path):\n        \"\"\"Convert a subdirectory-relative path into a normalized path which starts\n        with the make variable $(LOCAL_PATH) (i.e. the top of the project tree).\n        Absolute paths, or paths that contain variables, are just normalized.\"\"\"\n        if \"$(\" in path or os.path.isabs(path):\n            # path is not a file in the project tree in this case, but calling\n            # normpath is still important for trimming trailing slashes.\n            return os.path.normpath(path)\n        local_path = os.path.join(\"$(LOCAL_PATH)\", self.path, path)\n        local_path = os.path.normpath(local_path)\n        # Check that normalizing the path didn't ../ itself out of $(LOCAL_PATH)\n        # - i.e. that the resulting path is still inside the project tree. The\n        # path may legitimately have ended up containing just $(LOCAL_PATH), though,\n        # so we don't look for a slash.\n        assert local_path.startswith(\"$(LOCAL_PATH)\"), (\n            f\"Path {path} attempts to escape from gyp path {self.path} !)\"\n        )\n        return local_path\n\n    def ExpandInputRoot(self, template, expansion, dirname):\n        if \"%(INPUT_ROOT)s\" not in template and \"%(INPUT_DIRNAME)s\" not in template:\n            return template\n        path = template % {\n            \"INPUT_ROOT\": expansion,\n            \"INPUT_DIRNAME\": dirname,\n        }\n        return os.path.normpath(path)\n\n\ndef PerformBuild(data, configurations, params):\n    # The android backend only supports the default configuration.\n    options = params[\"options\"]\n    makefile = os.path.abspath(os.path.join(options.toplevel_dir, \"GypAndroid.mk\"))\n    env = dict(os.environ)\n    env[\"ONE_SHOT_MAKEFILE\"] = makefile\n    arguments = [\"make\", \"-C\", os.environ[\"ANDROID_BUILD_TOP\"], \"gyp_all_modules\"]\n    print(\"Building: %s\" % arguments)\n    subprocess.check_call(arguments, env=env)\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    options = params[\"options\"]\n    generator_flags = params.get(\"generator_flags\", {})\n    limit_to_target_all = generator_flags.get(\"limit_to_target_all\", False)\n    write_alias_targets = generator_flags.get(\"write_alias_targets\", True)\n    sdk_version = generator_flags.get(\"aosp_sdk_version\", 0)\n    android_top_dir = os.environ.get(\"ANDROID_BUILD_TOP\")\n    assert android_top_dir, \"$ANDROID_BUILD_TOP not set; you need to run lunch.\"\n\n    def CalculateMakefilePath(build_file, base_name):\n        \"\"\"Determine where to write a Makefile for a given gyp file.\"\"\"\n        # Paths in gyp files are relative to the .gyp file, but we want\n        # paths relative to the source root for the master makefile.  Grab\n        # the path of the .gyp file as the base to relativize against.\n        # E.g. \"foo/bar\" when we're constructing targets for \"foo/bar/baz.gyp\".\n        base_path = gyp.common.RelativePath(os.path.dirname(build_file), options.depth)\n        # We write the file in the base_path directory.\n        output_file = os.path.join(options.depth, base_path, base_name)\n        assert not options.generator_output, (\n            \"The Android backend does not support options.generator_output.\"\n        )\n        base_path = gyp.common.RelativePath(\n            os.path.dirname(build_file), options.toplevel_dir\n        )\n        return base_path, output_file\n\n    # TODO:  search for the first non-'Default' target.  This can go\n    # away when we add verification that all targets have the\n    # necessary configurations.\n    default_configuration = None\n    for target in target_list:\n        spec = target_dicts[target]\n        if spec[\"default_configuration\"] != \"Default\":\n            default_configuration = spec[\"default_configuration\"]\n            break\n    if not default_configuration:\n        default_configuration = \"Default\"\n\n    makefile_name = \"GypAndroid\" + options.suffix + \".mk\"\n    makefile_path = os.path.join(options.toplevel_dir, makefile_name)\n    assert not options.generator_output, (\n        \"The Android backend does not support options.generator_output.\"\n    )\n    gyp.common.EnsureDirExists(makefile_path)\n    root_makefile = open(makefile_path, \"w\")\n\n    root_makefile.write(header)\n\n    # We set LOCAL_PATH just once, here, to the top of the project tree. This\n    # allows all the other paths we use to be relative to the Android.mk file,\n    # as the Android build system expects.\n    root_makefile.write(\"\\nLOCAL_PATH := $(call my-dir)\\n\")\n\n    # Find the list of targets that derive from the gyp file(s) being built.\n    needed_targets = set()\n    for build_file in params[\"build_files\"]:\n        for target in gyp.common.AllTargets(target_list, target_dicts, build_file):\n            needed_targets.add(target)\n\n    build_files = set()\n    include_list = set()\n    android_modules = {}\n    for qualified_target in target_list:\n        build_file, target, toolset = gyp.common.ParseQualifiedTarget(qualified_target)\n        relative_build_file = gyp.common.RelativePath(build_file, options.toplevel_dir)\n        build_files.add(relative_build_file)\n        included_files = data[build_file][\"included_files\"]\n        for included_file in included_files:\n            # The included_files entries are relative to the dir of the build file\n            # that included them, so we have to undo that and then make them relative\n            # to the root dir.\n            relative_include_file = gyp.common.RelativePath(\n                gyp.common.UnrelativePath(included_file, build_file),\n                options.toplevel_dir,\n            )\n            abs_include_file = os.path.abspath(relative_include_file)\n            # If the include file is from the ~/.gyp dir, we should use absolute path\n            # so that relocating the src dir doesn't break the path.\n            if params[\"home_dot_gyp\"] and abs_include_file.startswith(\n                params[\"home_dot_gyp\"]\n            ):\n                build_files.add(abs_include_file)\n            else:\n                build_files.add(relative_include_file)\n\n        base_path, output_file = CalculateMakefilePath(\n            build_file, target + \".\" + toolset + options.suffix + \".mk\"\n        )\n\n        spec = target_dicts[qualified_target]\n        configs = spec[\"configurations\"]\n\n        part_of_all = qualified_target in needed_targets\n        if limit_to_target_all and not part_of_all:\n            continue\n\n        relative_target = gyp.common.QualifiedTarget(\n            relative_build_file, target, toolset\n        )\n        writer = AndroidMkWriter(android_top_dir)\n        android_module = writer.Write(\n            qualified_target,\n            relative_target,\n            base_path,\n            output_file,\n            spec,\n            configs,\n            part_of_all=part_of_all,\n            write_alias_target=write_alias_targets,\n            sdk_version=sdk_version,\n        )\n        if android_module in android_modules:\n            print(\n                \"ERROR: Android module names must be unique. The following \"\n                \"targets both generate Android module name %s.\\n  %s\\n  %s\"\n                % (android_module, android_modules[android_module], qualified_target)\n            )\n            return\n        android_modules[android_module] = qualified_target\n\n        # Our root_makefile lives at the source root.  Compute the relative path\n        # from there to the output_file for including.\n        mkfile_rel_path = gyp.common.RelativePath(\n            output_file, os.path.dirname(makefile_path)\n        )\n        include_list.add(mkfile_rel_path)\n\n    root_makefile.write(\"GYP_CONFIGURATION ?= %s\\n\" % default_configuration)\n    root_makefile.write(\"GYP_VAR_PREFIX ?=\\n\")\n    root_makefile.write(\"GYP_HOST_VAR_PREFIX ?=\\n\")\n    root_makefile.write(\"GYP_HOST_MULTILIB ?= first\\n\")\n\n    # Write out the sorted list of includes.\n    root_makefile.write(\"\\n\")\n    for include_file in sorted(include_list):\n        root_makefile.write(\"include $(LOCAL_PATH)/\" + include_file + \"\\n\")\n    root_makefile.write(\"\\n\")\n\n    if write_alias_targets:\n        root_makefile.write(ALL_MODULES_FOOTER)\n\n    root_makefile.close()\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/cmake.py",
    "content": "# Copyright (c) 2013 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"cmake output module\n\nThis module is under development and should be considered experimental.\n\nThis module produces cmake (2.8.8+) input as its output. One CMakeLists.txt is\ncreated for each configuration.\n\nThis module's original purpose was to support editing in IDEs like KDevelop\nwhich use CMake for project management. It is also possible to use CMake to\ngenerate projects for other IDEs such as eclipse cdt and code::blocks. QtCreator\nwill convert the CMakeLists.txt to a code::blocks cbp for the editor to read,\nbut build using CMake. As a result QtCreator editor is unaware of compiler\ndefines. The generated CMakeLists.txt can also be used to build on Linux. There\nis currently no support for building on platforms other than Linux.\n\nThe generated CMakeLists.txt should properly compile all projects. However,\nthere is a mismatch between gyp and cmake with regard to linking. All attempts\nare made to work around this, but CMake sometimes sees -Wl,--start-group as a\nlibrary and incorrectly repeats it. As a result the output of this generator\nshould not be relied on for building.\n\nWhen using with kdevelop, use version 4.4+. Previous versions of kdevelop will\nnot be able to find the header file directories described in the generated\nCMakeLists.txt file.\n\"\"\"\n\nimport multiprocessing\nimport os\nimport signal\nimport subprocess\n\nimport gyp.common\nimport gyp.xcode_emulation\n\n_maketrans = str.maketrans\n\ngenerator_default_variables = {\n    \"EXECUTABLE_PREFIX\": \"\",\n    \"EXECUTABLE_SUFFIX\": \"\",\n    \"STATIC_LIB_PREFIX\": \"lib\",\n    \"STATIC_LIB_SUFFIX\": \".a\",\n    \"SHARED_LIB_PREFIX\": \"lib\",\n    \"SHARED_LIB_SUFFIX\": \".so\",\n    \"SHARED_LIB_DIR\": \"${builddir}/lib.${TOOLSET}\",\n    \"LIB_DIR\": \"${obj}.${TOOLSET}\",\n    \"INTERMEDIATE_DIR\": \"${obj}.${TOOLSET}/${TARGET}/geni\",\n    \"SHARED_INTERMEDIATE_DIR\": \"${obj}/gen\",\n    \"PRODUCT_DIR\": \"${builddir}\",\n    \"RULE_INPUT_PATH\": \"${RULE_INPUT_PATH}\",\n    \"RULE_INPUT_DIRNAME\": \"${RULE_INPUT_DIRNAME}\",\n    \"RULE_INPUT_NAME\": \"${RULE_INPUT_NAME}\",\n    \"RULE_INPUT_ROOT\": \"${RULE_INPUT_ROOT}\",\n    \"RULE_INPUT_EXT\": \"${RULE_INPUT_EXT}\",\n    \"CONFIGURATION_NAME\": \"${configuration}\",\n}\n\nFULL_PATH_VARS = (\"${CMAKE_CURRENT_LIST_DIR}\", \"${builddir}\", \"${obj}\")\n\ngenerator_supports_multiple_toolsets = True\ngenerator_wants_static_library_dependencies_adjusted = True\n\nCOMPILABLE_EXTENSIONS = {\n    \".c\": \"cc\",\n    \".cc\": \"cxx\",\n    \".cpp\": \"cxx\",\n    \".cxx\": \"cxx\",\n    \".s\": \"s\",  # cc\n    \".S\": \"s\",  # cc\n}\n\n\ndef RemovePrefix(a, prefix):\n    \"\"\"Returns 'a' without 'prefix' if it starts with 'prefix'.\"\"\"\n    return a[len(prefix) :] if a.startswith(prefix) else a\n\n\ndef CalculateVariables(default_variables, params):\n    \"\"\"Calculate additional variables for use in the build (called by gyp).\"\"\"\n    default_variables.setdefault(\"OS\", gyp.common.GetFlavor(params))\n\n\ndef Compilable(filename):\n    \"\"\"Return true if the file is compilable (should be in OBJS).\"\"\"\n    return any(filename.endswith(e) for e in COMPILABLE_EXTENSIONS)\n\n\ndef Linkable(filename):\n    \"\"\"Return true if the file is linkable (should be on the link line).\"\"\"\n    return filename.endswith(\".o\")\n\n\ndef NormjoinPathForceCMakeSource(base_path, rel_path):\n    \"\"\"Resolves rel_path against base_path and returns the result.\n\n    If rel_path is an absolute path it is returned unchanged.\n    Otherwise it is resolved against base_path and normalized.\n    If the result is a relative path, it is forced to be relative to the\n    CMakeLists.txt.\n    \"\"\"\n    if os.path.isabs(rel_path):\n        return rel_path\n    if any(rel_path.startswith(var) for var in FULL_PATH_VARS):\n        return rel_path\n    # TODO: do we need to check base_path for absolute variables as well?\n    return os.path.join(\n        \"${CMAKE_CURRENT_LIST_DIR}\", os.path.normpath(os.path.join(base_path, rel_path))\n    )\n\n\ndef NormjoinPath(base_path, rel_path):\n    \"\"\"Resolves rel_path against base_path and returns the result.\n    TODO: what is this really used for?\n    If rel_path begins with '$' it is returned unchanged.\n    Otherwise it is resolved against base_path if relative, then normalized.\n    \"\"\"\n    if rel_path.startswith(\"$\") and not rel_path.startswith(\"${configuration}\"):\n        return rel_path\n    return os.path.normpath(os.path.join(base_path, rel_path))\n\n\ndef CMakeStringEscape(a):\n    \"\"\"Escapes the string 'a' for use inside a CMake string.\n\n    This means escaping\n    '\\' otherwise it may be seen as modifying the next character\n    '\"' otherwise it will end the string\n    ';' otherwise the string becomes a list\n\n    The following do not need to be escaped\n    '#' when the lexer is in string state, this does not start a comment\n\n    The following are yet unknown\n    '$' generator variables (like ${obj}) must not be escaped,\n        but text $ should be escaped\n        what is wanted is to know which $ come from generator variables\n    \"\"\"\n    return a.replace(\"\\\\\", \"\\\\\\\\\").replace(\";\", \"\\\\;\").replace('\"', '\\\\\"')\n\n\ndef SetFileProperty(output, source_name, property_name, values, sep):\n    \"\"\"Given a set of source file, sets the given property on them.\"\"\"\n    output.write(\"set_source_files_properties(\")\n    output.write(source_name)\n    output.write(\" PROPERTIES \")\n    output.write(property_name)\n    output.write(' \"')\n    for value in values:\n        output.write(CMakeStringEscape(value))\n        output.write(sep)\n    output.write('\")\\n')\n\n\ndef SetFilesProperty(output, variable, property_name, values, sep):\n    \"\"\"Given a set of source files, sets the given property on them.\"\"\"\n    output.write(\"set_source_files_properties(\")\n    WriteVariable(output, variable)\n    output.write(\" PROPERTIES \")\n    output.write(property_name)\n    output.write(' \"')\n    for value in values:\n        output.write(CMakeStringEscape(value))\n        output.write(sep)\n    output.write('\")\\n')\n\n\ndef SetTargetProperty(output, target_name, property_name, values, sep=\"\"):\n    \"\"\"Given a target, sets the given property.\"\"\"\n    output.write(\"set_target_properties(\")\n    output.write(target_name)\n    output.write(\" PROPERTIES \")\n    output.write(property_name)\n    output.write(' \"')\n    for value in values:\n        output.write(CMakeStringEscape(value))\n        output.write(sep)\n    output.write('\")\\n')\n\n\ndef SetVariable(output, variable_name, value):\n    \"\"\"Sets a CMake variable.\"\"\"\n    output.write(\"set(\")\n    output.write(variable_name)\n    output.write(' \"')\n    output.write(CMakeStringEscape(value))\n    output.write('\")\\n')\n\n\ndef SetVariableList(output, variable_name, values):\n    \"\"\"Sets a CMake variable to a list.\"\"\"\n    if not values:\n        return SetVariable(output, variable_name, \"\")\n    if len(values) == 1:\n        return SetVariable(output, variable_name, values[0])\n    output.write(\"list(APPEND \")\n    output.write(variable_name)\n    output.write('\\n  \"')\n    output.write('\"\\n  \"'.join([CMakeStringEscape(value) for value in values]))\n    output.write('\")\\n')\n\n\ndef UnsetVariable(output, variable_name):\n    \"\"\"Unsets a CMake variable.\"\"\"\n    output.write(\"unset(\")\n    output.write(variable_name)\n    output.write(\")\\n\")\n\n\ndef WriteVariable(output, variable_name, prepend=None):\n    if prepend:\n        output.write(prepend)\n    output.write(\"${\")\n    output.write(variable_name)\n    output.write(\"}\")\n\n\nclass CMakeTargetType:\n    def __init__(self, command, modifier, property_modifier):\n        self.command = command\n        self.modifier = modifier\n        self.property_modifier = property_modifier\n\n\ncmake_target_type_from_gyp_target_type = {\n    \"executable\": CMakeTargetType(\"add_executable\", None, \"RUNTIME\"),\n    \"static_library\": CMakeTargetType(\"add_library\", \"STATIC\", \"ARCHIVE\"),\n    \"shared_library\": CMakeTargetType(\"add_library\", \"SHARED\", \"LIBRARY\"),\n    \"loadable_module\": CMakeTargetType(\"add_library\", \"MODULE\", \"LIBRARY\"),\n    \"none\": CMakeTargetType(\"add_custom_target\", \"SOURCES\", None),\n}\n\n\ndef StringToCMakeTargetName(a):\n    \"\"\"Converts the given string 'a' to a valid CMake target name.\n\n    All invalid characters are replaced by '_'.\n    Invalid for cmake: ' ', '/', '(', ')', '\"'\n    Invalid for make: ':'\n    Invalid for unknown reasons but cause failures: '.'\n    \"\"\"\n    return a.translate(_maketrans(' /():.\"', \"_______\"))\n\n\ndef WriteActions(target_name, actions, extra_sources, extra_deps, path_to_gyp, output):\n    \"\"\"Write CMake for the 'actions' in the target.\n\n    Args:\n      target_name: the name of the CMake target being generated.\n      actions: the Gyp 'actions' dict for this target.\n      extra_sources: [(<cmake_src>, <src>)] to append with generated source files.\n      extra_deps: [<cmake_target>] to append with generated targets.\n      path_to_gyp: relative path from CMakeLists.txt being generated to\n          the Gyp file in which the target being generated is defined.\n    \"\"\"\n    for action in actions:\n        action_name = StringToCMakeTargetName(action[\"action_name\"])\n        action_target_name = f\"{target_name}__{action_name}\"\n\n        inputs = action[\"inputs\"]\n        inputs_name = action_target_name + \"__input\"\n        SetVariableList(\n            output,\n            inputs_name,\n            [NormjoinPathForceCMakeSource(path_to_gyp, dep) for dep in inputs],\n        )\n\n        outputs = action[\"outputs\"]\n        cmake_outputs = [\n            NormjoinPathForceCMakeSource(path_to_gyp, out) for out in outputs\n        ]\n        outputs_name = action_target_name + \"__output\"\n        SetVariableList(output, outputs_name, cmake_outputs)\n\n        # Build up a list of outputs.\n        # Collect the output dirs we'll need.\n        dirs = {dir for dir in (os.path.dirname(o) for o in outputs) if dir}\n\n        if int(action.get(\"process_outputs_as_sources\", False)):\n            extra_sources.extend(zip(cmake_outputs, outputs))\n\n        # add_custom_command\n        output.write(\"add_custom_command(OUTPUT \")\n        WriteVariable(output, outputs_name)\n        output.write(\"\\n\")\n\n        if len(dirs) > 0:\n            for directory in dirs:\n                output.write(\"  COMMAND ${CMAKE_COMMAND} -E make_directory \")\n                output.write(directory)\n                output.write(\"\\n\")\n\n        output.write(\"  COMMAND \")\n        output.write(gyp.common.EncodePOSIXShellList(action[\"action\"]))\n        output.write(\"\\n\")\n\n        output.write(\"  DEPENDS \")\n        WriteVariable(output, inputs_name)\n        output.write(\"\\n\")\n\n        output.write(\"  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/\")\n        output.write(path_to_gyp)\n        output.write(\"\\n\")\n\n        output.write(\"  COMMENT \")\n        if \"message\" in action:\n            output.write(action[\"message\"])\n        else:\n            output.write(action_target_name)\n        output.write(\"\\n\")\n\n        output.write(\"  VERBATIM\\n\")\n        output.write(\")\\n\")\n\n        # add_custom_target\n        output.write(\"add_custom_target(\")\n        output.write(action_target_name)\n        output.write(\"\\n  DEPENDS \")\n        WriteVariable(output, outputs_name)\n        output.write(\"\\n  SOURCES \")\n        WriteVariable(output, inputs_name)\n        output.write(\"\\n)\\n\")\n\n        extra_deps.append(action_target_name)\n\n\ndef NormjoinRulePathForceCMakeSource(base_path, rel_path, rule_source):\n    if rel_path.startswith((\"${RULE_INPUT_PATH}\", \"${RULE_INPUT_DIRNAME}\")):\n        if any(rule_source.startswith(var) for var in FULL_PATH_VARS):\n            return rel_path\n    return NormjoinPathForceCMakeSource(base_path, rel_path)\n\n\ndef WriteRules(target_name, rules, extra_sources, extra_deps, path_to_gyp, output):\n    \"\"\"Write CMake for the 'rules' in the target.\n\n    Args:\n      target_name: the name of the CMake target being generated.\n      actions: the Gyp 'actions' dict for this target.\n      extra_sources: [(<cmake_src>, <src>)] to append with generated source files.\n      extra_deps: [<cmake_target>] to append with generated targets.\n      path_to_gyp: relative path from CMakeLists.txt being generated to\n          the Gyp file in which the target being generated is defined.\n    \"\"\"\n    for rule in rules:\n        rule_name = StringToCMakeTargetName(target_name + \"__\" + rule[\"rule_name\"])\n\n        inputs = rule.get(\"inputs\", [])\n        inputs_name = rule_name + \"__input\"\n        SetVariableList(\n            output,\n            inputs_name,\n            [NormjoinPathForceCMakeSource(path_to_gyp, dep) for dep in inputs],\n        )\n        outputs = rule[\"outputs\"]\n        var_outputs = []\n\n        for count, rule_source in enumerate(rule.get(\"rule_sources\", [])):\n            action_name = rule_name + \"_\" + str(count)\n\n            rule_source_dirname, rule_source_basename = os.path.split(rule_source)\n            rule_source_root, rule_source_ext = os.path.splitext(rule_source_basename)\n\n            SetVariable(output, \"RULE_INPUT_PATH\", rule_source)\n            SetVariable(output, \"RULE_INPUT_DIRNAME\", rule_source_dirname)\n            SetVariable(output, \"RULE_INPUT_NAME\", rule_source_basename)\n            SetVariable(output, \"RULE_INPUT_ROOT\", rule_source_root)\n            SetVariable(output, \"RULE_INPUT_EXT\", rule_source_ext)\n\n            # Build up a list of outputs.\n            # Collect the output dirs we'll need.\n            dirs = {dir for dir in (os.path.dirname(o) for o in outputs) if dir}\n\n            # Create variables for the output, as 'local' variable will be unset.\n            these_outputs = []\n            for output_index, out in enumerate(outputs):\n                output_name = action_name + \"_\" + str(output_index)\n                SetVariable(\n                    output,\n                    output_name,\n                    NormjoinRulePathForceCMakeSource(path_to_gyp, out, rule_source),\n                )\n                if int(rule.get(\"process_outputs_as_sources\", False)):\n                    extra_sources.append((\"${\" + output_name + \"}\", out))\n                these_outputs.append(\"${\" + output_name + \"}\")\n                var_outputs.append(\"${\" + output_name + \"}\")\n\n            # add_custom_command\n            output.write(\"add_custom_command(OUTPUT\\n\")\n            for out in these_outputs:\n                output.write(\"  \")\n                output.write(out)\n                output.write(\"\\n\")\n\n            for directory in dirs:\n                output.write(\"  COMMAND ${CMAKE_COMMAND} -E make_directory \")\n                output.write(directory)\n                output.write(\"\\n\")\n\n            output.write(\"  COMMAND \")\n            output.write(gyp.common.EncodePOSIXShellList(rule[\"action\"]))\n            output.write(\"\\n\")\n\n            output.write(\"  DEPENDS \")\n            WriteVariable(output, inputs_name)\n            output.write(\" \")\n            output.write(NormjoinPath(path_to_gyp, rule_source))\n            output.write(\"\\n\")\n\n            # CMAKE_CURRENT_LIST_DIR is where the CMakeLists.txt lives.\n            # The cwd is the current build directory.\n            output.write(\"  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/\")\n            output.write(path_to_gyp)\n            output.write(\"\\n\")\n\n            output.write(\"  COMMENT \")\n            if \"message\" in rule:\n                output.write(rule[\"message\"])\n            else:\n                output.write(action_name)\n            output.write(\"\\n\")\n\n            output.write(\"  VERBATIM\\n\")\n            output.write(\")\\n\")\n\n            UnsetVariable(output, \"RULE_INPUT_PATH\")\n            UnsetVariable(output, \"RULE_INPUT_DIRNAME\")\n            UnsetVariable(output, \"RULE_INPUT_NAME\")\n            UnsetVariable(output, \"RULE_INPUT_ROOT\")\n            UnsetVariable(output, \"RULE_INPUT_EXT\")\n\n        # add_custom_target\n        output.write(\"add_custom_target(\")\n        output.write(rule_name)\n        output.write(\" DEPENDS\\n\")\n        for out in var_outputs:\n            output.write(\"  \")\n            output.write(out)\n            output.write(\"\\n\")\n        output.write(\"SOURCES \")\n        WriteVariable(output, inputs_name)\n        output.write(\"\\n\")\n        for rule_source in rule.get(\"rule_sources\", []):\n            output.write(\"  \")\n            output.write(NormjoinPath(path_to_gyp, rule_source))\n            output.write(\"\\n\")\n        output.write(\")\\n\")\n\n        extra_deps.append(rule_name)\n\n\ndef WriteCopies(target_name, copies, extra_deps, path_to_gyp, output):\n    \"\"\"Write CMake for the 'copies' in the target.\n\n    Args:\n      target_name: the name of the CMake target being generated.\n      actions: the Gyp 'actions' dict for this target.\n      extra_deps: [<cmake_target>] to append with generated targets.\n      path_to_gyp: relative path from CMakeLists.txt being generated to\n          the Gyp file in which the target being generated is defined.\n    \"\"\"\n    copy_name = target_name + \"__copies\"\n\n    # CMake gets upset with custom targets with OUTPUT which specify no output.\n    have_copies = any(copy[\"files\"] for copy in copies)\n    if not have_copies:\n        output.write(\"add_custom_target(\")\n        output.write(copy_name)\n        output.write(\")\\n\")\n        extra_deps.append(copy_name)\n        return\n\n    class Copy:\n        def __init__(self, ext, command):\n            self.cmake_inputs = []\n            self.cmake_outputs = []\n            self.gyp_inputs = []\n            self.gyp_outputs = []\n            self.ext = ext\n            self.inputs_name = None\n            self.outputs_name = None\n            self.command = command\n\n    file_copy = Copy(\"\", \"copy\")\n    dir_copy = Copy(\"_dirs\", \"copy_directory\")\n\n    for copy in copies:\n        files = copy[\"files\"]\n        destination = copy[\"destination\"]\n        for src in files:\n            path = os.path.normpath(src)\n            basename = os.path.split(path)[1]\n            dst = os.path.join(destination, basename)\n\n            copy = file_copy if os.path.basename(src) else dir_copy\n\n            copy.cmake_inputs.append(NormjoinPathForceCMakeSource(path_to_gyp, src))\n            copy.cmake_outputs.append(NormjoinPathForceCMakeSource(path_to_gyp, dst))\n            copy.gyp_inputs.append(src)\n            copy.gyp_outputs.append(dst)\n\n    for copy in (file_copy, dir_copy):\n        if copy.cmake_inputs:\n            copy.inputs_name = copy_name + \"__input\" + copy.ext\n            SetVariableList(output, copy.inputs_name, copy.cmake_inputs)\n\n            copy.outputs_name = copy_name + \"__output\" + copy.ext\n            SetVariableList(output, copy.outputs_name, copy.cmake_outputs)\n\n    # add_custom_command\n    output.write(\"add_custom_command(\\n\")\n\n    output.write(\"OUTPUT\")\n    for copy in (file_copy, dir_copy):\n        if copy.outputs_name:\n            WriteVariable(output, copy.outputs_name, \" \")\n    output.write(\"\\n\")\n\n    for copy in (file_copy, dir_copy):\n        for src, dst in zip(copy.gyp_inputs, copy.gyp_outputs):\n            # 'cmake -E copy src dst' will create the 'dst' directory if needed.\n            output.write(\"COMMAND ${CMAKE_COMMAND} -E %s \" % copy.command)\n            output.write(src)\n            output.write(\" \")\n            output.write(dst)\n            output.write(\"\\n\")\n\n    output.write(\"DEPENDS\")\n    for copy in (file_copy, dir_copy):\n        if copy.inputs_name:\n            WriteVariable(output, copy.inputs_name, \" \")\n    output.write(\"\\n\")\n\n    output.write(\"WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/\")\n    output.write(path_to_gyp)\n    output.write(\"\\n\")\n\n    output.write(\"COMMENT Copying for \")\n    output.write(target_name)\n    output.write(\"\\n\")\n\n    output.write(\"VERBATIM\\n\")\n    output.write(\")\\n\")\n\n    # add_custom_target\n    output.write(\"add_custom_target(\")\n    output.write(copy_name)\n    output.write(\"\\n  DEPENDS\")\n    for copy in (file_copy, dir_copy):\n        if copy.outputs_name:\n            WriteVariable(output, copy.outputs_name, \" \")\n    output.write(\"\\n  SOURCES\")\n    if file_copy.inputs_name:\n        WriteVariable(output, file_copy.inputs_name, \" \")\n    output.write(\"\\n)\\n\")\n\n    extra_deps.append(copy_name)\n\n\ndef CreateCMakeTargetBaseName(qualified_target):\n    \"\"\"This is the name we would like the target to have.\"\"\"\n    _, gyp_target_name, gyp_target_toolset = gyp.common.ParseQualifiedTarget(\n        qualified_target\n    )\n    cmake_target_base_name = gyp_target_name\n    if gyp_target_toolset and gyp_target_toolset != \"target\":\n        cmake_target_base_name += \"_\" + gyp_target_toolset\n    return StringToCMakeTargetName(cmake_target_base_name)\n\n\ndef CreateCMakeTargetFullName(qualified_target):\n    \"\"\"An unambiguous name for the target.\"\"\"\n    gyp_file, gyp_target_name, gyp_target_toolset = gyp.common.ParseQualifiedTarget(\n        qualified_target\n    )\n    cmake_target_full_name = gyp_file + \":\" + gyp_target_name\n    if gyp_target_toolset and gyp_target_toolset != \"target\":\n        cmake_target_full_name += \"_\" + gyp_target_toolset\n    return StringToCMakeTargetName(cmake_target_full_name)\n\n\nclass CMakeNamer:\n    \"\"\"Converts Gyp target names into CMake target names.\n\n    CMake requires that target names be globally unique. One way to ensure\n    this is to fully qualify the names of the targets. Unfortunately, this\n    ends up with all targets looking like \"chrome_chrome_gyp_chrome\" instead\n    of just \"chrome\". If this generator were only interested in building, it\n    would be possible to fully qualify all target names, then create\n    unqualified target names which depend on all qualified targets which\n    should have had that name. This is more or less what the 'make' generator\n    does with aliases. However, one goal of this generator is to create CMake\n    files for use with IDEs, and fully qualified names are not as user\n    friendly.\n\n    Since target name collision is rare, we do the above only when required.\n\n    Toolset variants are always qualified from the base, as this is required for\n    building. However, it also makes sense for an IDE, as it is possible for\n    defines to be different.\n    \"\"\"\n\n    def __init__(self, target_list):\n        self.cmake_target_base_names_conflicting = set()\n\n        cmake_target_base_names_seen = set()\n        for qualified_target in target_list:\n            cmake_target_base_name = CreateCMakeTargetBaseName(qualified_target)\n\n            if cmake_target_base_name not in cmake_target_base_names_seen:\n                cmake_target_base_names_seen.add(cmake_target_base_name)\n            else:\n                self.cmake_target_base_names_conflicting.add(cmake_target_base_name)\n\n    def CreateCMakeTargetName(self, qualified_target):\n        base_name = CreateCMakeTargetBaseName(qualified_target)\n        if base_name in self.cmake_target_base_names_conflicting:\n            return CreateCMakeTargetFullName(qualified_target)\n        return base_name\n\n\ndef WriteTarget(\n    namer,\n    qualified_target,\n    target_dicts,\n    build_dir,\n    config_to_use,\n    options,\n    generator_flags,\n    all_qualified_targets,\n    flavor,\n    output,\n):\n    # The make generator does this always.\n    # TODO: It would be nice to be able to tell CMake all dependencies.\n    circular_libs = generator_flags.get(\"circular\", True)\n\n    if not generator_flags.get(\"standalone\", False):\n        output.write(\"\\n#\")\n        output.write(qualified_target)\n        output.write(\"\\n\")\n\n    gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target)\n    rel_gyp_file = gyp.common.RelativePath(gyp_file, options.toplevel_dir)\n    rel_gyp_dir = os.path.dirname(rel_gyp_file)\n\n    # Relative path from build dir to top dir.\n    build_to_top = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir)\n    # Relative path from build dir to gyp dir.\n    build_to_gyp = os.path.join(build_to_top, rel_gyp_dir)\n\n    path_from_cmakelists_to_gyp = build_to_gyp\n\n    spec = target_dicts.get(qualified_target, {})\n    config = spec.get(\"configurations\", {}).get(config_to_use, {})\n\n    xcode_settings = None\n    if flavor == \"mac\":\n        xcode_settings = gyp.xcode_emulation.XcodeSettings(spec)\n\n    target_name = spec.get(\"target_name\", \"<missing target name>\")\n    target_type = spec.get(\"type\", \"<missing target type>\")\n    target_toolset = spec.get(\"toolset\")\n\n    cmake_target_type = cmake_target_type_from_gyp_target_type.get(target_type)\n    if cmake_target_type is None:\n        print(\n            \"Target %s has unknown target type %s, skipping.\"\n            % (target_name, target_type)\n        )\n        return\n\n    SetVariable(output, \"TARGET\", target_name)\n    SetVariable(output, \"TOOLSET\", target_toolset)\n\n    cmake_target_name = namer.CreateCMakeTargetName(qualified_target)\n\n    extra_sources = []\n    extra_deps = []\n\n    # Actions must come first, since they can generate more OBJs for use below.\n    if \"actions\" in spec:\n        WriteActions(\n            cmake_target_name,\n            spec[\"actions\"],\n            extra_sources,\n            extra_deps,\n            path_from_cmakelists_to_gyp,\n            output,\n        )\n\n    # Rules must be early like actions.\n    if \"rules\" in spec:\n        WriteRules(\n            cmake_target_name,\n            spec[\"rules\"],\n            extra_sources,\n            extra_deps,\n            path_from_cmakelists_to_gyp,\n            output,\n        )\n\n    # Copies\n    if \"copies\" in spec:\n        WriteCopies(\n            cmake_target_name,\n            spec[\"copies\"],\n            extra_deps,\n            path_from_cmakelists_to_gyp,\n            output,\n        )\n\n    # Target and sources\n    srcs = spec.get(\"sources\", [])\n\n    # Gyp separates the sheep from the goats based on file extensions.\n    # A full separation is done here because of flag handing (see below).\n    s_sources = []\n    c_sources = []\n    cxx_sources = []\n    linkable_sources = []\n    other_sources = []\n    for src in srcs:\n        _, ext = os.path.splitext(src)\n        src_type = COMPILABLE_EXTENSIONS.get(ext, None)\n        src_norm_path = NormjoinPath(path_from_cmakelists_to_gyp, src)\n\n        if src_type == \"s\":\n            s_sources.append(src_norm_path)\n        elif src_type == \"cc\":\n            c_sources.append(src_norm_path)\n        elif src_type == \"cxx\":\n            cxx_sources.append(src_norm_path)\n        elif Linkable(ext):\n            linkable_sources.append(src_norm_path)\n        else:\n            other_sources.append(src_norm_path)\n\n    for extra_source in extra_sources:\n        src, real_source = extra_source\n        _, ext = os.path.splitext(real_source)\n        src_type = COMPILABLE_EXTENSIONS.get(ext, None)\n\n        if src_type == \"s\":\n            s_sources.append(src)\n        elif src_type == \"cc\":\n            c_sources.append(src)\n        elif src_type == \"cxx\":\n            cxx_sources.append(src)\n        elif Linkable(ext):\n            linkable_sources.append(src)\n        else:\n            other_sources.append(src)\n\n    s_sources_name = None\n    if s_sources:\n        s_sources_name = cmake_target_name + \"__asm_srcs\"\n        SetVariableList(output, s_sources_name, s_sources)\n\n    c_sources_name = None\n    if c_sources:\n        c_sources_name = cmake_target_name + \"__c_srcs\"\n        SetVariableList(output, c_sources_name, c_sources)\n\n    cxx_sources_name = None\n    if cxx_sources:\n        cxx_sources_name = cmake_target_name + \"__cxx_srcs\"\n        SetVariableList(output, cxx_sources_name, cxx_sources)\n\n    linkable_sources_name = None\n    if linkable_sources:\n        linkable_sources_name = cmake_target_name + \"__linkable_srcs\"\n        SetVariableList(output, linkable_sources_name, linkable_sources)\n\n    other_sources_name = None\n    if other_sources:\n        other_sources_name = cmake_target_name + \"__other_srcs\"\n        SetVariableList(output, other_sources_name, other_sources)\n\n    # CMake gets upset when executable targets provide no sources.\n    # http://www.cmake.org/pipermail/cmake/2010-July/038461.html\n    dummy_sources_name = None\n    has_sources = (\n        s_sources_name\n        or c_sources_name\n        or cxx_sources_name\n        or linkable_sources_name\n        or other_sources_name\n    )\n    if target_type == \"executable\" and not has_sources:\n        dummy_sources_name = cmake_target_name + \"__dummy_srcs\"\n        SetVariable(\n            output, dummy_sources_name, \"${obj}.${TOOLSET}/${TARGET}/genc/dummy.c\"\n        )\n        output.write('if(NOT EXISTS \"')\n        WriteVariable(output, dummy_sources_name)\n        output.write('\")\\n')\n        output.write('  file(WRITE \"')\n        WriteVariable(output, dummy_sources_name)\n        output.write('\" \"\")\\n')\n        output.write(\"endif()\\n\")\n\n    # CMake is opposed to setting linker directories and considers the practice\n    # of setting linker directories dangerous. Instead, it favors the use of\n    # find_library and passing absolute paths to target_link_libraries.\n    # However, CMake does provide the command link_directories, which adds\n    # link directories to targets defined after it is called.\n    # As a result, link_directories must come before the target definition.\n    # CMake unfortunately has no means of removing entries from LINK_DIRECTORIES.\n    if (library_dirs := config.get(\"library_dirs\")) is not None:\n        output.write(\"link_directories(\")\n        for library_dir in library_dirs:\n            output.write(\" \")\n            output.write(NormjoinPath(path_from_cmakelists_to_gyp, library_dir))\n            output.write(\"\\n\")\n        output.write(\")\\n\")\n\n    output.write(cmake_target_type.command)\n    output.write(\"(\")\n    output.write(cmake_target_name)\n\n    if cmake_target_type.modifier is not None:\n        output.write(\" \")\n        output.write(cmake_target_type.modifier)\n\n    if s_sources_name:\n        WriteVariable(output, s_sources_name, \" \")\n    if c_sources_name:\n        WriteVariable(output, c_sources_name, \" \")\n    if cxx_sources_name:\n        WriteVariable(output, cxx_sources_name, \" \")\n    if linkable_sources_name:\n        WriteVariable(output, linkable_sources_name, \" \")\n    if other_sources_name:\n        WriteVariable(output, other_sources_name, \" \")\n    if dummy_sources_name:\n        WriteVariable(output, dummy_sources_name, \" \")\n\n    output.write(\")\\n\")\n\n    # Let CMake know if the 'all' target should depend on this target.\n    exclude_from_all = (\n        \"TRUE\" if qualified_target not in all_qualified_targets else \"FALSE\"\n    )\n    SetTargetProperty(output, cmake_target_name, \"EXCLUDE_FROM_ALL\", exclude_from_all)\n    for extra_target_name in extra_deps:\n        SetTargetProperty(\n            output, extra_target_name, \"EXCLUDE_FROM_ALL\", exclude_from_all\n        )\n\n    # Output name and location.\n    if target_type != \"none\":\n        # Link as 'C' if there are no other files\n        if not c_sources and not cxx_sources:\n            SetTargetProperty(output, cmake_target_name, \"LINKER_LANGUAGE\", [\"C\"])\n\n        # Mark uncompiled sources as uncompiled.\n        if other_sources_name:\n            output.write(\"set_source_files_properties(\")\n            WriteVariable(output, other_sources_name, \"\")\n            output.write(' PROPERTIES HEADER_FILE_ONLY \"TRUE\")\\n')\n\n        # Mark object sources as linkable.\n        if linkable_sources_name:\n            output.write(\"set_source_files_properties(\")\n            WriteVariable(output, other_sources_name, \"\")\n            output.write(' PROPERTIES EXTERNAL_OBJECT \"TRUE\")\\n')\n\n        # Output directory\n        target_output_directory = spec.get(\"product_dir\")\n        if target_output_directory is None:\n            if target_type in (\"executable\", \"loadable_module\"):\n                target_output_directory = generator_default_variables[\"PRODUCT_DIR\"]\n            elif target_type == \"shared_library\":\n                target_output_directory = \"${builddir}/lib.${TOOLSET}\"\n            elif spec.get(\"standalone_static_library\", False):\n                target_output_directory = generator_default_variables[\"PRODUCT_DIR\"]\n            else:\n                base_path = gyp.common.RelativePath(\n                    os.path.dirname(gyp_file), options.toplevel_dir\n                )\n                target_output_directory = \"${obj}.${TOOLSET}\"\n                target_output_directory = os.path.join(\n                    target_output_directory, base_path\n                )\n\n        cmake_target_output_directory = NormjoinPathForceCMakeSource(\n            path_from_cmakelists_to_gyp, target_output_directory\n        )\n        SetTargetProperty(\n            output,\n            cmake_target_name,\n            cmake_target_type.property_modifier + \"_OUTPUT_DIRECTORY\",\n            cmake_target_output_directory,\n        )\n\n        # Output name\n        default_product_prefix = \"\"\n        default_product_name = target_name\n        default_product_ext = \"\"\n        if target_type == \"static_library\":\n            static_library_prefix = generator_default_variables[\"STATIC_LIB_PREFIX\"]\n            default_product_name = RemovePrefix(\n                default_product_name, static_library_prefix\n            )\n            default_product_prefix = static_library_prefix\n            default_product_ext = generator_default_variables[\"STATIC_LIB_SUFFIX\"]\n\n        elif target_type in (\"loadable_module\", \"shared_library\"):\n            shared_library_prefix = generator_default_variables[\"SHARED_LIB_PREFIX\"]\n            default_product_name = RemovePrefix(\n                default_product_name, shared_library_prefix\n            )\n            default_product_prefix = shared_library_prefix\n            default_product_ext = generator_default_variables[\"SHARED_LIB_SUFFIX\"]\n\n        elif target_type != \"executable\":\n            print(\n                \"ERROR: What output file should be generated?\",\n                \"type\",\n                target_type,\n                \"target\",\n                target_name,\n            )\n\n        product_prefix = spec.get(\"product_prefix\", default_product_prefix)\n        product_name = spec.get(\"product_name\", default_product_name)\n        product_ext = spec.get(\"product_extension\")\n        product_ext = \".\" + product_ext if product_ext else default_product_ext\n\n        SetTargetProperty(output, cmake_target_name, \"PREFIX\", product_prefix)\n        SetTargetProperty(\n            output,\n            cmake_target_name,\n            cmake_target_type.property_modifier + \"_OUTPUT_NAME\",\n            product_name,\n        )\n        SetTargetProperty(output, cmake_target_name, \"SUFFIX\", product_ext)\n\n        # Make the output of this target referenceable as a source.\n        cmake_target_output_basename = product_prefix + product_name + product_ext\n        cmake_target_output = os.path.join(\n            cmake_target_output_directory, cmake_target_output_basename\n        )\n        SetFileProperty(output, cmake_target_output, \"GENERATED\", [\"TRUE\"], \"\")\n\n        # Includes\n        includes = config.get(\"include_dirs\")\n        if includes:\n            # This (target include directories) is what requires CMake 2.8.8\n            includes_name = cmake_target_name + \"__include_dirs\"\n            SetVariableList(\n                output,\n                includes_name,\n                [\n                    NormjoinPathForceCMakeSource(path_from_cmakelists_to_gyp, include)\n                    for include in includes\n                ],\n            )\n            output.write(\"set_property(TARGET \")\n            output.write(cmake_target_name)\n            output.write(\" APPEND PROPERTY INCLUDE_DIRECTORIES \")\n            WriteVariable(output, includes_name, \"\")\n            output.write(\")\\n\")\n\n        # Defines\n        defines = config.get(\"defines\")\n        if defines is not None:\n            SetTargetProperty(\n                output, cmake_target_name, \"COMPILE_DEFINITIONS\", defines, \";\"\n            )\n\n        # Compile Flags - http://www.cmake.org/Bug/view.php?id=6493\n        # CMake currently does not have target C and CXX flags.\n        # So, instead of doing...\n\n        # cflags_c = config.get('cflags_c')\n        # if cflags_c is not None:\n        #   SetTargetProperty(output, cmake_target_name,\n        #                       'C_COMPILE_FLAGS', cflags_c, ' ')\n\n        # cflags_cc = config.get('cflags_cc')\n        # if cflags_cc is not None:\n        #   SetTargetProperty(output, cmake_target_name,\n        #                       'CXX_COMPILE_FLAGS', cflags_cc, ' ')\n\n        # Instead we must...\n        cflags = config.get(\"cflags\", [])\n        cflags_c = config.get(\"cflags_c\", [])\n        cflags_cxx = config.get(\"cflags_cc\", [])\n        if xcode_settings:\n            cflags = xcode_settings.GetCflags(config_to_use)\n            cflags_c = xcode_settings.GetCflagsC(config_to_use)\n            cflags_cxx = xcode_settings.GetCflagsCC(config_to_use)\n            # cflags_objc = xcode_settings.GetCflagsObjC(config_to_use)\n            # cflags_objcc = xcode_settings.GetCflagsObjCC(config_to_use)\n\n        if (not cflags_c or not c_sources) and (not cflags_cxx or not cxx_sources):\n            SetTargetProperty(output, cmake_target_name, \"COMPILE_FLAGS\", cflags, \" \")\n\n        elif c_sources and not (s_sources or cxx_sources):\n            flags = []\n            flags.extend(cflags)\n            flags.extend(cflags_c)\n            SetTargetProperty(output, cmake_target_name, \"COMPILE_FLAGS\", flags, \" \")\n\n        elif cxx_sources and not (s_sources or c_sources):\n            flags = []\n            flags.extend(cflags)\n            flags.extend(cflags_cxx)\n            SetTargetProperty(output, cmake_target_name, \"COMPILE_FLAGS\", flags, \" \")\n\n        else:\n            # TODO: This is broken, one cannot generally set properties on files,\n            # as other targets may require different properties on the same files.\n            if s_sources and cflags:\n                SetFilesProperty(output, s_sources_name, \"COMPILE_FLAGS\", cflags, \" \")\n\n            if c_sources and (cflags or cflags_c):\n                flags = []\n                flags.extend(cflags)\n                flags.extend(cflags_c)\n                SetFilesProperty(output, c_sources_name, \"COMPILE_FLAGS\", flags, \" \")\n\n            if cxx_sources and (cflags or cflags_cxx):\n                flags = []\n                flags.extend(cflags)\n                flags.extend(cflags_cxx)\n                SetFilesProperty(output, cxx_sources_name, \"COMPILE_FLAGS\", flags, \" \")\n\n        # Linker flags\n        ldflags = config.get(\"ldflags\")\n        if ldflags is not None:\n            SetTargetProperty(output, cmake_target_name, \"LINK_FLAGS\", ldflags, \" \")\n\n        # XCode settings\n        xcode_settings = config.get(\"xcode_settings\", {})\n        for xcode_setting, xcode_value in xcode_settings.items():\n            SetTargetProperty(\n                output,\n                cmake_target_name,\n                \"XCODE_ATTRIBUTE_%s\" % xcode_setting,\n                xcode_value,\n                \"\" if isinstance(xcode_value, str) else \" \",\n            )\n\n    # Note on Dependencies and Libraries:\n    # CMake wants to handle link order, resolving the link line up front.\n    # Gyp does not retain or enforce specifying enough information to do so.\n    # So do as other gyp generators and use --start-group and --end-group.\n    # Give CMake as little information as possible so that it doesn't mess it up.\n\n    # Dependencies\n    rawDeps = spec.get(\"dependencies\", [])\n\n    static_deps = []\n    shared_deps = []\n    other_deps = []\n    for rawDep in rawDeps:\n        dep_cmake_name = namer.CreateCMakeTargetName(rawDep)\n        dep_spec = target_dicts.get(rawDep, {})\n        dep_target_type = dep_spec.get(\"type\", None)\n\n        if dep_target_type == \"static_library\":\n            static_deps.append(dep_cmake_name)\n        elif dep_target_type == \"shared_library\":\n            shared_deps.append(dep_cmake_name)\n        else:\n            other_deps.append(dep_cmake_name)\n\n    # ensure all external dependencies are complete before internal dependencies\n    # extra_deps currently only depend on their own deps, so otherwise run early\n    if static_deps or shared_deps or other_deps:\n        for extra_dep in extra_deps:\n            output.write(\"add_dependencies(\")\n            output.write(extra_dep)\n            output.write(\"\\n\")\n            for deps in (static_deps, shared_deps, other_deps):\n                for dep in gyp.common.uniquer(deps):\n                    output.write(\"  \")\n                    output.write(dep)\n                    output.write(\"\\n\")\n            output.write(\")\\n\")\n\n    linkable = target_type in (\"executable\", \"loadable_module\", \"shared_library\")\n    other_deps.extend(extra_deps)\n    if other_deps or (not linkable and (static_deps or shared_deps)):\n        output.write(\"add_dependencies(\")\n        output.write(cmake_target_name)\n        output.write(\"\\n\")\n        for dep in gyp.common.uniquer(other_deps):\n            output.write(\"  \")\n            output.write(dep)\n            output.write(\"\\n\")\n        if not linkable:\n            for deps in (static_deps, shared_deps):\n                for lib_dep in gyp.common.uniquer(deps):\n                    output.write(\"  \")\n                    output.write(lib_dep)\n                    output.write(\"\\n\")\n        output.write(\")\\n\")\n\n    # Libraries\n    if linkable:\n        external_libs = [lib for lib in spec.get(\"libraries\", []) if len(lib) > 0]\n        if external_libs or static_deps or shared_deps:\n            output.write(\"target_link_libraries(\")\n            output.write(cmake_target_name)\n            output.write(\"\\n\")\n            if static_deps:\n                write_group = circular_libs and len(static_deps) > 1 and flavor != \"mac\"\n                if write_group:\n                    output.write(\"-Wl,--start-group\\n\")\n                for dep in gyp.common.uniquer(static_deps):\n                    output.write(\"  \")\n                    output.write(dep)\n                    output.write(\"\\n\")\n                if write_group:\n                    output.write(\"-Wl,--end-group\\n\")\n            if shared_deps:\n                for dep in gyp.common.uniquer(shared_deps):\n                    output.write(\"  \")\n                    output.write(dep)\n                    output.write(\"\\n\")\n            if external_libs:\n                for lib in gyp.common.uniquer(external_libs):\n                    output.write('  \"')\n                    output.write(RemovePrefix(lib, \"$(SDKROOT)\"))\n                    output.write('\"\\n')\n\n            output.write(\")\\n\")\n\n    UnsetVariable(output, \"TOOLSET\")\n    UnsetVariable(output, \"TARGET\")\n\n\ndef GenerateOutputForConfig(target_list, target_dicts, data, params, config_to_use):\n    options = params[\"options\"]\n    generator_flags = params[\"generator_flags\"]\n    flavor = gyp.common.GetFlavor(params)\n\n    # generator_dir: relative path from pwd to where make puts build files.\n    # Makes migrating from make to cmake easier, cmake doesn't put anything here.\n    # Each Gyp configuration creates a different CMakeLists.txt file\n    # to avoid incompatibilities between Gyp and CMake configurations.\n    generator_dir = os.path.relpath(options.generator_output or \".\")\n\n    # output_dir: relative path from generator_dir to the build directory.\n    output_dir = generator_flags.get(\"output_dir\", \"out\")\n\n    # build_dir: relative path from source root to our output files.\n    # e.g. \"out/Debug\"\n    build_dir = os.path.normpath(os.path.join(generator_dir, output_dir, config_to_use))\n\n    toplevel_build = os.path.join(options.toplevel_dir, build_dir)\n\n    output_file = os.path.join(toplevel_build, \"CMakeLists.txt\")\n    gyp.common.EnsureDirExists(output_file)\n\n    output = open(output_file, \"w\")\n    output.write(\"cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)\\n\")\n    output.write(\"cmake_policy(VERSION 2.8.8)\\n\")\n\n    gyp_file, project_target, _ = gyp.common.ParseQualifiedTarget(target_list[-1])\n    output.write(\"project(\")\n    output.write(project_target)\n    output.write(\")\\n\")\n\n    SetVariable(output, \"configuration\", config_to_use)\n\n    ar = None\n    cc = None\n    cxx = None\n\n    make_global_settings = data[gyp_file].get(\"make_global_settings\", [])\n    build_to_top = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir)\n    for key, value in make_global_settings:\n        if key == \"AR\":\n            ar = os.path.join(build_to_top, value)\n        if key == \"CC\":\n            cc = os.path.join(build_to_top, value)\n        if key == \"CXX\":\n            cxx = os.path.join(build_to_top, value)\n\n    ar = gyp.common.GetEnvironFallback([\"AR_target\", \"AR\"], ar)\n    cc = gyp.common.GetEnvironFallback([\"CC_target\", \"CC\"], cc)\n    cxx = gyp.common.GetEnvironFallback([\"CXX_target\", \"CXX\"], cxx)\n\n    if ar:\n        SetVariable(output, \"CMAKE_AR\", ar)\n    if cc:\n        SetVariable(output, \"CMAKE_C_COMPILER\", cc)\n    if cxx:\n        SetVariable(output, \"CMAKE_CXX_COMPILER\", cxx)\n\n    # The following appears to be as-yet undocumented.\n    # http://public.kitware.com/Bug/view.php?id=8392\n    output.write(\"enable_language(ASM)\\n\")\n    # ASM-ATT does not support .S files.\n    # output.write('enable_language(ASM-ATT)\\n')\n\n    if cc:\n        SetVariable(output, \"CMAKE_ASM_COMPILER\", cc)\n\n    SetVariable(output, \"builddir\", \"${CMAKE_CURRENT_BINARY_DIR}\")\n    SetVariable(output, \"obj\", \"${builddir}/obj\")\n    output.write(\"\\n\")\n\n    # TODO: Undocumented/unsupported (the CMake Java generator depends on it).\n    # CMake by default names the object resulting from foo.c to be foo.c.o.\n    # Gyp traditionally names the object resulting from foo.c foo.o.\n    # This should be irrelevant, but some targets extract .o files from .a\n    # and depend on the name of the extracted .o files.\n    output.write(\"set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)\\n\")\n    output.write(\"set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)\\n\")\n    output.write(\"\\n\")\n\n    # Force ninja to use rsp files. Otherwise link and ar lines can get too long,\n    # resulting in 'Argument list too long' errors.\n    # However, rsp files don't work correctly on Mac.\n    if flavor != \"mac\":\n        output.write(\"set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1)\\n\")\n    output.write(\"\\n\")\n\n    namer = CMakeNamer(target_list)\n\n    # The list of targets upon which the 'all' target should depend.\n    # CMake has it's own implicit 'all' target, one is not created explicitly.\n    all_qualified_targets = set()\n    for build_file in params[\"build_files\"]:\n        for qualified_target in gyp.common.AllTargets(\n            target_list, target_dicts, os.path.normpath(build_file)\n        ):\n            all_qualified_targets.add(qualified_target)\n\n    for qualified_target in target_list:\n        if flavor == \"mac\":\n            gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target)\n            spec = target_dicts[qualified_target]\n            gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[gyp_file], spec)\n\n        WriteTarget(\n            namer,\n            qualified_target,\n            target_dicts,\n            build_dir,\n            config_to_use,\n            options,\n            generator_flags,\n            all_qualified_targets,\n            flavor,\n            output,\n        )\n\n    output.close()\n\n\ndef PerformBuild(data, configurations, params):\n    options = params[\"options\"]\n    generator_flags = params[\"generator_flags\"]\n\n    # generator_dir: relative path from pwd to where make puts build files.\n    # Makes migrating from make to cmake easier, cmake doesn't put anything here.\n    generator_dir = os.path.relpath(options.generator_output or \".\")\n\n    # output_dir: relative path from generator_dir to the build directory.\n    output_dir = generator_flags.get(\"output_dir\", \"out\")\n\n    for config_name in configurations:\n        # build_dir: relative path from source root to our output files.\n        # e.g. \"out/Debug\"\n        build_dir = os.path.normpath(\n            os.path.join(generator_dir, output_dir, config_name)\n        )\n        arguments = [\"cmake\", \"-G\", \"Ninja\"]\n        print(f\"Generating [{config_name}]: {arguments}\")\n        subprocess.check_call(arguments, cwd=build_dir)\n\n        arguments = [\"ninja\", \"-C\", build_dir]\n        print(f\"Building [{config_name}]: {arguments}\")\n        subprocess.check_call(arguments)\n\n\ndef CallGenerateOutputForConfig(arglist):\n    # Ignore the interrupt signal so that the parent process catches it and\n    # kills all multiprocessing children.\n    signal.signal(signal.SIGINT, signal.SIG_IGN)\n\n    target_list, target_dicts, data, params, config_name = arglist\n    GenerateOutputForConfig(target_list, target_dicts, data, params, config_name)\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    if user_config := params.get(\"generator_flags\", {}).get(\"config\", None):\n        GenerateOutputForConfig(target_list, target_dicts, data, params, user_config)\n    else:\n        config_names = target_dicts[target_list[0]][\"configurations\"]\n        if params[\"parallel\"]:\n            try:\n                pool = multiprocessing.Pool(len(config_names))\n                arglists = []\n                for config_name in config_names:\n                    arglists.append(\n                        (target_list, target_dicts, data, params, config_name)\n                    )\n                    pool.map(CallGenerateOutputForConfig, arglists)\n            except KeyboardInterrupt as e:\n                pool.terminate()\n                raise e\n        else:\n            for config_name in config_names:\n                GenerateOutputForConfig(\n                    target_list, target_dicts, data, params, config_name\n                )\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/compile_commands_json.py",
    "content": "# Copyright (c) 2016 Ben Noordhuis <info@bnoordhuis.nl>. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\nimport json\nimport os\n\nimport gyp.common\nimport gyp.xcode_emulation\n\ngenerator_additional_non_configuration_keys = []\ngenerator_additional_path_sections = []\ngenerator_extra_sources_for_rules = []\ngenerator_filelist_paths = None\ngenerator_supports_multiple_toolsets = True\ngenerator_wants_sorted_dependencies = False\n\n# Lifted from make.py.  The actual values don't matter much.\ngenerator_default_variables = {\n    \"CONFIGURATION_NAME\": \"$(BUILDTYPE)\",\n    \"EXECUTABLE_PREFIX\": \"\",\n    \"EXECUTABLE_SUFFIX\": \"\",\n    \"INTERMEDIATE_DIR\": \"$(obj).$(TOOLSET)/$(TARGET)/geni\",\n    \"PRODUCT_DIR\": \"$(builddir)\",\n    \"RULE_INPUT_DIRNAME\": \"%(INPUT_DIRNAME)s\",\n    \"RULE_INPUT_EXT\": \"$(suffix $<)\",\n    \"RULE_INPUT_NAME\": \"$(notdir $<)\",\n    \"RULE_INPUT_PATH\": \"$(abspath $<)\",\n    \"RULE_INPUT_ROOT\": \"%(INPUT_ROOT)s\",\n    \"SHARED_INTERMEDIATE_DIR\": \"$(obj)/gen\",\n    \"SHARED_LIB_PREFIX\": \"lib\",\n    \"STATIC_LIB_PREFIX\": \"lib\",\n    \"STATIC_LIB_SUFFIX\": \".a\",\n}\n\n\ndef IsMac(params):\n    return gyp.common.GetFlavor(params) == \"mac\"\n\n\ndef CalculateVariables(default_variables, params):\n    default_variables.setdefault(\"OS\", gyp.common.GetFlavor(params))\n\n\ndef AddCommandsForTarget(cwd, target, params, per_config_commands):\n    output_dir = params[\"generator_flags\"].get(\"output_dir\", \"out\")\n    for configuration_name, configuration in target[\"configurations\"].items():\n        if IsMac(params):\n            xcode_settings = gyp.xcode_emulation.XcodeSettings(target)\n            cflags = xcode_settings.GetCflags(configuration_name)\n            cflags_c = xcode_settings.GetCflagsC(configuration_name)\n            cflags_cc = xcode_settings.GetCflagsCC(configuration_name)\n        else:\n            cflags = configuration.get(\"cflags\", [])\n            cflags_c = configuration.get(\"cflags_c\", [])\n            cflags_cc = configuration.get(\"cflags_cc\", [])\n\n        cflags_c = cflags + cflags_c\n        cflags_cc = cflags + cflags_cc\n\n        defines = configuration.get(\"defines\", [])\n        defines = [\"-D\" + s for s in defines]\n\n        # TODO(bnoordhuis) Handle generated source files.\n        extensions = (\".c\", \".cc\", \".cpp\", \".cxx\")\n        sources = [s for s in target.get(\"sources\", []) if s.endswith(extensions)]\n\n        def resolve(filename):\n            return os.path.abspath(os.path.join(cwd, filename))\n\n        # TODO(bnoordhuis) Handle generated header files.\n        include_dirs = configuration.get(\"include_dirs\", [])\n        include_dirs = [s for s in include_dirs if not s.startswith(\"$(obj)\")]\n        includes = [\"-I\" + resolve(s) for s in include_dirs]\n\n        defines = gyp.common.EncodePOSIXShellList(defines)\n        includes = gyp.common.EncodePOSIXShellList(includes)\n        cflags_c = gyp.common.EncodePOSIXShellList(cflags_c)\n        cflags_cc = gyp.common.EncodePOSIXShellList(cflags_cc)\n\n        commands = per_config_commands.setdefault(configuration_name, [])\n        for source in sources:\n            file = resolve(source)\n            isc = source.endswith(\".c\")\n            cc = \"cc\" if isc else \"c++\"\n            cflags = cflags_c if isc else cflags_cc\n            command = \" \".join(\n                (\n                    cc,\n                    defines,\n                    includes,\n                    cflags,\n                    \"-c\",\n                    gyp.common.EncodePOSIXShellArgument(file),\n                )\n            )\n            commands.append({\"command\": command, \"directory\": output_dir, \"file\": file})\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    per_config_commands = {}\n    for qualified_target, target in target_dicts.items():\n        build_file, _target_name, _toolset = gyp.common.ParseQualifiedTarget(\n            qualified_target\n        )\n        if IsMac(params):\n            settings = data[build_file]\n            gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(settings, target)\n        cwd = os.path.dirname(build_file)\n        AddCommandsForTarget(cwd, target, params, per_config_commands)\n\n    output_dir = None\n    try:\n        # generator_output can be `None` on Windows machines, or even not\n        # defined in other cases\n        output_dir = params.get(\"options\").generator_output\n    except AttributeError:\n        pass\n    output_dir = output_dir or params[\"generator_flags\"].get(\"output_dir\", \"out\")\n    for configuration_name, commands in per_config_commands.items():\n        filename = os.path.join(output_dir, configuration_name, \"compile_commands.json\")\n        gyp.common.EnsureDirExists(filename)\n        fp = open(filename, \"w\")\n        json.dump(commands, fp=fp, indent=0, check_circular=False)\n\n\ndef PerformBuild(data, configurations, params):\n    pass\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/dump_dependency_json.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\nimport json\nimport os\n\nimport gyp\nimport gyp.common\nimport gyp.msvs_emulation\n\ngenerator_supports_multiple_toolsets = True\n\ngenerator_wants_static_library_dependencies_adjusted = False\n\ngenerator_filelist_paths = {}\n\ngenerator_default_variables = {}\nfor dirname in [\n    \"INTERMEDIATE_DIR\",\n    \"SHARED_INTERMEDIATE_DIR\",\n    \"PRODUCT_DIR\",\n    \"LIB_DIR\",\n    \"SHARED_LIB_DIR\",\n]:\n    # Some gyp steps fail if these are empty(!).\n    generator_default_variables[dirname] = \"dir\"\nfor unused in [\n    \"RULE_INPUT_PATH\",\n    \"RULE_INPUT_ROOT\",\n    \"RULE_INPUT_NAME\",\n    \"RULE_INPUT_DIRNAME\",\n    \"RULE_INPUT_EXT\",\n    \"EXECUTABLE_PREFIX\",\n    \"EXECUTABLE_SUFFIX\",\n    \"STATIC_LIB_PREFIX\",\n    \"STATIC_LIB_SUFFIX\",\n    \"SHARED_LIB_PREFIX\",\n    \"SHARED_LIB_SUFFIX\",\n    \"CONFIGURATION_NAME\",\n]:\n    generator_default_variables[unused] = \"\"\n\n\ndef CalculateVariables(default_variables, params):\n    generator_flags = params.get(\"generator_flags\", {})\n    for key, val in generator_flags.items():\n        default_variables.setdefault(key, val)\n    default_variables.setdefault(\"OS\", gyp.common.GetFlavor(params))\n\n    flavor = gyp.common.GetFlavor(params)\n    if flavor == \"win\":\n        gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)\n\n\ndef CalculateGeneratorInputInfo(params):\n    \"\"\"Calculate the generator specific info that gets fed to input (called by\n    gyp).\"\"\"\n    generator_flags = params.get(\"generator_flags\", {})\n    if generator_flags.get(\"adjust_static_libraries\", False):\n        global generator_wants_static_library_dependencies_adjusted\n        generator_wants_static_library_dependencies_adjusted = True\n\n    toplevel = params[\"options\"].toplevel_dir\n    generator_dir = os.path.relpath(params[\"options\"].generator_output or \".\")\n    # output_dir: relative path from generator_dir to the build directory.\n    output_dir = generator_flags.get(\"output_dir\", \"out\")\n    qualified_out_dir = os.path.normpath(\n        os.path.join(toplevel, generator_dir, output_dir, \"gypfiles\")\n    )\n    global generator_filelist_paths\n    generator_filelist_paths = {\n        \"toplevel\": toplevel,\n        \"qualified_out_dir\": qualified_out_dir,\n    }\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    # Map of target -> list of targets it depends on.\n    edges = {}\n\n    # Queue of targets to visit.\n    targets_to_visit = target_list[:]\n\n    while len(targets_to_visit) > 0:\n        target = targets_to_visit.pop()\n        if target in edges:\n            continue\n        edges[target] = []\n\n        for dep in target_dicts[target].get(\"dependencies\", []):\n            edges[target].append(dep)\n            targets_to_visit.append(dep)\n\n    try:\n        filepath = params[\"generator_flags\"][\"output_dir\"]\n    except KeyError:\n        filepath = \".\"\n    filename = os.path.join(filepath, \"dump.json\")\n    f = open(filename, \"w\")\n    json.dump(edges, f)\n    f.close()\n    print(\"Wrote json to %s.\" % filename)\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/eclipse.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"GYP backend that generates Eclipse CDT settings files.\n\nThis backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML\nfiles that can be imported into an Eclipse CDT project. The XML file contains a\nlist of include paths and symbols (i.e. defines).\n\nBecause a full .cproject definition is not created by this generator, it's not\npossible to properly define the include dirs and symbols for each file\nindividually.  Instead, one set of includes/symbols is generated for the entire\nproject.  This works fairly well (and is a vast improvement in general), but may\nstill result in a few indexer issues here and there.\n\nThis generator has no automated tests, so expect it to be broken.\n\"\"\"\n\nimport os.path\nimport shlex\nimport subprocess\nimport xml.etree.ElementTree as ET\nfrom xml.sax.saxutils import escape\n\nimport gyp\nimport gyp.common\nimport gyp.msvs_emulation\n\ngenerator_wants_static_library_dependencies_adjusted = False\n\ngenerator_default_variables = {}\n\nfor dirname in [\"INTERMEDIATE_DIR\", \"PRODUCT_DIR\", \"LIB_DIR\", \"SHARED_LIB_DIR\"]:\n    # Some gyp steps fail if these are empty(!), so we convert them to variables\n    generator_default_variables[dirname] = \"$\" + dirname\n\nfor unused in [\n    \"RULE_INPUT_PATH\",\n    \"RULE_INPUT_ROOT\",\n    \"RULE_INPUT_NAME\",\n    \"RULE_INPUT_DIRNAME\",\n    \"RULE_INPUT_EXT\",\n    \"EXECUTABLE_PREFIX\",\n    \"EXECUTABLE_SUFFIX\",\n    \"STATIC_LIB_PREFIX\",\n    \"STATIC_LIB_SUFFIX\",\n    \"SHARED_LIB_PREFIX\",\n    \"SHARED_LIB_SUFFIX\",\n    \"CONFIGURATION_NAME\",\n]:\n    generator_default_variables[unused] = \"\"\n\n# Include dirs will occasionally use the SHARED_INTERMEDIATE_DIR variable as\n# part of the path when dealing with generated headers.  This value will be\n# replaced dynamically for each configuration.\ngenerator_default_variables[\"SHARED_INTERMEDIATE_DIR\"] = \"$SHARED_INTERMEDIATE_DIR\"\n\n\ndef CalculateVariables(default_variables, params):\n    generator_flags = params.get(\"generator_flags\", {})\n    for key, val in generator_flags.items():\n        default_variables.setdefault(key, val)\n    flavor = gyp.common.GetFlavor(params)\n    default_variables.setdefault(\"OS\", flavor)\n    if flavor == \"win\":\n        gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)\n\n\ndef CalculateGeneratorInputInfo(params):\n    \"\"\"Calculate the generator specific info that gets fed to input (called by\n    gyp).\"\"\"\n    generator_flags = params.get(\"generator_flags\", {})\n    if generator_flags.get(\"adjust_static_libraries\", False):\n        global generator_wants_static_library_dependencies_adjusted\n        generator_wants_static_library_dependencies_adjusted = True\n\n\ndef GetAllIncludeDirectories(\n    target_list,\n    target_dicts,\n    shared_intermediate_dirs,\n    config_name,\n    params,\n    compiler_path,\n):\n    \"\"\"Calculate the set of include directories to be used.\n\n    Returns:\n      A list including all the include_dir's specified for every target followed\n      by any include directories that were added as cflag compiler options.\n    \"\"\"\n\n    gyp_includes_set = set()\n    compiler_includes_list = []\n\n    # Find compiler's default include dirs.\n    if compiler_path:\n        command = shlex.split(compiler_path)\n        command.extend([\"-E\", \"-xc++\", \"-v\", \"-\"])\n        proc = subprocess.Popen(\n            args=command,\n            stdin=subprocess.PIPE,\n            stdout=subprocess.PIPE,\n            stderr=subprocess.PIPE,\n        )\n        output = proc.communicate()[1].decode(\"utf-8\")\n        # Extract the list of include dirs from the output, which has this format:\n        #   ...\n        #   #include \"...\" search starts here:\n        #   #include <...> search starts here:\n        #    /usr/include/c++/4.6\n        #    /usr/local/include\n        #   End of search list.\n        #   ...\n        in_include_list = False\n        for line in output.splitlines():\n            if line.startswith(\"#include\"):\n                in_include_list = True\n                continue\n            if line.startswith(\"End of search list.\"):\n                break\n            if in_include_list:\n                include_dir = line.strip()\n                if include_dir not in compiler_includes_list:\n                    compiler_includes_list.append(include_dir)\n\n    flavor = gyp.common.GetFlavor(params)\n    if flavor == \"win\":\n        generator_flags = params.get(\"generator_flags\", {})\n    for target_name in target_list:\n        target = target_dicts[target_name]\n        if config_name in target[\"configurations\"]:\n            config = target[\"configurations\"][config_name]\n\n            # Look for any include dirs that were explicitly added via cflags. This\n            # may be done in gyp files to force certain includes to come at the end.\n            # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and\n            # remove this.\n            if flavor == \"win\":\n                msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags)\n                cflags = msvs_settings.GetCflags(config_name)\n            else:\n                cflags = config[\"cflags\"]\n            for cflag in cflags:\n                if cflag.startswith(\"-I\"):\n                    include_dir = cflag[2:]\n                    if include_dir not in compiler_includes_list:\n                        compiler_includes_list.append(include_dir)\n\n            # Find standard gyp include dirs.\n            if \"include_dirs\" in config:\n                include_dirs = config[\"include_dirs\"]\n                for shared_intermediate_dir in shared_intermediate_dirs:\n                    for include_dir in include_dirs:\n                        include_dir = include_dir.replace(\n                            \"$SHARED_INTERMEDIATE_DIR\", shared_intermediate_dir\n                        )\n                        if not os.path.isabs(include_dir):\n                            base_dir = os.path.dirname(target_name)\n\n                            include_dir = base_dir + \"/\" + include_dir\n                            include_dir = os.path.abspath(include_dir)\n\n                        gyp_includes_set.add(include_dir)\n\n    # Generate a list that has all the include dirs.\n    all_includes_list = list(gyp_includes_set)\n    all_includes_list.sort()\n    for compiler_include in compiler_includes_list:\n        if compiler_include not in gyp_includes_set:\n            all_includes_list.append(compiler_include)\n\n    # All done.\n    return all_includes_list\n\n\ndef GetCompilerPath(target_list, data, options):\n    \"\"\"Determine a command that can be used to invoke the compiler.\n\n    Returns:\n      If this is a gyp project that has explicit make settings, try to determine\n      the compiler from that.  Otherwise, see if a compiler was specified via the\n      CC_target environment variable.\n    \"\"\"\n    # First, see if the compiler is configured in make's settings.\n    build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])\n    make_global_settings_dict = data[build_file].get(\"make_global_settings\", {})\n    for key, value in make_global_settings_dict:\n        if key in [\"CC\", \"CXX\"]:\n            return os.path.join(options.toplevel_dir, value)\n\n    # Check to see if the compiler was specified as an environment variable.\n    for key in [\"CC_target\", \"CC\", \"CXX\"]:\n        compiler = os.environ.get(key)\n        if compiler:\n            return compiler\n\n    return \"gcc\"\n\n\ndef GetAllDefines(target_list, target_dicts, data, config_name, params, compiler_path):\n    \"\"\"Calculate the defines for a project.\n\n    Returns:\n      A dict that includes explicit defines declared in gyp files along with all\n      of the default defines that the compiler uses.\n    \"\"\"\n\n    # Get defines declared in the gyp files.\n    all_defines = {}\n    flavor = gyp.common.GetFlavor(params)\n    if flavor == \"win\":\n        generator_flags = params.get(\"generator_flags\", {})\n    for target_name in target_list:\n        target = target_dicts[target_name]\n\n        if flavor == \"win\":\n            msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags)\n            extra_defines = msvs_settings.GetComputedDefines(config_name)\n        else:\n            extra_defines = []\n        if config_name in target[\"configurations\"]:\n            config = target[\"configurations\"][config_name]\n            target_defines = config[\"defines\"]\n        else:\n            target_defines = []\n        for define in target_defines + extra_defines:\n            split_define = define.split(\"=\", 1)\n            if len(split_define) == 1:\n                split_define.append(\"1\")\n            if split_define[0].strip() in all_defines:\n                # Already defined\n                continue\n            all_defines[split_define[0].strip()] = split_define[1].strip()\n    # Get default compiler defines (if possible).\n    if flavor == \"win\":\n        return all_defines  # Default defines already processed in the loop above.\n    if compiler_path:\n        command = shlex.split(compiler_path)\n        command.extend([\"-E\", \"-dM\", \"-\"])\n        cpp_proc = subprocess.Popen(\n            args=command, cwd=\".\", stdin=subprocess.PIPE, stdout=subprocess.PIPE\n        )\n        cpp_output = cpp_proc.communicate()[0].decode(\"utf-8\")\n        cpp_lines = cpp_output.split(\"\\n\")\n        for cpp_line in cpp_lines:\n            if not cpp_line.strip():\n                continue\n            cpp_line_parts = cpp_line.split(\" \", 2)\n            key = cpp_line_parts[1]\n            val = cpp_line_parts[2] if len(cpp_line_parts) >= 3 else \"1\"\n            all_defines[key] = val\n\n    return all_defines\n\n\ndef WriteIncludePaths(out, eclipse_langs, include_dirs):\n    \"\"\"Write the includes section of a CDT settings export file.\"\"\"\n\n    out.write(\n        '  <section name=\"org.eclipse.cdt.internal.ui.wizards.'\n        'settingswizards.IncludePaths\">\\n'\n    )\n    out.write('    <language name=\"holder for library settings\"></language>\\n')\n    for lang in eclipse_langs:\n        out.write('    <language name=\"%s\">\\n' % lang)\n        for include_dir in include_dirs:\n            out.write(\n                '      <includepath workspace_path=\"false\">%s</includepath>\\n'\n                % include_dir\n            )\n        out.write(\"    </language>\\n\")\n    out.write(\"  </section>\\n\")\n\n\ndef WriteMacros(out, eclipse_langs, defines):\n    \"\"\"Write the macros section of a CDT settings export file.\"\"\"\n\n    out.write(\n        '  <section name=\"org.eclipse.cdt.internal.ui.wizards.'\n        'settingswizards.Macros\">\\n'\n    )\n    out.write('    <language name=\"holder for library settings\"></language>\\n')\n    for lang in eclipse_langs:\n        out.write('    <language name=\"%s\">\\n' % lang)\n        for key in sorted(defines):\n            out.write(\n                \"      <macro><name>%s</name><value>%s</value></macro>\\n\"\n                % (escape(key), escape(defines[key]))\n            )\n        out.write(\"    </language>\\n\")\n    out.write(\"  </section>\\n\")\n\n\ndef GenerateOutputForConfig(target_list, target_dicts, data, params, config_name):\n    options = params[\"options\"]\n    generator_flags = params.get(\"generator_flags\", {})\n\n    # build_dir: relative path from source root to our output files.\n    # e.g. \"out/Debug\"\n    build_dir = os.path.join(generator_flags.get(\"output_dir\", \"out\"), config_name)\n\n    toplevel_build = os.path.join(options.toplevel_dir, build_dir)\n    # Ninja uses out/Debug/gen while make uses out/Debug/obj/gen as the\n    # SHARED_INTERMEDIATE_DIR. Include both possible locations.\n    shared_intermediate_dirs = [\n        os.path.join(toplevel_build, \"obj\", \"gen\"),\n        os.path.join(toplevel_build, \"gen\"),\n    ]\n\n    GenerateCdtSettingsFile(\n        target_list,\n        target_dicts,\n        data,\n        params,\n        config_name,\n        os.path.join(toplevel_build, \"eclipse-cdt-settings.xml\"),\n        options,\n        shared_intermediate_dirs,\n    )\n    GenerateClasspathFile(\n        target_list,\n        target_dicts,\n        options.toplevel_dir,\n        toplevel_build,\n        os.path.join(toplevel_build, \"eclipse-classpath.xml\"),\n    )\n\n\ndef GenerateCdtSettingsFile(\n    target_list,\n    target_dicts,\n    data,\n    params,\n    config_name,\n    out_name,\n    options,\n    shared_intermediate_dirs,\n):\n    gyp.common.EnsureDirExists(out_name)\n    with open(out_name, \"w\") as out:\n        out.write('<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n')\n        out.write(\"<cdtprojectproperties>\\n\")\n\n        eclipse_langs = [\n            \"C++ Source File\",\n            \"C Source File\",\n            \"Assembly Source File\",\n            \"GNU C++\",\n            \"GNU C\",\n            \"Assembly\",\n        ]\n        compiler_path = GetCompilerPath(target_list, data, options)\n        include_dirs = GetAllIncludeDirectories(\n            target_list,\n            target_dicts,\n            shared_intermediate_dirs,\n            config_name,\n            params,\n            compiler_path,\n        )\n        WriteIncludePaths(out, eclipse_langs, include_dirs)\n        defines = GetAllDefines(\n            target_list, target_dicts, data, config_name, params, compiler_path\n        )\n        WriteMacros(out, eclipse_langs, defines)\n\n        out.write(\"</cdtprojectproperties>\\n\")\n\n\ndef GenerateClasspathFile(\n    target_list, target_dicts, toplevel_dir, toplevel_build, out_name\n):\n    \"\"\"Generates a classpath file suitable for symbol navigation and code\n    completion of Java code (such as in Android projects) by finding all\n    .java and .jar files used as action inputs.\"\"\"\n    gyp.common.EnsureDirExists(out_name)\n    result = ET.Element(\"classpath\")\n\n    def AddElements(kind, paths):\n        # First, we need to normalize the paths so they are all relative to the\n        # toplevel dir.\n        rel_paths = set()\n        for path in paths:\n            if os.path.isabs(path):\n                rel_paths.add(os.path.relpath(path, toplevel_dir))\n            else:\n                rel_paths.add(path)\n\n        for path in sorted(rel_paths):\n            entry_element = ET.SubElement(result, \"classpathentry\")\n            entry_element.set(\"kind\", kind)\n            entry_element.set(\"path\", path)\n\n    AddElements(\"lib\", GetJavaJars(target_list, target_dicts, toplevel_dir))\n    AddElements(\"src\", GetJavaSourceDirs(target_list, target_dicts, toplevel_dir))\n    # Include the standard JRE container and a dummy out folder\n    AddElements(\"con\", [\"org.eclipse.jdt.launching.JRE_CONTAINER\"])\n    # Include a dummy out folder so that Eclipse doesn't use the default /bin\n    # folder in the root of the project.\n    AddElements(\"output\", [os.path.join(toplevel_build, \".eclipse-java-build\")])\n\n    ET.ElementTree(result).write(out_name)\n\n\ndef GetJavaJars(target_list, target_dicts, toplevel_dir):\n    \"\"\"Generates a sequence of all .jars used as inputs.\"\"\"\n    for target_name in target_list:\n        target = target_dicts[target_name]\n        for action in target.get(\"actions\", []):\n            for input_ in action[\"inputs\"]:\n                if os.path.splitext(input_)[1] == \".jar\" and not input_.startswith(\"$\"):\n                    if os.path.isabs(input_):\n                        yield input_\n                    else:\n                        yield os.path.join(os.path.dirname(target_name), input_)\n\n\ndef GetJavaSourceDirs(target_list, target_dicts, toplevel_dir):\n    \"\"\"Generates a sequence of all likely java package root directories.\"\"\"\n    for target_name in target_list:\n        target = target_dicts[target_name]\n        for action in target.get(\"actions\", []):\n            for input_ in action[\"inputs\"]:\n                if os.path.splitext(input_)[1] == \".java\" and not input_.startswith(\n                    \"$\"\n                ):\n                    dir_ = os.path.dirname(\n                        os.path.join(os.path.dirname(target_name), input_)\n                    )\n                    # If there is a parent 'src' or 'java' folder, navigate up to it -\n                    # these are canonical package root names in Chromium.  This will\n                    # break if 'src' or 'java' exists in the package structure. This\n                    # could be further improved by inspecting the java file for the\n                    # package name if this proves to be too fragile in practice.\n                    parent_search = dir_\n                    while os.path.basename(parent_search) not in [\"src\", \"java\"]:\n                        parent_search, _ = os.path.split(parent_search)\n                        if not parent_search or parent_search == toplevel_dir:\n                            # Didn't find a known root, just return the original path\n                            yield dir_\n                            break\n                    else:\n                        yield parent_search\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    \"\"\"Generate an XML settings file that can be imported into a CDT project.\"\"\"\n\n    if params[\"options\"].generator_output:\n        raise NotImplementedError(\"--generator_output not implemented for eclipse\")\n\n    if user_config := params.get(\"generator_flags\", {}).get(\"config\", None):\n        GenerateOutputForConfig(target_list, target_dicts, data, params, user_config)\n    else:\n        config_names = target_dicts[target_list[0]][\"configurations\"]\n        for config_name in config_names:\n            GenerateOutputForConfig(\n                target_list, target_dicts, data, params, config_name\n            )\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/gypd.py",
    "content": "# Copyright (c) 2011 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"gypd output module\n\nThis module produces gyp input as its output.  Output files are given the\n.gypd extension to avoid overwriting the .gyp files that they are generated\nfrom.  Internal references to .gyp files (such as those found in\n\"dependencies\" sections) are not adjusted to point to .gypd files instead;\nunlike other paths, which are relative to the .gyp or .gypd file, such paths\nare relative to the directory from which gyp was run to create the .gypd file.\n\nThis generator module is intended to be a sample and a debugging aid, hence\nthe \"d\" for \"debug\" in .gypd.  It is useful to inspect the results of the\nvarious merges, expansions, and conditional evaluations performed by gyp\nand to see a representation of what would be fed to a generator module.\n\nIt's not advisable to rename .gypd files produced by this module to .gyp,\nbecause they will have all merges, expansions, and evaluations already\nperformed and the relevant constructs not present in the output; paths to\ndependencies may be wrong; and various sections that do not belong in .gyp\nfiles such as such as \"included_files\" and \"*_excluded\" will be present.\nOutput will also be stripped of comments.  This is not intended to be a\ngeneral-purpose gyp pretty-printer; for that, you probably just want to\nrun \"pprint.pprint(eval(open('source.gyp').read()))\", which will still strip\ncomments but won't do all of the other things done to this module's output.\n\nThe specific formatting of the output generated by this module is subject\nto change.\n\"\"\"\n\nimport pprint\n\nimport gyp.common\n\n# These variables should just be spit back out as variable references.\n_generator_identity_variables = [\n    \"CONFIGURATION_NAME\",\n    \"EXECUTABLE_PREFIX\",\n    \"EXECUTABLE_SUFFIX\",\n    \"INTERMEDIATE_DIR\",\n    \"LIB_DIR\",\n    \"PRODUCT_DIR\",\n    \"RULE_INPUT_ROOT\",\n    \"RULE_INPUT_DIRNAME\",\n    \"RULE_INPUT_EXT\",\n    \"RULE_INPUT_NAME\",\n    \"RULE_INPUT_PATH\",\n    \"SHARED_INTERMEDIATE_DIR\",\n    \"SHARED_LIB_DIR\",\n    \"SHARED_LIB_PREFIX\",\n    \"SHARED_LIB_SUFFIX\",\n    \"STATIC_LIB_PREFIX\",\n    \"STATIC_LIB_SUFFIX\",\n]\n\n# gypd doesn't define a default value for OS like many other generator\n# modules.  Specify \"-D OS=whatever\" on the command line to provide a value.\ngenerator_default_variables = {}\n\n# gypd supports multiple toolsets\ngenerator_supports_multiple_toolsets = True\n\n# TODO(mark): This always uses <, which isn't right.  The input module should\n# notify the generator to tell it which phase it is operating in, and this\n# module should use < for the early phase and then switch to > for the late\n# phase.  Bonus points for carrying @ back into the output too.\nfor v in _generator_identity_variables:\n    generator_default_variables[v] = \"<(%s)\" % v\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    output_files = {}\n    for qualified_target in target_list:\n        [input_file, _target] = gyp.common.ParseQualifiedTarget(qualified_target)[0:2]\n\n        if input_file[-4:] != \".gyp\":\n            continue\n        input_file_stem = input_file[:-4]\n        output_file = input_file_stem + params[\"options\"].suffix + \".gypd\"\n\n        output_files[output_file] = output_files.get(output_file, input_file)\n\n    for output_file, input_file in output_files.items():\n        output = open(output_file, \"w\")\n        pprint.pprint(data[input_file], output)\n        output.close()\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/gypsh.py",
    "content": "# Copyright (c) 2011 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"gypsh output module\n\ngypsh is a GYP shell.  It's not really a generator per se.  All it does is\nfire up an interactive Python session with a few local variables set to the\nvariables passed to the generator.  Like gypd, it's intended as a debugging\naid, to facilitate the exploration of .gyp structures after being processed\nby the input module.\n\nThe expected usage is \"gyp -f gypsh -D OS=desired_os\".\n\"\"\"\n\nimport code\nimport sys\n\n# All of this stuff about generator variables was lovingly ripped from gypd.py.\n# That module has a much better description of what's going on and why.\n_generator_identity_variables = [\n    \"EXECUTABLE_PREFIX\",\n    \"EXECUTABLE_SUFFIX\",\n    \"INTERMEDIATE_DIR\",\n    \"PRODUCT_DIR\",\n    \"RULE_INPUT_ROOT\",\n    \"RULE_INPUT_DIRNAME\",\n    \"RULE_INPUT_EXT\",\n    \"RULE_INPUT_NAME\",\n    \"RULE_INPUT_PATH\",\n    \"SHARED_INTERMEDIATE_DIR\",\n]\n\ngenerator_default_variables = {}\n\nfor v in _generator_identity_variables:\n    generator_default_variables[v] = \"<(%s)\" % v\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    locals = {\n        \"target_list\": target_list,\n        \"target_dicts\": target_dicts,\n        \"data\": data,\n    }\n\n    # Use a banner that looks like the stock Python one and like what\n    # code.interact uses by default, but tack on something to indicate what\n    # locals are available, and identify gypsh.\n    banner = (\n        f\"Python {sys.version} on {sys.platform}\\nlocals.keys() = \"\n        f\"{sorted(locals.keys())!r}\\ngypsh\"\n    )\n\n    code.interact(banner, local=locals)\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/make.py",
    "content": "# Copyright (c) 2013 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n# Notes:\n#\n# This is all roughly based on the Makefile system used by the Linux\n# kernel, but is a non-recursive make -- we put the entire dependency\n# graph in front of make and let it figure it out.\n#\n# The code below generates a separate .mk file for each target, but\n# all are sourced by the top-level Makefile.  This means that all\n# variables in .mk-files clobber one another.  Be careful to use :=\n# where appropriate for immediate evaluation, and similarly to watch\n# that you're not relying on a variable value to last between different\n# .mk files.\n#\n# TODOs:\n#\n# Global settings and utility functions are currently stuffed in the\n# toplevel Makefile.  It may make sense to generate some .mk files on\n# the side to keep the files readable.\n\n\nimport hashlib\nimport os\nimport re\nimport subprocess\nimport sys\n\nimport gyp\nimport gyp.common\nimport gyp.xcode_emulation\nfrom gyp.common import GetEnvironFallback\n\ngenerator_default_variables = {\n    \"EXECUTABLE_PREFIX\": \"\",\n    \"EXECUTABLE_SUFFIX\": \"\",\n    \"STATIC_LIB_PREFIX\": \"lib\",\n    \"SHARED_LIB_PREFIX\": \"lib\",\n    \"STATIC_LIB_SUFFIX\": \".a\",\n    \"INTERMEDIATE_DIR\": \"$(obj).$(TOOLSET)/$(TARGET)/geni\",\n    \"SHARED_INTERMEDIATE_DIR\": \"$(obj)/gen\",\n    \"PRODUCT_DIR\": \"$(builddir)\",\n    \"RULE_INPUT_ROOT\": \"%(INPUT_ROOT)s\",  # This gets expanded by Python.\n    \"RULE_INPUT_DIRNAME\": \"%(INPUT_DIRNAME)s\",  # This gets expanded by Python.\n    \"RULE_INPUT_PATH\": \"$(abspath $<)\",\n    \"RULE_INPUT_EXT\": \"$(suffix $<)\",\n    \"RULE_INPUT_NAME\": \"$(notdir $<)\",\n    \"CONFIGURATION_NAME\": \"$(BUILDTYPE)\",\n}\n\n# Make supports multiple toolsets\ngenerator_supports_multiple_toolsets = gyp.common.CrossCompileRequested()\n\n# Request sorted dependencies in the order from dependents to dependencies.\ngenerator_wants_sorted_dependencies = False\n\n# Placates pylint.\ngenerator_additional_non_configuration_keys = []\ngenerator_additional_path_sections = []\ngenerator_extra_sources_for_rules = []\ngenerator_filelist_paths = None\n\n\ndef CalculateVariables(default_variables, params):\n    \"\"\"Calculate additional variables for use in the build (called by gyp).\"\"\"\n    flavor = gyp.common.GetFlavor(params)\n    if flavor == \"mac\":\n        default_variables.setdefault(\"OS\", \"mac\")\n        default_variables.setdefault(\"SHARED_LIB_SUFFIX\", \".dylib\")\n        default_variables.setdefault(\n            \"SHARED_LIB_DIR\", generator_default_variables[\"PRODUCT_DIR\"]\n        )\n        default_variables.setdefault(\n            \"LIB_DIR\", generator_default_variables[\"PRODUCT_DIR\"]\n        )\n\n        # Copy additional generator configuration data from Xcode, which is shared\n        # by the Mac Make generator.\n        import gyp.generator.xcode as xcode_generator  # noqa: PLC0415\n\n        global generator_additional_non_configuration_keys\n        generator_additional_non_configuration_keys = getattr(\n            xcode_generator, \"generator_additional_non_configuration_keys\", []\n        )\n        global generator_additional_path_sections\n        generator_additional_path_sections = getattr(\n            xcode_generator, \"generator_additional_path_sections\", []\n        )\n        global generator_extra_sources_for_rules\n        generator_extra_sources_for_rules = getattr(\n            xcode_generator, \"generator_extra_sources_for_rules\", []\n        )\n        COMPILABLE_EXTENSIONS.update({\".m\": \"objc\", \".mm\": \"objcxx\"})\n    else:\n        operating_system = flavor\n        if flavor == \"android\":\n            operating_system = \"linux\"  # Keep this legacy behavior for now.\n        default_variables.setdefault(\"OS\", operating_system)\n        if flavor == \"aix\":\n            default_variables.setdefault(\"SHARED_LIB_SUFFIX\", \".a\")\n        elif flavor == \"zos\":\n            default_variables.setdefault(\"SHARED_LIB_SUFFIX\", \".x\")\n            COMPILABLE_EXTENSIONS.update({\".pli\": \"pli\"})\n        else:\n            default_variables.setdefault(\"SHARED_LIB_SUFFIX\", \".so\")\n        default_variables.setdefault(\"SHARED_LIB_DIR\", \"$(builddir)/lib.$(TOOLSET)\")\n        default_variables.setdefault(\"LIB_DIR\", \"$(obj).$(TOOLSET)\")\n\n\ndef CalculateGeneratorInputInfo(params):\n    \"\"\"Calculate the generator specific info that gets fed to input (called by\n    gyp).\"\"\"\n    generator_flags = params.get(\"generator_flags\", {})\n    android_ndk_version = generator_flags.get(\"android_ndk_version\", None)\n    # Android NDK requires a strict link order.\n    if android_ndk_version:\n        global generator_wants_sorted_dependencies\n        generator_wants_sorted_dependencies = True\n\n    output_dir = params[\"options\"].generator_output or params[\"options\"].toplevel_dir\n    builddir_name = generator_flags.get(\"output_dir\", \"out\")\n    qualified_out_dir = os.path.normpath(\n        os.path.join(output_dir, builddir_name, \"gypfiles\")\n    )\n\n    global generator_filelist_paths\n    generator_filelist_paths = {\n        \"toplevel\": params[\"options\"].toplevel_dir,\n        \"qualified_out_dir\": qualified_out_dir,\n    }\n\n\n# The .d checking code below uses these functions:\n# wildcard, sort, foreach, shell, wordlist\n# wildcard can handle spaces, the rest can't.\n# Since I could find no way to make foreach work with spaces in filenames\n# correctly, the .d files have spaces replaced with another character. The .d\n# file for\n#     Chromium\\ Framework.framework/foo\n# is for example\n#     out/Release/.deps/out/Release/Chromium?Framework.framework/foo\n# This is the replacement character.\nSPACE_REPLACEMENT = \"?\"\n\n\nLINK_COMMANDS_LINUX = \"\"\"\\\nquiet_cmd_alink = AR($(TOOLSET)) $@\ncmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)\n\nquiet_cmd_alink_thin = AR($(TOOLSET)) $@\ncmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)\n\n# Due to circular dependencies between libraries :(, we wrap the\n# special \"figure out circular dependencies\" flags around the entire\n# input list during linking.\nquiet_cmd_link = LINK($(TOOLSET)) $@\ncmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group\n\n# Note: this does not handle spaces in paths\ndefine xargs\n  $(1) $(word 1,$(2))\n$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2))))\nendef\n\ndefine write-to-file\n  @: >$(1)\n$(call xargs,@printf \"%s\\\\n\" >>$(1),$(2))\nendef\n\nOBJ_FILE_LIST := ar-file-list\n\ndefine create_archive\n        rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`\n        $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))\n        $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)\nendef\n\ndefine create_thin_archive\n        rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`\n        $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))\n        $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)\nendef\n\n# We support two kinds of shared objects (.so):\n# 1) shared_library, which is just bundling together many dependent libraries\n# into a link line.\n# 2) loadable_module, which is generating a module intended for dlopen().\n#\n# They differ only slightly:\n# In the former case, we want to package all dependent code into the .so.\n# In the latter case, we want to package just the API exposed by the\n# outermost module.\n# This means shared_library uses --whole-archive, while loadable_module doesn't.\n# (Note that --whole-archive is incompatible with the --start-group used in\n# normal linking.)\n\n# Other shared-object link notes:\n# - Set SONAME to the library filename so our binaries don't reference\n# the local, absolute paths used on the link command-line.\nquiet_cmd_solink = SOLINK($(TOOLSET)) $@\ncmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)\n\nquiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@\ncmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)\n\"\"\"  # noqa: E501\n\nLINK_COMMANDS_MAC = \"\"\"\\\nquiet_cmd_alink = LIBTOOL-STATIC $@\ncmd_alink = rm -f $@ && %(python)s gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %%.o,$^)\n\nquiet_cmd_link = LINK($(TOOLSET)) $@\ncmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o \"$@\" $(LD_INPUTS) $(LIBS)\n\nquiet_cmd_solink = SOLINK($(TOOLSET)) $@\ncmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o \"$@\" $(LD_INPUTS) $(LIBS)\n\nquiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@\ncmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)\n\"\"\" % {\"python\": sys.executable}  # noqa: E501\n\nLINK_COMMANDS_ANDROID = \"\"\"\\\nquiet_cmd_alink = AR($(TOOLSET)) $@\ncmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)\n\nquiet_cmd_alink_thin = AR($(TOOLSET)) $@\ncmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)\n\n# Note: this does not handle spaces in paths\ndefine xargs\n  $(1) $(word 1,$(2))\n$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2))))\nendef\n\ndefine write-to-file\n  @: >$(1)\n$(call xargs,@printf \"%s\\\\n\" >>$(1),$(2))\nendef\n\nOBJ_FILE_LIST := ar-file-list\n\ndefine create_archive\n        rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`\n        $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))\n        $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)\nendef\n\ndefine create_thin_archive\n        rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`\n        $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))\n        $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)\nendef\n\n# Due to circular dependencies between libraries :(, we wrap the\n# special \"figure out circular dependencies\" flags around the entire\n# input list during linking.\nquiet_cmd_link = LINK($(TOOLSET)) $@\nquiet_cmd_link_host = LINK($(TOOLSET)) $@\ncmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)\ncmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)\n\n# Other shared-object link notes:\n# - Set SONAME to the library filename so our binaries don't reference\n# the local, absolute paths used on the link command-line.\nquiet_cmd_solink = SOLINK($(TOOLSET)) $@\ncmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)\n\nquiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@\ncmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)\nquiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@\ncmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)\n\"\"\"  # noqa: E501\n\n\nLINK_COMMANDS_AIX = \"\"\"\\\nquiet_cmd_alink = AR($(TOOLSET)) $@\ncmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^)\n\nquiet_cmd_alink_thin = AR($(TOOLSET)) $@\ncmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^)\n\nquiet_cmd_link = LINK($(TOOLSET)) $@\ncmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)\n\nquiet_cmd_solink = SOLINK($(TOOLSET)) $@\ncmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)\n\nquiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@\ncmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)\n\"\"\"  # noqa: E501\n\n\nLINK_COMMANDS_OS400 = \"\"\"\\\nquiet_cmd_alink = AR($(TOOLSET)) $@\ncmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^)\n\nquiet_cmd_alink_thin = AR($(TOOLSET)) $@\ncmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^)\n\nquiet_cmd_link = LINK($(TOOLSET)) $@\ncmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)\n\nquiet_cmd_solink = SOLINK($(TOOLSET)) $@\ncmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)\n\nquiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@\ncmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)\n\"\"\"  # noqa: E501\n\n\nLINK_COMMANDS_OS390 = \"\"\"\\\nquiet_cmd_alink = AR($(TOOLSET)) $@\ncmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)\n\nquiet_cmd_alink_thin = AR($(TOOLSET)) $@\ncmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)\n\nquiet_cmd_link = LINK($(TOOLSET)) $@\ncmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)\n\nquiet_cmd_solink = SOLINK($(TOOLSET)) $@\ncmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)\n\nquiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@\ncmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)\n\"\"\"  # noqa: E501\n\n\n# Header of toplevel Makefile.\n# This should go into the build tree, but it's easier to keep it here for now.\nSHARED_HEADER = (\n    \"\"\"\\\n# We borrow heavily from the kernel build setup, though we are simpler since\n# we don't have Kconfig tweaking settings on us.\n\n# The implicit make rules have it looking for RCS files, among other things.\n# We instead explicitly write all the rules we care about.\n# It's even quicker (saves ~200ms) to pass -r on the command line.\nMAKEFLAGS=-r\n\n# The source directory tree.\nsrcdir := %(srcdir)s\nabs_srcdir := $(abspath $(srcdir))\n\n# The name of the builddir.\nbuilddir_name ?= %(builddir)s\n\n# The V=1 flag on command line makes us verbosely print command lines.\nifdef V\n  quiet=\nelse\n  quiet=quiet_\nendif\n\n# Specify BUILDTYPE=Release on the command line for a release build.\nBUILDTYPE ?= %(default_configuration)s\n\n# Directory all our build output goes into.\n# Note that this must be two directories beneath src/ for unit tests to pass,\n# as they reach into the src/ directory for data with relative paths.\nbuilddir ?= $(builddir_name)/$(BUILDTYPE)\nabs_builddir := $(abspath $(builddir))\ndepsdir := $(builddir)/.deps\n\n# Object output directory.\nobj := $(builddir)/obj\nabs_obj := $(abspath $(obj))\n\n# We build up a list of every single one of the targets so we can slurp in the\n# generated dependency rule Makefiles in one pass.\nall_deps :=\n\n%(make_global_settings)s\n\nCC.target ?= %(CC.target)s\nCFLAGS.target ?= $(CPPFLAGS) $(CFLAGS)\nCXX.target ?= %(CXX.target)s\nCXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS)\nLINK.target ?= %(LINK.target)s\nLDFLAGS.target ?= $(LDFLAGS)\nAR.target ?= %(AR.target)s\nPLI.target ?= %(PLI.target)s\n\n# C++ apps need to be linked with g++.\nLINK ?= $(CXX.target)\n\n# TODO(evan): move all cross-compilation logic to gyp-time so we don't need\n# to replicate this environment fallback in make as well.\nCC.host ?= %(CC.host)s\nCFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host)\nCXX.host ?= %(CXX.host)s\nCXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host)\nLINK.host ?= %(LINK.host)s\nLDFLAGS.host ?= $(LDFLAGS_host)\nAR.host ?= %(AR.host)s\nPLI.host ?= %(PLI.host)s\n\n# Define a dir function that can handle spaces.\n# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions\n# \"leading spaces cannot appear in the text of the first argument as written.\n# These characters can be put into the argument value by variable substitution.\"\nempty :=\nspace := $(empty) $(empty)\n\n# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces\nreplace_spaces = $(subst $(space),\"\"\"\n    + SPACE_REPLACEMENT\n    + \"\"\",$1)\nunreplace_spaces = $(subst \"\"\"\n    + SPACE_REPLACEMENT\n    + \"\"\",$(space),$1)\ndirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))\n\n# Flags to make gcc output dependency info.  Note that you need to be\n# careful here to use the flags that ccache and distcc can understand.\n# We write to a dep file on the side first and then rename at the end\n# so we can't end up with a broken dep file.\ndepfile = $(depsdir)/$(call replace_spaces,$@).d\nDEPFLAGS = %(makedep_args)s -MF $(depfile).raw\n\n# We have to fixup the deps output in a few ways.\n# (1) the file output should mention the proper .o file.\n# ccache or distcc lose the path to the target, so we convert a rule of\n# the form:\n#   foobar.o: DEP1 DEP2\n# into\n#   path/to/foobar.o: DEP1 DEP2\n# (2) we want missing files not to cause us to fail to build.\n# We want to rewrite\n#   foobar.o: DEP1 DEP2 \\\\\n#               DEP3\n# to\n#   DEP1:\n#   DEP2:\n#   DEP3:\n# so if the files are missing, they're just considered phony rules.\n# We have to do some pretty insane escaping to get those backslashes\n# and dollar signs past make, the shell, and sed at the same time.\n# Doesn't work with spaces, but that's fine: .d files have spaces in\n# their names replaced with other characters.\"\"\"\n    r\"\"\"\ndefine fixup_dep\n# The depfile may not exist if the input file didn't have any #includes.\ntouch $(depfile).raw\n# Fixup path as in (1).\"\"\"\n    + (\n        r\"\"\"\nsed -e \"s|^$(notdir $@)|$@|\" -re 's/\\\\\\\\([^$$])/\\/\\1/g' $(depfile).raw >> $(depfile)\"\"\"\n        if sys.platform == \"win32\"\n        else r\"\"\"\nsed -e \"s|^$(notdir $@)|$@|\" $(depfile).raw >> $(depfile)\"\"\"\n    )\n    + r\"\"\"\n# Add extra rules as in (2).\n# We remove slashes and replace spaces with new lines;\n# remove blank lines;\n# delete the first line and append a colon to the remaining lines.\"\"\"\n    + (\n        \"\"\"\nsed -e 's/\\\\\\\\\\\\\\\\$$//' -e 's/\\\\\\\\\\\\\\\\/\\\\//g' -e 'y| |\\\\n|' $(depfile).raw |\\\\\"\"\"\n        if sys.platform == \"win32\"\n        else \"\"\"\nsed -e 's|\\\\\\\\||' -e 'y| |\\\\n|' $(depfile).raw |\\\\\"\"\"\n    )\n    + r\"\"\"\n  grep -v '^$$'                             |\\\n  sed -e 1d -e 's|$$|:|'                     \\\n    >> $(depfile)\nrm $(depfile).raw\nendef\n\"\"\"\n    \"\"\"\n# Command definitions:\n# - cmd_foo is the actual command to run;\n# - quiet_cmd_foo is the brief-output summary of the command.\n\nquiet_cmd_cc = CC($(TOOLSET)) $@\ncmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c\n\nquiet_cmd_cxx = CXX($(TOOLSET)) $@\ncmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c\n%(extra_commands)s\nquiet_cmd_touch = TOUCH $@\ncmd_touch = touch $@\n\nquiet_cmd_copy = COPY $@\n# send stderr to /dev/null to ignore messages when linking directories.\ncmd_copy = ln -f \"$<\" \"$@\" 2>/dev/null || (rm -rf \"$@\" && cp %(copy_archive_args)s \"$<\" \"$@\")\n\nquiet_cmd_symlink = SYMLINK $@\ncmd_symlink = ln -sf \"$<\" \"$@\"\n\n%(link_commands)s\n\"\"\"  # noqa: E501\n    r\"\"\"\n# Define an escape_quotes function to escape single quotes.\n# This allows us to handle quotes properly as long as we always use\n# use single quotes and escape_quotes.\nescape_quotes = $(subst ','\\'',$(1))\n# This comment is here just to include a ' to unconfuse syntax highlighting.\n# Define an escape_vars function to escape '$' variable syntax.\n# This allows us to read/write command lines with shell variables (e.g.\n# $LD_LIBRARY_PATH), without triggering make substitution.\nescape_vars = $(subst $$,$$$$,$(1))\n# Helper that expands to a shell command to echo a string exactly as it is in\n# make. This uses printf instead of echo because printf's behaviour with respect\n# to escape sequences is more portable than echo's across different shells\n# (e.g., dash, bash).\nexact_echo = printf '%%s\\n' '$(call escape_quotes,$(1))'\n\"\"\"\n    \"\"\"\n# Helper to compare the command we're about to run against the command\n# we logged the last time we ran the command.  Produces an empty\n# string (false) when the commands match.\n# Tricky point: Make has no string-equality test function.\n# The kernel uses the following, but it seems like it would have false\n# positives, where one string reordered its arguments.\n#   arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \\\\\n#                       $(filter-out $(cmd_$@), $(cmd_$(1))))\n# We instead substitute each for the empty string into the other, and\n# say they're equal if both substitutions produce the empty string.\n# .d files contain \"\"\"\n    + SPACE_REPLACEMENT\n    + \"\"\" instead of spaces, take that into account.\ncommand_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\\\\\n                       $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))\n\n# Helper that is non-empty when a prerequisite changes.\n# Normally make does this implicitly, but we force rules to always run\n# so we can check their command lines.\n#   $? -- new prerequisites\n#   $| -- order-only dependencies\nprereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))\n\n# Helper that executes all postbuilds until one fails.\ndefine do_postbuilds\n  @E=0;\\\\\n  for p in $(POSTBUILDS); do\\\\\n    eval $$p;\\\\\n    E=$$?;\\\\\n    if [ $$E -ne 0 ]; then\\\\\n      break;\\\\\n    fi;\\\\\n  done;\\\\\n  if [ $$E -ne 0 ]; then\\\\\n    rm -rf \"$@\";\\\\\n    exit $$E;\\\\\n  fi\nendef\n\n# do_cmd: run a command via the above cmd_foo names, if necessary.\n# Should always run for a given target to handle command-line changes.\n# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.\n# Third argument, if non-zero, makes it do POSTBUILDS processing.\n# Note: We intentionally do NOT call dirx for depfile, since it contains \"\"\"\n    + SPACE_REPLACEMENT\n    + \"\"\" for\n# spaces already and dirx strips the \"\"\"\n    + SPACE_REPLACEMENT\n    + \"\"\" characters.\ndefine do_cmd\n$(if $(or $(command_changed),$(prereq_changed)),\n  @$(call exact_echo,  $($(quiet)cmd_$(1)))\n  @mkdir -p \"$(call dirx,$@)\" \"$(dir $(depfile))\"\n  $(if $(findstring flock,$(word %(flock_index)d,$(cmd_$1))),\n    @$(cmd_$(1))\n    @echo \"  $(quiet_cmd_$(1)): Finished\",\n    @$(cmd_$(1))\n  )\n  @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)\n  @$(if $(2),$(fixup_dep))\n  $(if $(and $(3), $(POSTBUILDS)),\n    $(call do_postbuilds)\n  )\n)\nendef\n\n# Declare the \"%(default_target)s\" target first so it is the default,\n# even though we don't have the deps yet.\n.PHONY: %(default_target)s\n%(default_target)s:\n\n# make looks for ways to re-generate included makefiles, but in our case, we\n# don't have a direct way. Explicitly telling make that it has nothing to do\n# for them makes it go faster.\n%%.d: ;\n\n# Use FORCE_DO_CMD to force a target to run.  Should be coupled with\n# do_cmd.\n.PHONY: FORCE_DO_CMD\nFORCE_DO_CMD:\n\n\"\"\"  # noqa: E501\n)\n\nSHARED_HEADER_MAC_COMMANDS = \"\"\"\nquiet_cmd_objc = CXX($(TOOLSET)) $@\ncmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<\n\nquiet_cmd_objcxx = CXX($(TOOLSET)) $@\ncmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<\n\n# Commands for precompiled header files.\nquiet_cmd_pch_c = CXX($(TOOLSET)) $@\ncmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<\nquiet_cmd_pch_cc = CXX($(TOOLSET)) $@\ncmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<\nquiet_cmd_pch_m = CXX($(TOOLSET)) $@\ncmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<\nquiet_cmd_pch_mm = CXX($(TOOLSET)) $@\ncmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<\n\n# gyp-mac-tool is written next to the root Makefile by gyp.\n# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd\n# already.\nquiet_cmd_mac_tool = MACTOOL $(4) $<\ncmd_mac_tool = %(python)s gyp-mac-tool $(4) $< \"$@\"\n\nquiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@\ncmd_mac_package_framework = %(python)s gyp-mac-tool package-framework \"$@\" $(4)\n\nquiet_cmd_infoplist = INFOPLIST $@\ncmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) \"$<\" -o \"$@\"\n\"\"\" % {\"python\": sys.executable}  # noqa: E501\n\n\ndef WriteRootHeaderSuffixRules(writer):\n    extensions = sorted(COMPILABLE_EXTENSIONS.keys(), key=str.lower)\n\n    writer.write(\"# Suffix rules, putting all outputs into $(obj).\\n\")\n    for ext in extensions:\n        writer.write(\"$(obj).$(TOOLSET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD\\n\" % ext)\n        writer.write(\"\\t@$(call do_cmd,%s,1)\\n\" % COMPILABLE_EXTENSIONS[ext])\n\n    writer.write(\"\\n# Try building from generated source, too.\\n\")\n    for ext in extensions:\n        writer.write(\n            \"$(obj).$(TOOLSET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD\\n\" % ext\n        )\n        writer.write(\"\\t@$(call do_cmd,%s,1)\\n\" % COMPILABLE_EXTENSIONS[ext])\n    writer.write(\"\\n\")\n    for ext in extensions:\n        writer.write(\"$(obj).$(TOOLSET)/%%.o: $(obj)/%%%s FORCE_DO_CMD\\n\" % ext)\n        writer.write(\"\\t@$(call do_cmd,%s,1)\\n\" % COMPILABLE_EXTENSIONS[ext])\n    writer.write(\"\\n\")\n\n\nSHARED_HEADER_OS390_COMMANDS = \"\"\"\nPLIFLAGS.target ?= -qlp=64 -qlimits=extname=31  $(PLIFLAGS)\nPLIFLAGS.host ?= -qlp=64 -qlimits=extname=31 $(PLIFLAGS)\n\nquiet_cmd_pli = PLI($(TOOLSET)) $@\ncmd_pli = $(PLI.$(TOOLSET)) $(GYP_PLIFLAGS) $(PLIFLAGS.$(TOOLSET)) -c $< && \\\n          if [ -f $(notdir $@) ]; then /bin/cp $(notdir $@) $@; else true; fi\n\"\"\"\n\nSHARED_HEADER_SUFFIX_RULES_COMMENT1 = \"\"\"\\\n# Suffix rules, putting all outputs into $(obj).\n\"\"\"\n\n\nSHARED_HEADER_SUFFIX_RULES_COMMENT2 = \"\"\"\\\n# Try building from generated source, too.\n\"\"\"\n\n\nSHARED_FOOTER = \"\"\"\\\n# \"all\" is a concatenation of the \"all\" targets from all the included\n# sub-makefiles. This is just here to clarify.\nall:\n\n# Add in dependency-tracking rules.  $(all_deps) is the list of every single\n# target in our tree. Only consider the ones with .d (dependency) info:\nd_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))\nifneq ($(d_files),)\n  include $(d_files)\nendif\n\"\"\"\n\nheader = \"\"\"\\\n# This file is generated by gyp; do not edit.\n\n\"\"\"\n\n# Maps every compilable file extension to the do_cmd that compiles it.\nCOMPILABLE_EXTENSIONS = {\n    \".c\": \"cc\",\n    \".cc\": \"cxx\",\n    \".cpp\": \"cxx\",\n    \".cxx\": \"cxx\",\n    \".s\": \"cc\",\n    \".S\": \"cc\",\n}\n\n\ndef Compilable(filename):\n    \"\"\"Return true if the file is compilable (should be in OBJS).\"\"\"\n    return any(res for res in (filename.endswith(e) for e in COMPILABLE_EXTENSIONS))\n\n\ndef Linkable(filename):\n    \"\"\"Return true if the file is linkable (should be on the link line).\"\"\"\n    return filename.endswith(\".o\")\n\n\ndef Target(filename):\n    \"\"\"Translate a compilable filename to its .o target.\"\"\"\n    return os.path.splitext(filename)[0] + \".o\"\n\n\ndef EscapeShellArgument(s):\n    \"\"\"Quotes an argument so that it will be interpreted literally by a POSIX\n    shell. Taken from\n    http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python\n    \"\"\"\n    return \"'\" + s.replace(\"'\", \"'\\\\''\") + \"'\"\n\n\ndef EscapeMakeVariableExpansion(s):\n    \"\"\"Make has its own variable expansion syntax using $. We must escape it for\n    string to be interpreted literally.\"\"\"\n    return s.replace(\"$\", \"$$\")\n\n\ndef EscapeCppDefine(s):\n    \"\"\"Escapes a CPP define so that it will reach the compiler unaltered.\"\"\"\n    s = EscapeShellArgument(s)\n    s = EscapeMakeVariableExpansion(s)\n    # '#' characters must be escaped even embedded in a string, else Make will\n    # treat it as the start of a comment.\n    return s.replace(\"#\", r\"\\#\")\n\n\ndef QuoteIfNecessary(string):\n    \"\"\"TODO: Should this ideally be replaced with one or more of the above\n    functions?\"\"\"\n    if '\"' in string:\n        string = '\"' + string.replace('\"', '\\\\\"') + '\"'\n    return string\n\n\ndef replace_sep(string):\n    if sys.platform == \"win32\":\n        string = string.replace(\"\\\\\\\\\", \"/\").replace(\"\\\\\", \"/\")\n    return string\n\n\ndef StringToMakefileVariable(string):\n    \"\"\"Convert a string to a value that is acceptable as a make variable name.\"\"\"\n    return re.sub(\"[^a-zA-Z0-9_]\", \"_\", string)\n\n\nsrcdir_prefix = \"\"\n\n\ndef Sourceify(path):\n    \"\"\"Convert a path to its source directory form.\"\"\"\n    if \"$(\" in path:\n        return path\n    if os.path.isabs(path):\n        return path\n    return srcdir_prefix + path\n\n\ndef QuoteSpaces(s, quote=r\"\\ \"):\n    return s.replace(\" \", quote)\n\n\ndef SourceifyAndQuoteSpaces(path):\n    \"\"\"Convert a path to its source directory form and quote spaces.\"\"\"\n    return QuoteSpaces(Sourceify(path))\n\n\n# Map from qualified target to path to output.\ntarget_outputs = {}\n# Map from qualified target to any linkable output.  A subset\n# of target_outputs.  E.g. when mybinary depends on liba, we want to\n# include liba in the linker line; when otherbinary depends on\n# mybinary, we just want to build mybinary first.\ntarget_link_deps = {}\n\n\nclass MakefileWriter:\n    \"\"\"MakefileWriter packages up the writing of one target-specific foobar.mk.\n\n    Its only real entry point is Write(), and is mostly used for namespacing.\n    \"\"\"\n\n    def __init__(self, generator_flags, flavor):\n        self.generator_flags = generator_flags\n        self.flavor = flavor\n\n        self.suffix_rules_srcdir = {}\n        self.suffix_rules_objdir1 = {}\n        self.suffix_rules_objdir2 = {}\n\n        # Generate suffix rules for all compilable extensions.\n        for ext, value in COMPILABLE_EXTENSIONS.items():\n            # Suffix rules for source folder.\n            self.suffix_rules_srcdir.update(\n                {\n                    ext: (\n                        \"\"\"\\\n$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD\n\\t@$(call do_cmd,%s,1)\n\"\"\"\n                        % (ext, value)\n                    )\n                }\n            )\n\n            # Suffix rules for generated source files.\n            self.suffix_rules_objdir1.update(\n                {\n                    ext: (\n                        \"\"\"\\\n$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD\n\\t@$(call do_cmd,%s,1)\n\"\"\"\n                        % (ext, value)\n                    )\n                }\n            )\n            self.suffix_rules_objdir2.update(\n                {\n                    ext: (\n                        \"\"\"\\\n$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD\n\\t@$(call do_cmd,%s,1)\n\"\"\"\n                        % (ext, value)\n                    )\n                }\n            )\n\n    def Write(\n        self, qualified_target, base_path, output_filename, spec, configs, part_of_all\n    ):\n        \"\"\"The main entry point: writes a .mk file for a single target.\n\n        Arguments:\n          qualified_target: target we're generating\n          base_path: path relative to source root we're building in, used to resolve\n                     target-relative paths\n          output_filename: output .mk file name to write\n          spec, configs: gyp info\n          part_of_all: flag indicating this target is part of 'all'\n        \"\"\"\n        gyp.common.EnsureDirExists(output_filename)\n\n        self.fp = open(output_filename, \"w\")\n\n        self.fp.write(header)\n\n        self.qualified_target = qualified_target\n        self.path = base_path\n        self.target = spec[\"target_name\"]\n        self.type = spec[\"type\"]\n        self.toolset = spec[\"toolset\"]\n\n        self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec)\n        if self.flavor == \"mac\":\n            self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec)\n        else:\n            self.xcode_settings = None\n\n        deps, link_deps = self.ComputeDeps(spec)\n\n        # Some of the generation below can add extra output, sources, or\n        # link dependencies.  All of the out params of the functions that\n        # follow use names like extra_foo.\n        extra_outputs = []\n        extra_sources = []\n        extra_link_deps = []\n        extra_mac_bundle_resources = []\n        mac_bundle_deps = []\n\n        if self.is_mac_bundle:\n            self.output = self.ComputeMacBundleOutput(spec)\n            self.output_binary = self.ComputeMacBundleBinaryOutput(spec)\n        else:\n            self.output = self.output_binary = replace_sep(self.ComputeOutput(spec))\n\n        self.is_standalone_static_library = bool(\n            spec.get(\"standalone_static_library\", 0)\n        )\n        self._INSTALLABLE_TARGETS = (\"executable\", \"loadable_module\", \"shared_library\")\n        if self.is_standalone_static_library or self.type in self._INSTALLABLE_TARGETS:\n            self.alias = os.path.basename(self.output)\n            install_path = self._InstallableTargetInstallPath()\n        else:\n            self.alias = self.output\n            install_path = self.output\n\n        self.WriteLn(\"TOOLSET := \" + self.toolset)\n        self.WriteLn(\"TARGET := \" + self.target)\n\n        # Actions must come first, since they can generate more OBJs for use below.\n        if \"actions\" in spec:\n            self.WriteActions(\n                spec[\"actions\"],\n                extra_sources,\n                extra_outputs,\n                extra_mac_bundle_resources,\n                part_of_all,\n            )\n\n        # Rules must be early like actions.\n        if \"rules\" in spec:\n            self.WriteRules(\n                spec[\"rules\"],\n                extra_sources,\n                extra_outputs,\n                extra_mac_bundle_resources,\n                part_of_all,\n            )\n\n        if \"copies\" in spec:\n            self.WriteCopies(spec[\"copies\"], extra_outputs, part_of_all)\n\n        # Bundle resources.\n        if self.is_mac_bundle:\n            all_mac_bundle_resources = (\n                spec.get(\"mac_bundle_resources\", []) + extra_mac_bundle_resources\n            )\n            self.WriteMacBundleResources(all_mac_bundle_resources, mac_bundle_deps)\n            self.WriteMacInfoPlist(mac_bundle_deps)\n\n        # Sources.\n        all_sources = spec.get(\"sources\", []) + extra_sources\n        if all_sources:\n            self.WriteSources(\n                configs,\n                deps,\n                all_sources,\n                extra_outputs,\n                extra_link_deps,\n                part_of_all,\n                gyp.xcode_emulation.MacPrefixHeader(\n                    self.xcode_settings,\n                    lambda p: Sourceify(self.Absolutify(p)),\n                    self.Pchify,\n                ),\n            )\n            sources = [x for x in all_sources if Compilable(x)]\n            if sources:\n                self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1)\n                extensions = {os.path.splitext(s)[1] for s in sources}\n                for ext in extensions:\n                    if ext in self.suffix_rules_srcdir:\n                        self.WriteLn(self.suffix_rules_srcdir[ext])\n                self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT2)\n                for ext in extensions:\n                    if ext in self.suffix_rules_objdir1:\n                        self.WriteLn(self.suffix_rules_objdir1[ext])\n                for ext in extensions:\n                    if ext in self.suffix_rules_objdir2:\n                        self.WriteLn(self.suffix_rules_objdir2[ext])\n                self.WriteLn(\"# End of this set of suffix rules\")\n\n                # Add dependency from bundle to bundle binary.\n                if self.is_mac_bundle:\n                    mac_bundle_deps.append(self.output_binary)\n\n        self.WriteTarget(\n            spec,\n            configs,\n            deps,\n            extra_link_deps + link_deps,\n            mac_bundle_deps,\n            extra_outputs,\n            part_of_all,\n        )\n\n        # Update global list of target outputs, used in dependency tracking.\n        target_outputs[qualified_target] = install_path\n\n        # Update global list of link dependencies.\n        if self.type in (\"static_library\", \"shared_library\"):\n            target_link_deps[qualified_target] = self.output_binary\n\n        # Currently any versions have the same effect, but in future the behavior\n        # could be different.\n        if self.generator_flags.get(\"android_ndk_version\", None):\n            self.WriteAndroidNdkModuleRule(self.target, all_sources, link_deps)\n\n        self.fp.close()\n\n    def WriteSubMake(self, output_filename, makefile_path, targets, build_dir):\n        \"\"\"Write a \"sub-project\" Makefile.\n\n        This is a small, wrapper Makefile that calls the top-level Makefile to build\n        the targets from a single gyp file (i.e. a sub-project).\n\n        Arguments:\n          output_filename: sub-project Makefile name to write\n          makefile_path: path to the top-level Makefile\n          targets: list of \"all\" targets for this sub-project\n          build_dir: build output directory, relative to the sub-project\n        \"\"\"\n        gyp.common.EnsureDirExists(output_filename)\n        self.fp = open(output_filename, \"w\")\n        self.fp.write(header)\n        # For consistency with other builders, put sub-project build output in the\n        # sub-project dir (see test/subdirectory/gyptest-subdir-all.py).\n        self.WriteLn(\n            \"export builddir_name ?= %s\"\n            % replace_sep(os.path.join(os.path.dirname(output_filename), build_dir))\n        )\n        self.WriteLn(\".PHONY: all\")\n        self.WriteLn(\"all:\")\n        if makefile_path:\n            makefile_path = \" -C \" + makefile_path\n        self.WriteLn(\"\\t$(MAKE){} {}\".format(makefile_path, \" \".join(targets)))\n        self.fp.close()\n\n    def WriteActions(\n        self,\n        actions,\n        extra_sources,\n        extra_outputs,\n        extra_mac_bundle_resources,\n        part_of_all,\n    ):\n        \"\"\"Write Makefile code for any 'actions' from the gyp input.\n\n        extra_sources: a list that will be filled in with newly generated source\n                       files, if any\n        extra_outputs: a list that will be filled in with any outputs of these\n                       actions (used to make other pieces dependent on these\n                       actions)\n        part_of_all: flag indicating this target is part of 'all'\n        \"\"\"\n        env = self.GetSortedXcodeEnv()\n        for action in actions:\n            name = StringToMakefileVariable(\n                \"{}_{}\".format(self.qualified_target, action[\"action_name\"])\n            )\n            self.WriteLn('### Rules for action \"%s\":' % action[\"action_name\"])\n            inputs = action[\"inputs\"]\n            outputs = action[\"outputs\"]\n\n            # Build up a list of outputs.\n            # Collect the output dirs we'll need.\n            dirs = set()\n            for out in outputs:\n                dir = os.path.split(out)[0]\n                if dir:\n                    dirs.add(dir)\n            if int(action.get(\"process_outputs_as_sources\", False)):\n                extra_sources += outputs\n            if int(action.get(\"process_outputs_as_mac_bundle_resources\", False)):\n                extra_mac_bundle_resources += outputs\n\n            # Write the actual command.\n            action_commands = action[\"action\"]\n            if self.flavor == \"mac\":\n                action_commands = [\n                    gyp.xcode_emulation.ExpandEnvVars(command, env)\n                    for command in action_commands\n                ]\n            command = gyp.common.EncodePOSIXShellList(action_commands)\n            if \"message\" in action:\n                self.WriteLn(\n                    \"quiet_cmd_{} = ACTION {} $@\".format(name, action[\"message\"])\n                )\n            else:\n                self.WriteLn(f\"quiet_cmd_{name} = ACTION {name} $@\")\n            if len(dirs) > 0:\n                command = \"mkdir -p %s\" % \" \".join(dirs) + \"; \" + command\n\n            cd_action = \"cd %s; \" % Sourceify(self.path or \".\")\n\n            # command and cd_action get written to a toplevel variable called\n            # cmd_foo. Toplevel variables can't handle things that change per\n            # makefile like $(TARGET), so hardcode the target.\n            command = command.replace(\"$(TARGET)\", self.target)\n            cd_action = cd_action.replace(\"$(TARGET)\", self.target)\n\n            # Set LD_LIBRARY_PATH in case the action runs an executable from this\n            # build which links to shared libs from this build.\n            # actions run on the host, so they should in theory only use host\n            # libraries, but until everything is made cross-compile safe, also use\n            # target libraries.\n            # TODO(piman): when everything is cross-compile safe, remove lib.target\n            if self.flavor in {\"zos\", \"aix\"}:\n                self.WriteLn(\n                    \"cmd_%s = LIBPATH=$(builddir)/lib.host:\"\n                    \"$(builddir)/lib.target:$$LIBPATH; \"\n                    \"export LIBPATH; \"\n                    \"%s%s\" % (name, cd_action, command)\n                )\n            else:\n                self.WriteLn(\n                    \"cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:\"\n                    \"$(builddir)/lib.target:$$LD_LIBRARY_PATH; \"\n                    \"export LD_LIBRARY_PATH; \"\n                    \"%s%s\" % (name, cd_action, command)\n                )\n            self.WriteLn()\n            outputs = [self.Absolutify(o) for o in outputs]\n            # The makefile rules are all relative to the top dir, but the gyp actions\n            # are defined relative to their containing dir.  This replaces the obj\n            # variable for the action rule with an absolute version so that the output\n            # goes in the right place.\n            # Only write the 'obj' and 'builddir' rules for the \"primary\" output (:1);\n            # it's superfluous for the \"extra outputs\", and this avoids accidentally\n            # writing duplicate dummy rules for those outputs.\n            # Same for environment.\n            self.WriteLn(\"%s: obj := $(abs_obj)\" % QuoteSpaces(outputs[0]))\n            self.WriteLn(\"%s: builddir := $(abs_builddir)\" % QuoteSpaces(outputs[0]))\n            self.WriteSortedXcodeEnv(outputs[0], self.GetSortedXcodeEnv())\n\n            for input in inputs:\n                assert \" \" not in input, (\n                    \"Spaces in action input filenames not supported (%s)\" % input\n                )\n            for output in outputs:\n                assert \" \" not in output, (\n                    \"Spaces in action output filenames not supported (%s)\" % output\n                )\n\n            # See the comment in WriteCopies about expanding env vars.\n            outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs]\n            inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs]\n\n            self.WriteDoCmd(\n                outputs,\n                [Sourceify(self.Absolutify(i)) for i in inputs],\n                part_of_all=part_of_all,\n                command=name,\n            )\n\n            # Stuff the outputs in a variable so we can refer to them later.\n            outputs_variable = \"action_%s_outputs\" % name\n            self.WriteLn(\"{} := {}\".format(outputs_variable, \" \".join(outputs)))\n            extra_outputs.append(\"$(%s)\" % outputs_variable)\n            self.WriteLn()\n\n        self.WriteLn()\n\n    def WriteRules(\n        self,\n        rules,\n        extra_sources,\n        extra_outputs,\n        extra_mac_bundle_resources,\n        part_of_all,\n    ):\n        \"\"\"Write Makefile code for any 'rules' from the gyp input.\n\n        extra_sources: a list that will be filled in with newly generated source\n                       files, if any\n        extra_outputs: a list that will be filled in with any outputs of these\n                       rules (used to make other pieces dependent on these rules)\n        part_of_all: flag indicating this target is part of 'all'\n        \"\"\"\n        env = self.GetSortedXcodeEnv()\n        for rule in rules:\n            name = StringToMakefileVariable(\n                \"{}_{}\".format(self.qualified_target, rule[\"rule_name\"])\n            )\n            count = 0\n            self.WriteLn(\"### Generated for rule %s:\" % name)\n\n            all_outputs = []\n\n            for rule_source in rule.get(\"rule_sources\", []):\n                dirs = set()\n                (rule_source_dirname, rule_source_basename) = os.path.split(rule_source)\n                (rule_source_root, _rule_source_ext) = os.path.splitext(\n                    rule_source_basename\n                )\n\n                outputs = [\n                    self.ExpandInputRoot(out, rule_source_root, rule_source_dirname)\n                    for out in rule[\"outputs\"]\n                ]\n\n                for out in outputs:\n                    dir = os.path.dirname(out)\n                    if dir:\n                        dirs.add(dir)\n                if int(rule.get(\"process_outputs_as_sources\", False)):\n                    extra_sources += outputs\n                if int(rule.get(\"process_outputs_as_mac_bundle_resources\", False)):\n                    extra_mac_bundle_resources += outputs\n                inputs = [\n                    Sourceify(self.Absolutify(i))\n                    for i in [rule_source] + rule.get(\"inputs\", [])\n                ]\n                actions = [\"$(call do_cmd,%s_%d)\" % (name, count)]\n\n                if name == \"resources_grit\":\n                    # HACK: This is ugly.  Grit intentionally doesn't touch the\n                    # timestamp of its output file when the file doesn't change,\n                    # which is fine in hash-based dependency systems like scons\n                    # and forge, but not kosher in the make world.  After some\n                    # discussion, hacking around it here seems like the least\n                    # amount of pain.\n                    actions += [\"@touch --no-create $@\"]\n\n                # See the comment in WriteCopies about expanding env vars.\n                outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs]\n                inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs]\n\n                outputs = [self.Absolutify(o) for o in outputs]\n                all_outputs += outputs\n                # Only write the 'obj' and 'builddir' rules for the \"primary\" output\n                # (:1); it's superfluous for the \"extra outputs\", and this avoids\n                # accidentally writing duplicate dummy rules for those outputs.\n                self.WriteLn(\"%s: obj := $(abs_obj)\" % outputs[0])\n                self.WriteLn(\"%s: builddir := $(abs_builddir)\" % outputs[0])\n                self.WriteMakeRule(\n                    outputs, inputs, actions, command=\"%s_%d\" % (name, count)\n                )\n                # Spaces in rule filenames are not supported, but rule variables have\n                # spaces in them (e.g. RULE_INPUT_PATH expands to '$(abspath $<)').\n                # The spaces within the variables are valid, so remove the variables\n                # before checking.\n                variables_with_spaces = re.compile(r\"\\$\\([^ ]* \\$<\\)\")\n                for output in outputs:\n                    output = re.sub(variables_with_spaces, \"\", output)\n                    assert \" \" not in output, (\n                        \"Spaces in rule filenames not yet supported (%s)\" % output\n                    )\n                self.WriteLn(\"all_deps += %s\" % \" \".join(outputs))\n\n                action = [\n                    self.ExpandInputRoot(ac, rule_source_root, rule_source_dirname)\n                    for ac in rule[\"action\"]\n                ]\n                mkdirs = \"\"\n                if len(dirs) > 0:\n                    mkdirs = \"mkdir -p %s; \" % \" \".join(dirs)\n                cd_action = \"cd %s; \" % Sourceify(self.path or \".\")\n\n                # action, cd_action, and mkdirs get written to a toplevel variable\n                # called cmd_foo. Toplevel variables can't handle things that change\n                # per makefile like $(TARGET), so hardcode the target.\n                if self.flavor == \"mac\":\n                    action = [\n                        gyp.xcode_emulation.ExpandEnvVars(command, env)\n                        for command in action\n                    ]\n                action = gyp.common.EncodePOSIXShellList(action)\n                action = action.replace(\"$(TARGET)\", self.target)\n                cd_action = cd_action.replace(\"$(TARGET)\", self.target)\n                mkdirs = mkdirs.replace(\"$(TARGET)\", self.target)\n\n                # Set LD_LIBRARY_PATH in case the rule runs an executable from this\n                # build which links to shared libs from this build.\n                # rules run on the host, so they should in theory only use host\n                # libraries, but until everything is made cross-compile safe, also use\n                # target libraries.\n                # TODO(piman): when everything is cross-compile safe, remove lib.target\n                self.WriteLn(\n                    \"cmd_%(name)s_%(count)d = LD_LIBRARY_PATH=\"\n                    \"$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; \"\n                    \"export LD_LIBRARY_PATH; \"\n                    \"%(cd_action)s%(mkdirs)s%(action)s\"\n                    % {\n                        \"action\": action,\n                        \"cd_action\": cd_action,\n                        \"count\": count,\n                        \"mkdirs\": mkdirs,\n                        \"name\": name,\n                    }\n                )\n                self.WriteLn(\n                    \"quiet_cmd_%(name)s_%(count)d = RULE %(name)s_%(count)d $@\"\n                    % {\"count\": count, \"name\": name}\n                )\n                self.WriteLn()\n                count += 1\n\n            outputs_variable = \"rule_%s_outputs\" % name\n            self.WriteList(all_outputs, outputs_variable)\n            extra_outputs.append(\"$(%s)\" % outputs_variable)\n\n            self.WriteLn(\"### Finished generating for rule: %s\" % name)\n            self.WriteLn()\n        self.WriteLn(\"### Finished generating for all rules\")\n        self.WriteLn(\"\")\n\n    def WriteCopies(self, copies, extra_outputs, part_of_all):\n        \"\"\"Write Makefile code for any 'copies' from the gyp input.\n\n        extra_outputs: a list that will be filled in with any outputs of this action\n                       (used to make other pieces dependent on this action)\n        part_of_all: flag indicating this target is part of 'all'\n        \"\"\"\n        self.WriteLn(\"### Generated for copy rule.\")\n\n        variable = StringToMakefileVariable(self.qualified_target + \"_copies\")\n        outputs = []\n        for copy in copies:\n            for path in copy[\"files\"]:\n                # Absolutify() may call normpath, and will strip trailing slashes.\n                path = Sourceify(self.Absolutify(path))\n                filename = os.path.split(path)[1]\n                output = Sourceify(\n                    self.Absolutify(os.path.join(copy[\"destination\"], filename))\n                )\n\n                # If the output path has variables in it, which happens in practice for\n                # 'copies', writing the environment as target-local doesn't work,\n                # because the variables are already needed for the target name.\n                # Copying the environment variables into global make variables doesn't\n                # work either, because then the .d files will potentially contain spaces\n                # after variable expansion, and .d file handling cannot handle spaces.\n                # As a workaround, manually expand variables at gyp time. Since 'copies'\n                # can't run scripts, there's no need to write the env then.\n                # WriteDoCmd() will escape spaces for .d files.\n                env = self.GetSortedXcodeEnv()\n                output = gyp.xcode_emulation.ExpandEnvVars(output, env)\n                path = gyp.xcode_emulation.ExpandEnvVars(path, env)\n                self.WriteDoCmd([output], [path], \"copy\", part_of_all)\n                outputs.append(output)\n        self.WriteLn(\n            \"{} = {}\".format(variable, \" \".join(QuoteSpaces(o) for o in outputs))\n        )\n        extra_outputs.append(\"$(%s)\" % variable)\n        self.WriteLn()\n\n    def WriteMacBundleResources(self, resources, bundle_deps):\n        \"\"\"Writes Makefile code for 'mac_bundle_resources'.\"\"\"\n        self.WriteLn(\"### Generated for mac_bundle_resources\")\n\n        for output, res in gyp.xcode_emulation.GetMacBundleResources(\n            generator_default_variables[\"PRODUCT_DIR\"],\n            self.xcode_settings,\n            [Sourceify(self.Absolutify(r)) for r in resources],\n        ):\n            _, ext = os.path.splitext(output)\n            if ext != \".xcassets\":\n                # Make does not supports '.xcassets' emulation.\n                self.WriteDoCmd(\n                    [output], [res], \"mac_tool,,,copy-bundle-resource\", part_of_all=True\n                )\n                bundle_deps.append(output)\n\n    def WriteMacInfoPlist(self, bundle_deps):\n        \"\"\"Write Makefile code for bundle Info.plist files.\"\"\"\n        info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist(\n            generator_default_variables[\"PRODUCT_DIR\"],\n            self.xcode_settings,\n            lambda p: Sourceify(self.Absolutify(p)),\n        )\n        if not info_plist:\n            return\n        if defines:\n            # Create an intermediate file to store preprocessed results.\n            intermediate_plist = \"$(obj).$(TOOLSET)/$(TARGET)/\" + os.path.basename(\n                info_plist\n            )\n            self.WriteList(\n                defines,\n                intermediate_plist + \": INFOPLIST_DEFINES\",\n                \"-D\",\n                quoter=EscapeCppDefine,\n            )\n            self.WriteMakeRule(\n                [intermediate_plist],\n                [info_plist],\n                [\n                    \"$(call do_cmd,infoplist)\",\n                    # \"Convert\" the plist so that any weird whitespace changes from the\n                    # preprocessor do not affect the XML parser in mac_tool.\n                    \"@plutil -convert xml1 $@ $@\",\n                ],\n            )\n            info_plist = intermediate_plist\n        # plists can contain envvars and substitute them into the file.\n        self.WriteSortedXcodeEnv(\n            out, self.GetSortedXcodeEnv(additional_settings=extra_env)\n        )\n        self.WriteDoCmd(\n            [out], [info_plist], \"mac_tool,,,copy-info-plist\", part_of_all=True\n        )\n        bundle_deps.append(out)\n\n    def WriteSources(\n        self,\n        configs,\n        deps,\n        sources,\n        extra_outputs,\n        extra_link_deps,\n        part_of_all,\n        precompiled_header,\n    ):\n        \"\"\"Write Makefile code for any 'sources' from the gyp input.\n        These are source files necessary to build the current target.\n\n        configs, deps, sources: input from gyp.\n        extra_outputs: a list of extra outputs this action should be dependent on;\n                       used to serialize action/rules before compilation\n        extra_link_deps: a list that will be filled in with any outputs of\n                         compilation (to be used in link lines)\n        part_of_all: flag indicating this target is part of 'all'\n        \"\"\"\n\n        # Write configuration-specific variables for CFLAGS, etc.\n        for configname in sorted(configs.keys()):\n            config = configs[configname]\n            self.WriteList(\n                config.get(\"defines\"),\n                \"DEFS_%s\" % configname,\n                prefix=\"-D\",\n                quoter=EscapeCppDefine,\n            )\n\n            if self.flavor == \"mac\":\n                cflags = self.xcode_settings.GetCflags(\n                    configname, arch=config.get(\"xcode_configuration_platform\")\n                )\n                cflags_c = self.xcode_settings.GetCflagsC(configname)\n                cflags_cc = self.xcode_settings.GetCflagsCC(configname)\n                cflags_objc = self.xcode_settings.GetCflagsObjC(configname)\n                cflags_objcc = self.xcode_settings.GetCflagsObjCC(configname)\n            else:\n                cflags = config.get(\"cflags\")\n                cflags_c = config.get(\"cflags_c\")\n                cflags_cc = config.get(\"cflags_cc\")\n\n            self.WriteLn(\"# Flags passed to all source files.\")\n            self.WriteList(cflags, \"CFLAGS_%s\" % configname)\n            self.WriteLn(\"# Flags passed to only C files.\")\n            self.WriteList(cflags_c, \"CFLAGS_C_%s\" % configname)\n            self.WriteLn(\"# Flags passed to only C++ files.\")\n            self.WriteList(cflags_cc, \"CFLAGS_CC_%s\" % configname)\n            if self.flavor == \"mac\":\n                self.WriteLn(\"# Flags passed to only ObjC files.\")\n                self.WriteList(cflags_objc, \"CFLAGS_OBJC_%s\" % configname)\n                self.WriteLn(\"# Flags passed to only ObjC++ files.\")\n                self.WriteList(cflags_objcc, \"CFLAGS_OBJCC_%s\" % configname)\n            includes = config.get(\"include_dirs\")\n            if includes:\n                includes = [Sourceify(self.Absolutify(i)) for i in includes]\n            self.WriteList(includes, \"INCS_%s\" % configname, prefix=\"-I\")\n\n        compilable = list(filter(Compilable, sources))\n        objs = [self.Objectify(self.Absolutify(Target(c))) for c in compilable]\n        self.WriteList(objs, \"OBJS\")\n\n        for obj in objs:\n            assert \" \" not in obj, \"Spaces in object filenames not supported (%s)\" % obj\n        self.WriteLn(\"# Add to the list of files we specially track dependencies for.\")\n        self.WriteLn(\"all_deps += $(OBJS)\")\n        self.WriteLn()\n\n        # Make sure our dependencies are built first.\n        if deps:\n            self.WriteMakeRule(\n                [\"$(OBJS)\"],\n                deps,\n                comment=\"Make sure our dependencies are built before any of us.\",\n                order_only=True,\n            )\n\n        # Make sure the actions and rules run first.\n        # If they generate any extra headers etc., the per-.o file dep tracking\n        # will catch the proper rebuilds, so order only is still ok here.\n        if extra_outputs:\n            self.WriteMakeRule(\n                [\"$(OBJS)\"],\n                extra_outputs,\n                comment=\"Make sure our actions/rules run before any of us.\",\n                order_only=True,\n            )\n\n        if pchdeps := precompiled_header.GetObjDependencies(compilable, objs):\n            self.WriteLn(\"# Dependencies from obj files to their precompiled headers\")\n            for source, obj, gch in pchdeps:\n                self.WriteLn(f\"{obj}: {gch}\")\n            self.WriteLn(\"# End precompiled header dependencies\")\n\n        if objs:\n            extra_link_deps.append(\"$(OBJS)\")\n            self.WriteLn(\n                \"\"\"\\\n# CFLAGS et al overrides must be target-local.\n# See \"Target-specific Variable Values\" in the GNU Make manual.\"\"\"\n            )\n            self.WriteLn(\"$(OBJS): TOOLSET := $(TOOLSET)\")\n            self.WriteLn(\n                \"$(OBJS): GYP_CFLAGS := \"\n                \"$(DEFS_$(BUILDTYPE)) \"\n                \"$(INCS_$(BUILDTYPE)) \"\n                \"%s \" % precompiled_header.GetInclude(\"c\") + \"$(CFLAGS_$(BUILDTYPE)) \"\n                \"$(CFLAGS_C_$(BUILDTYPE))\"\n            )\n            self.WriteLn(\n                \"$(OBJS): GYP_CXXFLAGS := \"\n                \"$(DEFS_$(BUILDTYPE)) \"\n                \"$(INCS_$(BUILDTYPE)) \"\n                \"%s \" % precompiled_header.GetInclude(\"cc\") + \"$(CFLAGS_$(BUILDTYPE)) \"\n                \"$(CFLAGS_CC_$(BUILDTYPE))\"\n            )\n            if self.flavor == \"mac\":\n                self.WriteLn(\n                    \"$(OBJS): GYP_OBJCFLAGS := \"\n                    \"$(DEFS_$(BUILDTYPE)) \"\n                    \"$(INCS_$(BUILDTYPE)) \"\n                    \"%s \"\n                    % precompiled_header.GetInclude(\"m\")\n                    + \"$(CFLAGS_$(BUILDTYPE)) \"\n                    \"$(CFLAGS_C_$(BUILDTYPE)) \"\n                    \"$(CFLAGS_OBJC_$(BUILDTYPE))\"\n                )\n                self.WriteLn(\n                    \"$(OBJS): GYP_OBJCXXFLAGS := \"\n                    \"$(DEFS_$(BUILDTYPE)) \"\n                    \"$(INCS_$(BUILDTYPE)) \"\n                    \"%s \"\n                    % precompiled_header.GetInclude(\"mm\")\n                    + \"$(CFLAGS_$(BUILDTYPE)) \"\n                    \"$(CFLAGS_CC_$(BUILDTYPE)) \"\n                    \"$(CFLAGS_OBJCC_$(BUILDTYPE))\"\n                )\n\n        self.WritePchTargets(precompiled_header.GetPchBuildCommands())\n\n        # If there are any object files in our input file list, link them into our\n        # output.\n        extra_link_deps += [source for source in sources if Linkable(source)]\n\n        self.WriteLn()\n\n    def WritePchTargets(self, pch_commands):\n        \"\"\"Writes make rules to compile prefix headers.\"\"\"\n        if not pch_commands:\n            return\n\n        for gch, lang_flag, lang, input in pch_commands:\n            extra_flags = {\n                \"c\": \"$(CFLAGS_C_$(BUILDTYPE))\",\n                \"cc\": \"$(CFLAGS_CC_$(BUILDTYPE))\",\n                \"m\": \"$(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))\",\n                \"mm\": \"$(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))\",\n            }[lang]\n            var_name = {\n                \"c\": \"GYP_PCH_CFLAGS\",\n                \"cc\": \"GYP_PCH_CXXFLAGS\",\n                \"m\": \"GYP_PCH_OBJCFLAGS\",\n                \"mm\": \"GYP_PCH_OBJCXXFLAGS\",\n            }[lang]\n            self.WriteLn(\n                f\"{gch}: {var_name} := {lang_flag} \" + \"$(DEFS_$(BUILDTYPE)) \"\n                \"$(INCS_$(BUILDTYPE)) \"\n                \"$(CFLAGS_$(BUILDTYPE)) \" + extra_flags\n            )\n\n            self.WriteLn(f\"{gch}: {input} FORCE_DO_CMD\")\n            self.WriteLn(\"\\t@$(call do_cmd,pch_%s,1)\" % lang)\n            self.WriteLn(\"\")\n            assert \" \" not in gch, \"Spaces in gch filenames not supported (%s)\" % gch\n            self.WriteLn(\"all_deps += %s\" % gch)\n            self.WriteLn(\"\")\n\n    def ComputeOutputBasename(self, spec):\n        \"\"\"Return the 'output basename' of a gyp spec.\n\n        E.g., the loadable module 'foobar' in directory 'baz' will produce\n          'libfoobar.so'\n        \"\"\"\n        assert not self.is_mac_bundle\n\n        if self.flavor == \"mac\" and self.type in (\n            \"static_library\",\n            \"executable\",\n            \"shared_library\",\n            \"loadable_module\",\n        ):\n            return self.xcode_settings.GetExecutablePath()\n\n        target = spec[\"target_name\"]\n        target_prefix = \"\"\n        target_ext = \"\"\n        if self.type == \"static_library\":\n            if target[:3] == \"lib\":\n                target = target[3:]\n            target_prefix = \"lib\"\n            target_ext = \".a\"\n        elif self.type in (\"loadable_module\", \"shared_library\"):\n            if target[:3] == \"lib\":\n                target = target[3:]\n            target_prefix = \"lib\"\n            if self.flavor == \"aix\":\n                target_ext = \".a\"\n            elif self.flavor == \"zos\":\n                target_ext = \".x\"\n            else:\n                target_ext = \".so\"\n        elif self.type == \"none\":\n            target = \"%s.stamp\" % target\n        elif self.type != \"executable\":\n            print(\n                \"ERROR: What output file should be generated?\",\n                \"type\",\n                self.type,\n                \"target\",\n                target,\n            )\n\n        target_prefix = spec.get(\"product_prefix\", target_prefix)\n        target = spec.get(\"product_name\", target)\n        if product_ext := spec.get(\"product_extension\"):\n            target_ext = \".\" + product_ext\n\n        return target_prefix + target + target_ext\n\n    def _InstallImmediately(self):\n        return (\n            self.toolset == \"target\"\n            and self.flavor == \"mac\"\n            and self.type\n            in (\"static_library\", \"executable\", \"shared_library\", \"loadable_module\")\n        )\n\n    def ComputeOutput(self, spec):\n        \"\"\"Return the 'output' (full output path) of a gyp spec.\n\n        E.g., the loadable module 'foobar' in directory 'baz' will produce\n          '$(obj)/baz/libfoobar.so'\n        \"\"\"\n        assert not self.is_mac_bundle\n\n        path = os.path.join(\"$(obj).\" + self.toolset, self.path)\n        if self.type == \"executable\" or self._InstallImmediately():\n            path = \"$(builddir)\"\n        path = spec.get(\"product_dir\", path)\n        return os.path.join(path, self.ComputeOutputBasename(spec))\n\n    def ComputeMacBundleOutput(self, spec):\n        \"\"\"Return the 'output' (full output path) to a bundle output directory.\"\"\"\n        assert self.is_mac_bundle\n        path = generator_default_variables[\"PRODUCT_DIR\"]\n        return os.path.join(path, self.xcode_settings.GetWrapperName())\n\n    def ComputeMacBundleBinaryOutput(self, spec):\n        \"\"\"Return the 'output' (full output path) to the binary in a bundle.\"\"\"\n        path = generator_default_variables[\"PRODUCT_DIR\"]\n        return os.path.join(path, self.xcode_settings.GetExecutablePath())\n\n    def ComputeDeps(self, spec):\n        \"\"\"Compute the dependencies of a gyp spec.\n\n        Returns a tuple (deps, link_deps), where each is a list of\n        filenames that will need to be put in front of make for either\n        building (deps) or linking (link_deps).\n        \"\"\"\n        deps = []\n        link_deps = []\n        if \"dependencies\" in spec:\n            deps.extend(\n                [\n                    target_outputs[dep]\n                    for dep in spec[\"dependencies\"]\n                    if target_outputs[dep]\n                ]\n            )\n            for dep in spec[\"dependencies\"]:\n                if dep in target_link_deps:\n                    link_deps.append(target_link_deps[dep])\n            deps.extend(link_deps)\n            # TODO: It seems we need to transitively link in libraries (e.g. -lfoo)?\n            # This hack makes it work:\n            # link_deps.extend(spec.get('libraries', []))\n        return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps))\n\n    def GetSharedObjectFromSidedeck(self, sidedeck):\n        \"\"\"Return the shared object files based on sidedeck\"\"\"\n        return re.sub(r\"\\.x$\", \".so\", sidedeck)\n\n    def GetUnversionedSidedeckFromSidedeck(self, sidedeck):\n        \"\"\"Return the shared object files based on sidedeck\"\"\"\n        return re.sub(r\"\\.\\d+\\.x$\", \".x\", sidedeck)\n\n    def WriteDependencyOnExtraOutputs(self, target, extra_outputs):\n        self.WriteMakeRule(\n            [self.output_binary],\n            extra_outputs,\n            comment=\"Build our special outputs first.\",\n            order_only=True,\n        )\n\n    def WriteTarget(\n        self, spec, configs, deps, link_deps, bundle_deps, extra_outputs, part_of_all\n    ):\n        \"\"\"Write Makefile code to produce the final target of the gyp spec.\n\n        spec, configs: input from gyp.\n        deps, link_deps: dependency lists; see ComputeDeps()\n        extra_outputs: any extra outputs that our target should depend on\n        part_of_all: flag indicating this target is part of 'all'\n        \"\"\"\n\n        self.WriteLn(\"### Rules for final target.\")\n\n        if extra_outputs:\n            self.WriteDependencyOnExtraOutputs(self.output_binary, extra_outputs)\n            self.WriteMakeRule(\n                extra_outputs,\n                deps,\n                comment=(\"Preserve order dependency of special output on deps.\"),\n                order_only=True,\n            )\n\n        target_postbuilds = {}\n        if self.type != \"none\":\n            for configname in sorted(configs.keys()):\n                config = configs[configname]\n                if self.flavor == \"mac\":\n                    ldflags = self.xcode_settings.GetLdflags(\n                        configname,\n                        generator_default_variables[\"PRODUCT_DIR\"],\n                        lambda p: Sourceify(self.Absolutify(p)),\n                        arch=config.get(\"xcode_configuration_platform\"),\n                    )\n\n                    # TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.\n                    gyp_to_build = gyp.common.InvertRelativePath(self.path)\n                    target_postbuild = self.xcode_settings.AddImplicitPostbuilds(\n                        configname,\n                        QuoteSpaces(\n                            os.path.normpath(os.path.join(gyp_to_build, self.output))\n                        ),\n                        QuoteSpaces(\n                            os.path.normpath(\n                                os.path.join(gyp_to_build, self.output_binary)\n                            )\n                        ),\n                    )\n                    if target_postbuild:\n                        target_postbuilds[configname] = target_postbuild\n                else:\n                    ldflags = config.get(\"ldflags\", [])\n                    # Compute an rpath for this output if needed.\n                    if any(dep.endswith(\".so\") or \".so.\" in dep for dep in deps):\n                        # We want to get the literal string \"$ORIGIN\"\n                        # into the link command, so we need lots of escaping.\n                        ldflags.append(r\"-Wl,-rpath=\\$$ORIGIN/\")\n                        ldflags.append(r\"-Wl,-rpath-link=\\$(builddir)/\")\n                if library_dirs := config.get(\"library_dirs\", []):\n                    library_dirs = [Sourceify(self.Absolutify(i)) for i in library_dirs]\n                ldflags += [(\"-L%s\" % library_dir) for library_dir in library_dirs]\n                self.WriteList(ldflags, \"LDFLAGS_%s\" % configname)\n                if self.flavor == \"mac\":\n                    self.WriteList(\n                        self.xcode_settings.GetLibtoolflags(configname),\n                        \"LIBTOOLFLAGS_%s\" % configname,\n                    )\n            libraries = spec.get(\"libraries\")\n            if libraries:\n                # Remove duplicate entries\n                libraries = gyp.common.uniquer(libraries)\n                if self.flavor == \"mac\":\n                    libraries = self.xcode_settings.AdjustLibraries(libraries)\n            self.WriteList(libraries, \"LIBS\")\n            self.WriteLn(\n                \"%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))\"\n                % QuoteSpaces(self.output_binary)\n            )\n            self.WriteLn(\"%s: LIBS := $(LIBS)\" % QuoteSpaces(self.output_binary))\n\n            if self.flavor == \"mac\":\n                self.WriteLn(\n                    \"%s: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))\"\n                    % QuoteSpaces(self.output_binary)\n                )\n\n        # Postbuild actions. Like actions, but implicitly depend on the target's\n        # output.\n        postbuilds = []\n        if self.flavor == \"mac\":\n            if target_postbuilds:\n                postbuilds.append(\"$(TARGET_POSTBUILDS_$(BUILDTYPE))\")\n            postbuilds.extend(gyp.xcode_emulation.GetSpecPostbuildCommands(spec))\n\n        if postbuilds:\n            # Envvars may be referenced by TARGET_POSTBUILDS_$(BUILDTYPE),\n            # so we must output its definition first, since we declare variables\n            # using \":=\".\n            self.WriteSortedXcodeEnv(self.output, self.GetSortedXcodePostbuildEnv())\n\n            for configname, value in target_postbuilds.items():\n                self.WriteLn(\n                    \"%s: TARGET_POSTBUILDS_%s := %s\"\n                    % (\n                        QuoteSpaces(self.output),\n                        configname,\n                        gyp.common.EncodePOSIXShellList(value),\n                    )\n                )\n\n            # Postbuilds expect to be run in the gyp file's directory, so insert an\n            # implicit postbuild to cd to there.\n            postbuilds.insert(0, gyp.common.EncodePOSIXShellList([\"cd\", self.path]))\n            for i, postbuild in enumerate(postbuilds):\n                if not postbuild.startswith(\"$\"):\n                    postbuilds[i] = EscapeShellArgument(postbuild)\n            self.WriteLn(\"%s: builddir := $(abs_builddir)\" % QuoteSpaces(self.output))\n            self.WriteLn(\n                \"%s: POSTBUILDS := %s\"\n                % (QuoteSpaces(self.output), \" \".join(postbuilds))\n            )\n\n        # A bundle directory depends on its dependencies such as bundle resources\n        # and bundle binary. When all dependencies have been built, the bundle\n        # needs to be packaged.\n        if self.is_mac_bundle:\n            # If the framework doesn't contain a binary, then nothing depends\n            # on the actions -- make the framework depend on them directly too.\n            self.WriteDependencyOnExtraOutputs(self.output, extra_outputs)\n\n            # Bundle dependencies. Note that the code below adds actions to this\n            # target, so if you move these two lines, move the lines below as well.\n            self.WriteList([QuoteSpaces(dep) for dep in bundle_deps], \"BUNDLE_DEPS\")\n            self.WriteLn(\"%s: $(BUNDLE_DEPS)\" % QuoteSpaces(self.output))\n\n            # After the framework is built, package it. Needs to happen before\n            # postbuilds, since postbuilds depend on this.\n            if self.type in (\"shared_library\", \"loadable_module\"):\n                self.WriteLn(\n                    \"\\t@$(call do_cmd,mac_package_framework,,,%s)\"\n                    % self.xcode_settings.GetFrameworkVersion()\n                )\n\n            # Bundle postbuilds can depend on the whole bundle, so run them after\n            # the bundle is packaged, not already after the bundle binary is done.\n            if postbuilds:\n                self.WriteLn(\"\\t@$(call do_postbuilds)\")\n            postbuilds = []  # Don't write postbuilds for target's output.\n\n            # Needed by test/mac/gyptest-rebuild.py.\n            self.WriteLn(\"\\t@true  # No-op, used by tests\")\n\n            # Since this target depends on binary and resources which are in\n            # nested subfolders, the framework directory will be older than\n            # its dependencies usually. To prevent this rule from executing\n            # on every build (expensive, especially with postbuilds), explicitly\n            # update the time on the framework directory.\n            self.WriteLn(\"\\t@touch -c %s\" % QuoteSpaces(self.output))\n\n        if postbuilds:\n            assert not self.is_mac_bundle, (\n                \"Postbuilds for bundles should be done \"\n                \"on the bundle, not the binary (target '%s')\" % self.target\n            )\n            assert \"product_dir\" not in spec, (\n                \"Postbuilds do not work with custom product_dir\"\n            )\n\n        if self.type == \"executable\":\n            self.WriteLn(\n                \"%s: LD_INPUTS := %s\"\n                % (\n                    QuoteSpaces(self.output_binary),\n                    \" \".join(QuoteSpaces(dep) for dep in link_deps),\n                )\n            )\n            if self.toolset == \"host\" and self.flavor == \"android\":\n                self.WriteDoCmd(\n                    [self.output_binary],\n                    link_deps,\n                    \"link_host\",\n                    part_of_all,\n                    postbuilds=postbuilds,\n                )\n            else:\n                self.WriteDoCmd(\n                    [self.output_binary],\n                    link_deps,\n                    \"link\",\n                    part_of_all,\n                    postbuilds=postbuilds,\n                )\n\n        elif self.type == \"static_library\":\n            for link_dep in link_deps:\n                assert \" \" not in link_dep, (\n                    \"Spaces in alink input filenames not supported (%s)\" % link_dep\n                )\n            if (\n                self.flavor not in (\"mac\", \"openbsd\", \"netbsd\", \"win\")\n                and not self.is_standalone_static_library\n            ):\n                if self.flavor in (\"linux\", \"android\", \"openharmony\"):\n                    self.WriteMakeRule(\n                        [self.output_binary],\n                        link_deps,\n                        actions=[\"$(call create_thin_archive,$@,$^)\"],\n                    )\n                else:\n                    self.WriteDoCmd(\n                        [self.output_binary],\n                        link_deps,\n                        \"alink_thin\",\n                        part_of_all,\n                        postbuilds=postbuilds,\n                    )\n            elif self.flavor in (\"linux\", \"android\", \"openharmony\"):\n                self.WriteMakeRule(\n                    [self.output_binary],\n                    link_deps,\n                    actions=[\"$(call create_archive,$@,$^)\"],\n                )\n            else:\n                self.WriteDoCmd(\n                    [self.output_binary],\n                    link_deps,\n                    \"alink\",\n                    part_of_all,\n                    postbuilds=postbuilds,\n                )\n        elif self.type == \"shared_library\":\n            self.WriteLn(\n                \"%s: LD_INPUTS := %s\"\n                % (\n                    QuoteSpaces(self.output_binary),\n                    \" \".join(QuoteSpaces(dep) for dep in link_deps),\n                )\n            )\n            self.WriteDoCmd(\n                [self.output_binary],\n                link_deps,\n                \"solink\",\n                part_of_all,\n                postbuilds=postbuilds,\n            )\n            # z/OS has a .so target as well as a sidedeck .x target\n            if self.flavor == \"zos\":\n                self.WriteLn(\n                    \"%s: %s\"\n                    % (\n                        QuoteSpaces(\n                            self.GetSharedObjectFromSidedeck(self.output_binary)\n                        ),\n                        QuoteSpaces(self.output_binary),\n                    )\n                )\n        elif self.type == \"loadable_module\":\n            for link_dep in link_deps:\n                assert \" \" not in link_dep, (\n                    \"Spaces in module input filenames not supported (%s)\" % link_dep\n                )\n            if self.toolset == \"host\" and self.flavor == \"android\":\n                self.WriteDoCmd(\n                    [self.output_binary],\n                    link_deps,\n                    \"solink_module_host\",\n                    part_of_all,\n                    postbuilds=postbuilds,\n                )\n            else:\n                self.WriteDoCmd(\n                    [self.output_binary],\n                    link_deps,\n                    \"solink_module\",\n                    part_of_all,\n                    postbuilds=postbuilds,\n                )\n        elif self.type == \"none\":\n            # Write a stamp line.\n            self.WriteDoCmd(\n                [self.output_binary], deps, \"touch\", part_of_all, postbuilds=postbuilds\n            )\n        else:\n            print(\"WARNING: no output for\", self.type, self.target)\n\n        # Add an alias for each target (if there are any outputs).\n        # Installable target aliases are created below.\n        if (self.output and self.output != self.target) and (\n            self.type not in self._INSTALLABLE_TARGETS\n        ):\n            self.WriteMakeRule(\n                [self.target], [self.output], comment=\"Add target alias\", phony=True\n            )\n            if part_of_all:\n                self.WriteMakeRule(\n                    [\"all\"],\n                    [self.target],\n                    comment='Add target alias to \"all\" target.',\n                    phony=True,\n                )\n\n        # Add special-case rules for our installable targets.\n        # 1) They need to install to the build dir or \"product\" dir.\n        # 2) They get shortcuts for building (e.g. \"make chrome\").\n        # 3) They are part of \"make all\".\n        if self.type in self._INSTALLABLE_TARGETS or self.is_standalone_static_library:\n            if self.type == \"shared_library\":\n                file_desc = \"shared library\"\n            elif self.type == \"static_library\":\n                file_desc = \"static library\"\n            else:\n                file_desc = \"executable\"\n            install_path = self._InstallableTargetInstallPath()\n            installable_deps = []\n            if self.flavor != \"zos\":\n                installable_deps.append(self.output)\n            if (\n                self.flavor == \"mac\"\n                and \"product_dir\" not in spec\n                and self.toolset == \"target\"\n            ):\n                # On mac, products are created in install_path immediately.\n                assert install_path == self.output, f\"{install_path} != {self.output}\"\n\n            # Point the target alias to the final binary output.\n            self.WriteMakeRule(\n                [self.target], [install_path], comment=\"Add target alias\", phony=True\n            )\n            if install_path != self.output:\n                assert not self.is_mac_bundle  # See comment a few lines above.\n                self.WriteDoCmd(\n                    [install_path],\n                    [self.output],\n                    \"copy\",\n                    comment=\"Copy this to the %s output path.\" % file_desc,\n                    part_of_all=part_of_all,\n                )\n                if self.flavor != \"zos\":\n                    installable_deps.append(install_path)\n            if self.flavor == \"zos\" and self.type == \"shared_library\":\n                # lib.target/libnode.so has a dependency on $(obj).target/libnode.so\n                self.WriteDoCmd(\n                    [self.GetSharedObjectFromSidedeck(install_path)],\n                    [self.GetSharedObjectFromSidedeck(self.output)],\n                    \"copy\",\n                    comment=\"Copy this to the %s output path.\" % file_desc,\n                    part_of_all=part_of_all,\n                )\n                # Create a symlink of libnode.x to libnode.version.x\n                self.WriteDoCmd(\n                    [self.GetUnversionedSidedeckFromSidedeck(install_path)],\n                    [install_path],\n                    \"symlink\",\n                    comment=\"Symlnk this to the %s output path.\" % file_desc,\n                    part_of_all=part_of_all,\n                )\n                # Place libnode.version.so and libnode.x symlink in lib.target dir\n                installable_deps.append(self.GetSharedObjectFromSidedeck(install_path))\n                installable_deps.append(\n                    self.GetUnversionedSidedeckFromSidedeck(install_path)\n                )\n            if self.alias not in (self.output, self.target):\n                self.WriteMakeRule(\n                    [self.alias],\n                    installable_deps,\n                    comment=\"Short alias for building this %s.\" % file_desc,\n                    phony=True,\n                )\n            if self.flavor == \"zos\" and self.type == \"shared_library\":\n                # Make sure that .x symlink target is run\n                self.WriteMakeRule(\n                    [\"all\"],\n                    [\n                        self.GetUnversionedSidedeckFromSidedeck(install_path),\n                        self.GetSharedObjectFromSidedeck(install_path),\n                    ],\n                    comment='Add %s to \"all\" target.' % file_desc,\n                    phony=True,\n                )\n            elif part_of_all:\n                self.WriteMakeRule(\n                    [\"all\"],\n                    [install_path],\n                    comment='Add %s to \"all\" target.' % file_desc,\n                    phony=True,\n                )\n\n    def WriteList(self, value_list, variable=None, prefix=\"\", quoter=QuoteIfNecessary):\n        \"\"\"Write a variable definition that is a list of values.\n\n        E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out\n             foo = blaha blahb\n        but in a pretty-printed style.\n        \"\"\"\n        values = \"\"\n        if value_list:\n            value_list = [replace_sep(quoter(prefix + value)) for value in value_list]\n            values = \" \\\\\\n\\t\" + \" \\\\\\n\\t\".join(value_list)\n        self.fp.write(f\"{variable} :={values}\\n\\n\")\n\n    def WriteDoCmd(\n        self, outputs, inputs, command, part_of_all, comment=None, postbuilds=False\n    ):\n        \"\"\"Write a Makefile rule that uses do_cmd.\n\n        This makes the outputs dependent on the command line that was run,\n        as well as support the V= make command line flag.\n        \"\"\"\n        suffix = \"\"\n        if postbuilds:\n            assert \",\" not in command\n            suffix = \",,1\"  # Tell do_cmd to honor $POSTBUILDS\n        self.WriteMakeRule(\n            outputs,\n            inputs,\n            actions=[f\"$(call do_cmd,{command}{suffix})\"],\n            comment=comment,\n            command=command,\n            force=True,\n        )\n        # Add our outputs to the list of targets we read depfiles from.\n        # all_deps is only used for deps file reading, and for deps files we replace\n        # spaces with ? because escaping doesn't work with make's $(sort) and\n        # other functions.\n        outputs = [QuoteSpaces(o, SPACE_REPLACEMENT) for o in outputs]\n        self.WriteLn(\"all_deps += %s\" % \" \".join(outputs))\n\n    def WriteMakeRule(\n        self,\n        outputs,\n        inputs,\n        actions=None,\n        comment=None,\n        order_only=False,\n        force=False,\n        phony=False,\n        command=None,\n    ):\n        \"\"\"Write a Makefile rule, with some extra tricks.\n\n        outputs: a list of outputs for the rule (note: this is not directly\n                 supported by make; see comments below)\n        inputs: a list of inputs for the rule\n        actions: a list of shell commands to run for the rule\n        comment: a comment to put in the Makefile above the rule (also useful\n                 for making this Python script's code self-documenting)\n        order_only: if true, makes the dependency order-only\n        force: if true, include FORCE_DO_CMD as an order-only dep\n        phony: if true, the rule does not actually generate the named output, the\n               output is just a name to run the rule\n        command: (optional) command name to generate unambiguous labels\n        \"\"\"\n        outputs = [QuoteSpaces(o) for o in outputs]\n        inputs = [QuoteSpaces(i) for i in inputs]\n\n        if comment:\n            self.WriteLn(\"# \" + comment)\n        if phony:\n            self.WriteLn(\".PHONY: \" + \" \".join(outputs))\n        if actions:\n            self.WriteLn(\"%s: TOOLSET := $(TOOLSET)\" % outputs[0])\n        force_append = \" FORCE_DO_CMD\" if force else \"\"\n\n        if order_only:\n            # Order only rule: Just write a simple rule.\n            # TODO(evanm): just make order_only a list of deps instead of this hack.\n            self.WriteLn(\n                \"{}: | {}{}\".format(\" \".join(outputs), \" \".join(inputs), force_append)\n            )\n        elif len(outputs) == 1:\n            # Regular rule, one output: Just write a simple rule.\n            self.WriteLn(\"{}: {}{}\".format(outputs[0], \" \".join(inputs), force_append))\n        else:\n            # Regular rule, more than one output: Multiple outputs are tricky in\n            # make. We will write three rules:\n            # - All outputs depend on an intermediate file.\n            # - Make .INTERMEDIATE depend on the intermediate.\n            # - The intermediate file depends on the inputs and executes the\n            #   actual command.\n            # - The intermediate recipe will 'touch' the intermediate file.\n            # - The multi-output rule will have an do-nothing recipe.\n\n            # Hash the target name to avoid generating overlong filenames.\n            cmddigest = hashlib.sha256(\n                (command or self.target).encode(\"utf-8\")\n            ).hexdigest()\n            intermediate = \"%s.intermediate\" % cmddigest\n            self.WriteLn(\"{}: {}\".format(\" \".join(outputs), intermediate))\n            self.WriteLn(\"\\t%s\" % \"@:\")\n            self.WriteLn(\"{}: {}\".format(\".INTERMEDIATE\", intermediate))\n            self.WriteLn(\n                \"{}: {}{}\".format(intermediate, \" \".join(inputs), force_append)\n            )\n            actions.insert(0, \"$(call do_cmd,touch)\")\n\n        if actions:\n            for action in actions:\n                self.WriteLn(\"\\t%s\" % action)\n        self.WriteLn()\n\n    def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps):\n        \"\"\"Write a set of LOCAL_XXX definitions for Android NDK.\n\n        These variable definitions will be used by Android NDK but do nothing for\n        non-Android applications.\n\n        Arguments:\n          module_name: Android NDK module name, which must be unique among all\n              module names.\n          all_sources: A list of source files (will be filtered by Compilable).\n          link_deps: A list of link dependencies, which must be sorted in\n              the order from dependencies to dependents.\n        \"\"\"\n        if self.type not in (\"executable\", \"shared_library\", \"static_library\"):\n            return\n\n        self.WriteLn(\"# Variable definitions for Android applications\")\n        self.WriteLn(\"include $(CLEAR_VARS)\")\n        self.WriteLn(\"LOCAL_MODULE := \" + module_name)\n        self.WriteLn(\n            \"LOCAL_CFLAGS := $(CFLAGS_$(BUILDTYPE)) \"\n            \"$(DEFS_$(BUILDTYPE)) \"\n            # LOCAL_CFLAGS is applied to both of C and C++.  There is\n            # no way to specify $(CFLAGS_C_$(BUILDTYPE)) only for C\n            # sources.\n            \"$(CFLAGS_C_$(BUILDTYPE)) \"\n            # $(INCS_$(BUILDTYPE)) includes the prefix '-I' while\n            # LOCAL_C_INCLUDES does not expect it.  So put it in\n            # LOCAL_CFLAGS.\n            \"$(INCS_$(BUILDTYPE))\"\n        )\n        # LOCAL_CXXFLAGS is obsolete and LOCAL_CPPFLAGS is preferred.\n        self.WriteLn(\"LOCAL_CPPFLAGS := $(CFLAGS_CC_$(BUILDTYPE))\")\n        self.WriteLn(\"LOCAL_C_INCLUDES :=\")\n        self.WriteLn(\"LOCAL_LDLIBS := $(LDFLAGS_$(BUILDTYPE)) $(LIBS)\")\n\n        # Detect the C++ extension.\n        cpp_ext = {\".cc\": 0, \".cpp\": 0, \".cxx\": 0}\n        default_cpp_ext = \".cpp\"\n        for filename in all_sources:\n            ext = os.path.splitext(filename)[1]\n            if ext in cpp_ext:\n                cpp_ext[ext] += 1\n                if cpp_ext[ext] > cpp_ext[default_cpp_ext]:\n                    default_cpp_ext = ext\n        self.WriteLn(\"LOCAL_CPP_EXTENSION := \" + default_cpp_ext)\n\n        self.WriteList(\n            list(map(self.Absolutify, filter(Compilable, all_sources))),\n            \"LOCAL_SRC_FILES\",\n        )\n\n        # Filter out those which do not match prefix and suffix and produce\n        # the resulting list without prefix and suffix.\n        def DepsToModules(deps, prefix, suffix):\n            modules = []\n            for filepath in deps:\n                filename = os.path.basename(filepath)\n                if filename.startswith(prefix) and filename.endswith(suffix):\n                    modules.append(filename[len(prefix) : -len(suffix)])\n            return modules\n\n        # Retrieve the default value of 'SHARED_LIB_SUFFIX'\n        params = {\"flavor\": \"linux\"}\n        default_variables = {}\n        CalculateVariables(default_variables, params)\n\n        self.WriteList(\n            DepsToModules(\n                link_deps,\n                generator_default_variables[\"SHARED_LIB_PREFIX\"],\n                default_variables[\"SHARED_LIB_SUFFIX\"],\n            ),\n            \"LOCAL_SHARED_LIBRARIES\",\n        )\n        self.WriteList(\n            DepsToModules(\n                link_deps,\n                generator_default_variables[\"STATIC_LIB_PREFIX\"],\n                generator_default_variables[\"STATIC_LIB_SUFFIX\"],\n            ),\n            \"LOCAL_STATIC_LIBRARIES\",\n        )\n\n        if self.type == \"executable\":\n            self.WriteLn(\"include $(BUILD_EXECUTABLE)\")\n        elif self.type == \"shared_library\":\n            self.WriteLn(\"include $(BUILD_SHARED_LIBRARY)\")\n        elif self.type == \"static_library\":\n            self.WriteLn(\"include $(BUILD_STATIC_LIBRARY)\")\n        self.WriteLn()\n\n    def WriteLn(self, text=\"\"):\n        self.fp.write(text + \"\\n\")\n\n    def GetSortedXcodeEnv(self, additional_settings=None):\n        return gyp.xcode_emulation.GetSortedXcodeEnv(\n            self.xcode_settings,\n            \"$(abs_builddir)\",\n            os.path.join(\"$(abs_srcdir)\", self.path),\n            \"$(BUILDTYPE)\",\n            additional_settings,\n        )\n\n    def GetSortedXcodePostbuildEnv(self):\n        # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack.\n        # TODO(thakis): It would be nice to have some general mechanism instead.\n        strip_save_file = self.xcode_settings.GetPerTargetSetting(\n            \"CHROMIUM_STRIP_SAVE_FILE\", \"\"\n        )\n        # Even if strip_save_file is empty, explicitly write it. Else a postbuild\n        # might pick up an export from an earlier target.\n        return self.GetSortedXcodeEnv(\n            additional_settings={\"CHROMIUM_STRIP_SAVE_FILE\": strip_save_file}\n        )\n\n    def WriteSortedXcodeEnv(self, target, env):\n        for k, v in env:\n            # For\n            #  foo := a\\ b\n            # the escaped space does the right thing. For\n            #  export foo := a\\ b\n            # it does not -- the backslash is written to the env as literal character.\n            # So don't escape spaces in |env[k]|.\n            self.WriteLn(f\"{QuoteSpaces(target)}: export {k} := {v}\")\n\n    def Objectify(self, path):\n        \"\"\"Convert a path to its output directory form.\"\"\"\n        if \"$(\" in path:\n            path = path.replace(\"$(obj)/\", \"$(obj).%s/$(TARGET)/\" % self.toolset)\n        if \"$(obj)\" not in path:\n            path = f\"$(obj).{self.toolset}/$(TARGET)/{path}\"\n        return path\n\n    def Pchify(self, path, lang):\n        \"\"\"Convert a prefix header path to its output directory form.\"\"\"\n        path = self.Absolutify(path)\n        if \"$(\" in path:\n            path = path.replace(\n                \"$(obj)/\", f\"$(obj).{self.toolset}/$(TARGET)/pch-{lang}\"\n            )\n            return path\n        return f\"$(obj).{self.toolset}/$(TARGET)/pch-{lang}/{path}\"\n\n    def Absolutify(self, path):\n        \"\"\"Convert a subdirectory-relative path into a base-relative path.\n        Skips over paths that contain variables.\"\"\"\n        if \"$(\" in path:\n            # Don't call normpath in this case, as it might collapse the\n            # path too aggressively if it features '..'. However it's still\n            # important to strip trailing slashes.\n            return path.rstrip(\"/\")\n        return os.path.normpath(os.path.join(self.path, path))\n\n    def ExpandInputRoot(self, template, expansion, dirname):\n        if \"%(INPUT_ROOT)s\" not in template and \"%(INPUT_DIRNAME)s\" not in template:\n            return template\n        path = template % {\n            \"INPUT_ROOT\": expansion,\n            \"INPUT_DIRNAME\": dirname,\n        }\n        return path\n\n    def _InstallableTargetInstallPath(self):\n        \"\"\"Returns the location of the final output for an installable target.\"\"\"\n        # Functionality removed for all platforms to match Xcode and hoist\n        # shared libraries into PRODUCT_DIR for users:\n        # Xcode puts shared_library results into PRODUCT_DIR, and some gyp files\n        # rely on this. Emulate this behavior for mac.\n        # if self.type == \"shared_library\" and (\n        #     self.flavor != \"mac\" or self.toolset != \"target\"\n        # ):\n        #    # Install all shared libs into a common directory (per toolset) for\n        #    # convenient access with LD_LIBRARY_PATH.\n        #    return \"$(builddir)/lib.%s/%s\" % (self.toolset, self.alias)\n        if self.flavor == \"zos\" and self.type == \"shared_library\":\n            return \"$(builddir)/lib.%s/%s\" % (self.toolset, self.alias)\n\n        return \"$(builddir)/\" + self.alias\n\n\ndef WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files):\n    \"\"\"Write the target to regenerate the Makefile.\"\"\"\n    options = params[\"options\"]\n    build_files_args = [\n        gyp.common.RelativePath(filename, options.toplevel_dir)\n        for filename in params[\"build_files_arg\"]\n    ]\n\n    gyp_binary = gyp.common.FixIfRelativePath(\n        params[\"gyp_binary\"], options.toplevel_dir\n    )\n    if not gyp_binary.startswith(os.sep):\n        gyp_binary = os.path.join(\".\", gyp_binary)\n\n    root_makefile.write(\n        \"quiet_cmd_regen_makefile = ACTION Regenerating $@\\n\"\n        \"cmd_regen_makefile = cd $(srcdir); %(cmd)s\\n\"\n        \"%(makefile_name)s: %(deps)s\\n\"\n        \"\\t$(call do_cmd,regen_makefile)\\n\\n\"\n        % {\n            \"makefile_name\": makefile_name,\n            \"deps\": replace_sep(\n                \" \".join(sorted(SourceifyAndQuoteSpaces(bf) for bf in build_files))\n            ),\n            \"cmd\": replace_sep(\n                gyp.common.EncodePOSIXShellList(\n                    [gyp_binary, \"-fmake\"]\n                    + gyp.RegenerateFlags(options)\n                    + build_files_args\n                )\n            ),\n        }\n    )\n\n\ndef PerformBuild(data, configurations, params):\n    options = params[\"options\"]\n    for config in configurations:\n        arguments = [\"make\"]\n        if options.toplevel_dir and options.toplevel_dir != \".\":\n            arguments += \"-C\", options.toplevel_dir\n        arguments.append(\"BUILDTYPE=\" + config)\n        print(f\"Building [{config}]: {arguments}\")\n        subprocess.check_call(arguments)\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    options = params[\"options\"]\n    flavor = gyp.common.GetFlavor(params)\n    generator_flags = params.get(\"generator_flags\", {})\n    builddir_name = generator_flags.get(\"output_dir\", \"out\")\n    android_ndk_version = generator_flags.get(\"android_ndk_version\", None)\n    default_target = generator_flags.get(\"default_target\", \"all\")\n\n    def CalculateMakefilePath(build_file, base_name):\n        \"\"\"Determine where to write a Makefile for a given gyp file.\"\"\"\n        # Paths in gyp files are relative to the .gyp file, but we want\n        # paths relative to the source root for the master makefile.  Grab\n        # the path of the .gyp file as the base to relativize against.\n        # E.g. \"foo/bar\" when we're constructing targets for \"foo/bar/baz.gyp\".\n        base_path = gyp.common.RelativePath(os.path.dirname(build_file), options.depth)\n        # We write the file in the base_path directory.\n        output_file = os.path.join(options.depth, base_path, base_name)\n        if options.generator_output:\n            output_file = os.path.join(\n                options.depth, options.generator_output, base_path, base_name\n            )\n        base_path = gyp.common.RelativePath(\n            os.path.dirname(build_file), options.toplevel_dir\n        )\n        return base_path, output_file\n\n    # TODO:  search for the first non-'Default' target.  This can go\n    # away when we add verification that all targets have the\n    # necessary configurations.\n    default_configuration = None\n    toolsets = {target_dicts[target][\"toolset\"] for target in target_list}\n    for target in target_list:\n        spec = target_dicts[target]\n        if spec[\"default_configuration\"] != \"Default\":\n            default_configuration = spec[\"default_configuration\"]\n            break\n    if not default_configuration:\n        default_configuration = \"Default\"\n\n    srcdir = \".\"\n    makefile_name = \"Makefile\" + options.suffix\n    makefile_path = os.path.join(options.toplevel_dir, makefile_name)\n    if options.generator_output:\n        global srcdir_prefix\n        makefile_path = os.path.join(\n            options.toplevel_dir, options.generator_output, makefile_name\n        )\n        srcdir = replace_sep(gyp.common.RelativePath(srcdir, options.generator_output))\n        srcdir_prefix = \"$(srcdir)/\"\n\n    flock_command = \"flock\"\n    copy_archive_arguments = \"-af\"\n    makedep_arguments = \"-MMD\"\n\n    # wasm-ld doesn't support --start-group/--end-group\n    link_commands = LINK_COMMANDS_LINUX\n    if flavor in [\"wasi\", \"wasm\"]:\n        link_commands = link_commands.replace(\" -Wl,--start-group\", \"\").replace(\n            \" -Wl,--end-group\", \"\"\n        )\n\n    CC_target = replace_sep(GetEnvironFallback((\"CC_target\", \"CC\"), \"$(CC)\"))\n    AR_target = replace_sep(GetEnvironFallback((\"AR_target\", \"AR\"), \"$(AR)\"))\n    CXX_target = replace_sep(GetEnvironFallback((\"CXX_target\", \"CXX\"), \"$(CXX)\"))\n    LINK_target = replace_sep(GetEnvironFallback((\"LINK_target\", \"LINK\"), \"$(LINK)\"))\n    PLI_target = replace_sep(GetEnvironFallback((\"PLI_target\", \"PLI\"), \"pli\"))\n    CC_host = replace_sep(GetEnvironFallback((\"CC_host\", \"CC\"), \"gcc\"))\n    AR_host = replace_sep(GetEnvironFallback((\"AR_host\", \"AR\"), \"ar\"))\n    CXX_host = replace_sep(GetEnvironFallback((\"CXX_host\", \"CXX\"), \"g++\"))\n    LINK_host = replace_sep(GetEnvironFallback((\"LINK_host\", \"LINK\"), \"$(CXX.host)\"))\n    PLI_host = replace_sep(GetEnvironFallback((\"PLI_host\", \"PLI\"), \"pli\"))\n\n    header_params = {\n        \"default_target\": default_target,\n        \"builddir\": builddir_name,\n        \"default_configuration\": default_configuration,\n        \"flock\": flock_command,\n        \"flock_index\": 1,\n        \"link_commands\": link_commands,\n        \"extra_commands\": \"\",\n        \"srcdir\": srcdir,\n        \"copy_archive_args\": copy_archive_arguments,\n        \"makedep_args\": makedep_arguments,\n        \"CC.target\": CC_target,\n        \"AR.target\": AR_target,\n        \"CXX.target\": CXX_target,\n        \"LINK.target\": LINK_target,\n        \"PLI.target\": PLI_target,\n        \"CC.host\": CC_host,\n        \"AR.host\": AR_host,\n        \"CXX.host\": CXX_host,\n        \"LINK.host\": LINK_host,\n        \"PLI.host\": PLI_host,\n    }\n    if flavor == \"mac\":\n        flock_command = \"%s gyp-mac-tool flock\" % sys.executable\n        header_params.update(\n            {\n                \"flock\": flock_command,\n                \"flock_index\": 2,\n                \"link_commands\": LINK_COMMANDS_MAC,\n                \"extra_commands\": SHARED_HEADER_MAC_COMMANDS,\n            }\n        )\n    elif flavor == \"android\":\n        header_params.update({\"link_commands\": LINK_COMMANDS_ANDROID})\n    elif flavor == \"zos\":\n        copy_archive_arguments = \"-fPR\"\n        CC_target = GetEnvironFallback((\"CC_target\", \"CC\"), \"njsc\")\n        makedep_arguments = \"-MMD\"\n        if CC_target == \"clang\":\n            CC_host = GetEnvironFallback((\"CC_host\", \"CC\"), \"clang\")\n            CXX_target = GetEnvironFallback((\"CXX_target\", \"CXX\"), \"clang++\")\n            CXX_host = GetEnvironFallback((\"CXX_host\", \"CXX\"), \"clang++\")\n        elif CC_target == \"ibm-clang64\":\n            CC_host = GetEnvironFallback((\"CC_host\", \"CC\"), \"ibm-clang64\")\n            CXX_target = GetEnvironFallback((\"CXX_target\", \"CXX\"), \"ibm-clang++64\")\n            CXX_host = GetEnvironFallback((\"CXX_host\", \"CXX\"), \"ibm-clang++64\")\n        elif CC_target == \"ibm-clang\":\n            CC_host = GetEnvironFallback((\"CC_host\", \"CC\"), \"ibm-clang\")\n            CXX_target = GetEnvironFallback((\"CXX_target\", \"CXX\"), \"ibm-clang++\")\n            CXX_host = GetEnvironFallback((\"CXX_host\", \"CXX\"), \"ibm-clang++\")\n        else:\n            # Node.js versions prior to v18:\n            makedep_arguments = \"-qmakedep=gcc\"\n            CC_host = GetEnvironFallback((\"CC_host\", \"CC\"), \"njsc\")\n            CXX_target = GetEnvironFallback((\"CXX_target\", \"CXX\"), \"njsc++\")\n            CXX_host = GetEnvironFallback((\"CXX_host\", \"CXX\"), \"njsc++\")\n        header_params.update(\n            {\n                \"copy_archive_args\": copy_archive_arguments,\n                \"makedep_args\": makedep_arguments,\n                \"link_commands\": LINK_COMMANDS_OS390,\n                \"extra_commands\": SHARED_HEADER_OS390_COMMANDS,\n                \"CC.target\": CC_target,\n                \"CXX.target\": CXX_target,\n                \"CC.host\": CC_host,\n                \"CXX.host\": CXX_host,\n            }\n        )\n    elif flavor == \"solaris\":\n        copy_archive_arguments = \"-pPRf@\"\n        header_params.update(\n            {\n                \"copy_archive_args\": copy_archive_arguments,\n                \"flock\": \"%s gyp-flock-tool flock\" % sys.executable,\n                \"flock_index\": 2,\n            }\n        )\n    elif flavor == \"freebsd\":\n        # Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.\n        header_params.update({\"flock\": \"lockf\"})\n    elif flavor == \"openbsd\":\n        copy_archive_arguments = \"-pPRf\"\n        header_params.update({\"copy_archive_args\": copy_archive_arguments})\n    elif flavor == \"aix\":\n        copy_archive_arguments = \"-pPRf\"\n        header_params.update(\n            {\n                \"copy_archive_args\": copy_archive_arguments,\n                \"link_commands\": LINK_COMMANDS_AIX,\n                \"flock\": \"%s gyp-flock-tool flock\" % sys.executable,\n                \"flock_index\": 2,\n            }\n        )\n    elif flavor == \"os400\":\n        copy_archive_arguments = \"-pPRf\"\n        header_params.update(\n            {\n                \"copy_archive_args\": copy_archive_arguments,\n                \"link_commands\": LINK_COMMANDS_OS400,\n                \"flock\": \"%s gyp-flock-tool flock\" % sys.executable,\n                \"flock_index\": 2,\n            }\n        )\n\n    build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])\n    make_global_settings_array = data[build_file].get(\"make_global_settings\", [])\n    wrappers = {}\n    for key, value in make_global_settings_array:\n        if key.endswith(\"_wrapper\"):\n            wrappers[key[: -len(\"_wrapper\")]] = \"$(abspath %s)\" % value\n    make_global_settings = \"\"\n    for key, value in make_global_settings_array:\n        if re.match(\".*_wrapper\", key):\n            continue\n        if value[0] != \"$\":\n            value = \"$(abspath %s)\" % value\n        wrapper = wrappers.get(key)\n        if wrapper:\n            value = f\"{wrapper} {value}\"\n            del wrappers[key]\n        if key in (\"CC\", \"CC.host\", \"CXX\", \"CXX.host\"):\n            make_global_settings += (\n                \"ifneq (,$(filter $(origin %s), undefined default))\\n\" % key\n            )\n            # Let gyp-time envvars win over global settings.\n            env_key = key.replace(\".\", \"_\")  # CC.host -> CC_host\n            if env_key in os.environ:\n                value = os.environ[env_key]\n            make_global_settings += f\"  {key} = {value}\\n\"\n            make_global_settings += \"endif\\n\"\n        else:\n            make_global_settings += f\"{key} ?= {value}\\n\"\n    # TODO(ukai): define cmd when only wrapper is specified in\n    # make_global_settings.\n\n    header_params[\"make_global_settings\"] = make_global_settings\n\n    gyp.common.EnsureDirExists(makefile_path)\n    root_makefile = open(makefile_path, \"w\")\n    root_makefile.write(SHARED_HEADER % header_params)\n    # Currently any versions have the same effect, but in future the behavior\n    # could be different.\n    if android_ndk_version:\n        root_makefile.write(\n            \"# Define LOCAL_PATH for build of Android applications.\\n\"\n            \"LOCAL_PATH := $(call my-dir)\\n\"\n            \"\\n\"\n        )\n    for toolset in toolsets:\n        root_makefile.write(\"TOOLSET := %s\\n\" % toolset)\n        WriteRootHeaderSuffixRules(root_makefile)\n\n    # Put build-time support tools next to the root Makefile.\n    dest_path = os.path.dirname(makefile_path)\n    gyp.common.CopyTool(flavor, dest_path)\n\n    # Find the list of targets that derive from the gyp file(s) being built.\n    needed_targets = set()\n    for build_file in params[\"build_files\"]:\n        for target in gyp.common.AllTargets(target_list, target_dicts, build_file):\n            needed_targets.add(target)\n\n    build_files = set()\n    include_list = set()\n    for qualified_target in target_list:\n        build_file, target, toolset = gyp.common.ParseQualifiedTarget(qualified_target)\n\n        this_make_global_settings = data[build_file].get(\"make_global_settings\", [])\n        assert make_global_settings_array == this_make_global_settings, (\n            \"make_global_settings needs to be the same for all targets \"\n            f\"{this_make_global_settings} vs. {make_global_settings}\"\n        )\n\n        build_files.add(gyp.common.RelativePath(build_file, options.toplevel_dir))\n        included_files = data[build_file][\"included_files\"]\n        for included_file in included_files:\n            # The included_files entries are relative to the dir of the build file\n            # that included them, so we have to undo that and then make them relative\n            # to the root dir.\n            relative_include_file = gyp.common.RelativePath(\n                gyp.common.UnrelativePath(included_file, build_file),\n                options.toplevel_dir,\n            )\n            abs_include_file = os.path.abspath(relative_include_file)\n            # If the include file is from the ~/.gyp dir, we should use absolute path\n            # so that relocating the src dir doesn't break the path.\n            if params[\"home_dot_gyp\"] and abs_include_file.startswith(\n                params[\"home_dot_gyp\"]\n            ):\n                build_files.add(abs_include_file)\n            else:\n                build_files.add(relative_include_file)\n\n        base_path, output_file = CalculateMakefilePath(\n            build_file, target + \".\" + toolset + options.suffix + \".mk\"\n        )\n\n        spec = target_dicts[qualified_target]\n        configs = spec[\"configurations\"]\n\n        if flavor == \"mac\":\n            gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec)\n\n        writer = MakefileWriter(generator_flags, flavor)\n        writer.Write(\n            qualified_target,\n            base_path,\n            output_file,\n            spec,\n            configs,\n            part_of_all=qualified_target in needed_targets,\n        )\n\n        # Our root_makefile lives at the source root.  Compute the relative path\n        # from there to the output_file for including.\n        mkfile_rel_path = gyp.common.RelativePath(\n            output_file, os.path.dirname(makefile_path)\n        )\n        include_list.add(mkfile_rel_path)\n\n    # Write out per-gyp (sub-project) Makefiles.\n    depth_rel_path = gyp.common.RelativePath(options.depth, os.getcwd())\n    for build_file in build_files:\n        # The paths in build_files were relativized above, so undo that before\n        # testing against the non-relativized items in target_list and before\n        # calculating the Makefile path.\n        build_file = os.path.join(depth_rel_path, build_file)\n        gyp_targets = [\n            target_dicts[qualified_target][\"target_name\"]\n            for qualified_target in target_list\n            if qualified_target.startswith(build_file)\n            and qualified_target in needed_targets\n        ]\n        # Only generate Makefiles for gyp files with targets.\n        if not gyp_targets:\n            continue\n        base_path, output_file = CalculateMakefilePath(\n            build_file, os.path.splitext(os.path.basename(build_file))[0] + \".Makefile\"\n        )\n        makefile_rel_path = gyp.common.RelativePath(\n            os.path.dirname(makefile_path), os.path.dirname(output_file)\n        )\n        writer.WriteSubMake(output_file, makefile_rel_path, gyp_targets, builddir_name)\n\n    # Write out the sorted list of includes.\n    root_makefile.write(\"\\n\")\n    for include_file in sorted(include_list):\n        # We wrap each .mk include in an if statement so users can tell make to\n        # not load a file by setting NO_LOAD.  The below make code says, only\n        # load the .mk file if the .mk filename doesn't start with a token in\n        # NO_LOAD.\n        root_makefile.write(\n            \"ifeq ($(strip $(foreach prefix,$(NO_LOAD),\\\\\\n\"\n            \"    $(findstring $(join ^,$(prefix)),\\\\\\n\"\n            \"                 $(join ^,\" + include_file + \")))),)\\n\"\n        )\n        root_makefile.write(\"  include \" + include_file + \"\\n\")\n        root_makefile.write(\"endif\\n\")\n    root_makefile.write(\"\\n\")\n\n    if not generator_flags.get(\"standalone\") and generator_flags.get(\n        \"auto_regeneration\", True\n    ):\n        WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files)\n\n    root_makefile.write(SHARED_FOOTER)\n\n    root_makefile.close()\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/msvs.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\nimport ntpath\nimport os\nimport posixpath\nimport re\nimport subprocess\nimport sys\nfrom collections import OrderedDict\n\nimport gyp.common\nimport gyp.generator.ninja as ninja_generator\nfrom gyp import (\n    MSVSNew,\n    MSVSProject,\n    MSVSSettings,\n    MSVSToolFile,\n    MSVSUserFile,\n    MSVSUtil,\n    MSVSVersion,\n    easy_xml,\n)\nfrom gyp.common import GypError, OrderedSet\n\n# Regular expression for validating Visual Studio GUIDs.  If the GUID\n# contains lowercase hex letters, MSVS will be fine. However,\n# IncrediBuild BuildConsole will parse the solution file, but then\n# silently skip building the target causing hard to track down errors.\n# Note that this only happens with the BuildConsole, and does not occur\n# if IncrediBuild is executed from inside Visual Studio.  This regex\n# validates that the string looks like a GUID with all uppercase hex\n# letters.\nVALID_MSVS_GUID_CHARS = re.compile(r\"^[A-F0-9\\-]+$\")\n\ngenerator_supports_multiple_toolsets = gyp.common.CrossCompileRequested()\n\ngenerator_default_variables = {\n    \"DRIVER_PREFIX\": \"\",\n    \"DRIVER_SUFFIX\": \".sys\",\n    \"EXECUTABLE_PREFIX\": \"\",\n    \"EXECUTABLE_SUFFIX\": \".exe\",\n    \"STATIC_LIB_PREFIX\": \"\",\n    \"SHARED_LIB_PREFIX\": \"\",\n    \"STATIC_LIB_SUFFIX\": \".lib\",\n    \"SHARED_LIB_SUFFIX\": \".dll\",\n    \"INTERMEDIATE_DIR\": \"$(IntDir)\",\n    \"SHARED_INTERMEDIATE_DIR\": \"$(OutDir)/obj/global_intermediate\",\n    \"OS\": \"win\",\n    \"PRODUCT_DIR\": \"$(OutDir)\",\n    \"LIB_DIR\": \"$(OutDir)lib\",\n    \"RULE_INPUT_ROOT\": \"$(InputName)\",\n    \"RULE_INPUT_DIRNAME\": \"$(InputDir)\",\n    \"RULE_INPUT_EXT\": \"$(InputExt)\",\n    \"RULE_INPUT_NAME\": \"$(InputFileName)\",\n    \"RULE_INPUT_PATH\": \"$(InputPath)\",\n    \"CONFIGURATION_NAME\": \"$(ConfigurationName)\",\n}\n\n\n# The msvs specific sections that hold paths\ngenerator_additional_path_sections = [\n    \"msvs_cygwin_dirs\",\n    \"msvs_props\",\n]\n\n\ngenerator_additional_non_configuration_keys = [\n    \"msvs_cygwin_dirs\",\n    \"msvs_cygwin_shell\",\n    \"msvs_large_pdb\",\n    \"msvs_shard\",\n    \"msvs_external_builder\",\n    \"msvs_external_builder_out_dir\",\n    \"msvs_external_builder_build_cmd\",\n    \"msvs_external_builder_clean_cmd\",\n    \"msvs_external_builder_clcompile_cmd\",\n    \"msvs_enable_winrt\",\n    \"msvs_requires_importlibrary\",\n    \"msvs_enable_winphone\",\n    \"msvs_application_type_revision\",\n    \"msvs_target_platform_version\",\n    \"msvs_target_platform_minversion\",\n]\n\ngenerator_filelist_paths = None\n\n# List of precompiled header related keys.\nprecomp_keys = [\n    \"msvs_precompiled_header\",\n    \"msvs_precompiled_source\",\n]\n\n\ncached_username = None\n\n\ncached_domain = None\n\n\n# TODO(gspencer): Switch the os.environ calls to be\n# win32api.GetDomainName() and win32api.GetUserName() once the\n# python version in depot_tools has been updated to work on Vista\n# 64-bit.\ndef _GetDomainAndUserName():\n    if sys.platform not in (\"win32\", \"cygwin\"):\n        return (\"DOMAIN\", \"USERNAME\")\n    global cached_username\n    global cached_domain\n    if not cached_domain or not cached_username:\n        domain = os.environ.get(\"USERDOMAIN\")\n        username = os.environ.get(\"USERNAME\")\n        if not domain or not username:\n            call = subprocess.Popen(\n                [\"net\", \"config\", \"Workstation\"], stdout=subprocess.PIPE\n            )\n            config = call.communicate()[0].decode(\"utf-8\")\n            username_re = re.compile(r\"^User name\\s+(\\S+)\", re.MULTILINE)\n            username_match = username_re.search(config)\n            if username_match:\n                username = username_match.group(1)\n            domain_re = re.compile(r\"^Logon domain\\s+(\\S+)\", re.MULTILINE)\n            domain_match = domain_re.search(config)\n            if domain_match:\n                domain = domain_match.group(1)\n        cached_domain = domain\n        cached_username = username\n    return (cached_domain, cached_username)\n\n\nfixpath_prefix = None\n\n\ndef _NormalizedSource(source):\n    \"\"\"Normalize the path.\n\n    But not if that gets rid of a variable, as this may expand to something\n    larger than one directory.\n\n    Arguments:\n        source: The path to be normalize.d\n\n    Returns:\n        The normalized path.\n    \"\"\"\n    normalized = os.path.normpath(source)\n    if source.count(\"$\") == normalized.count(\"$\"):\n        source = normalized\n    return source\n\n\ndef _FixPath(path, separator=\"\\\\\"):\n    \"\"\"Convert paths to a form that will make sense in a vcproj file.\n\n    Arguments:\n      path: The path to convert, may contain / etc.\n    Returns:\n      The path with all slashes made into backslashes.\n    \"\"\"\n    if (\n        fixpath_prefix\n        and path\n        and not os.path.isabs(path)\n        and path[0] != \"$\"\n        and not _IsWindowsAbsPath(path)\n    ):\n        path = os.path.join(fixpath_prefix, path)\n    if separator == \"\\\\\":\n        path = path.replace(\"/\", \"\\\\\")\n    path = _NormalizedSource(path)\n    if separator == \"/\":\n        path = path.replace(\"\\\\\", \"/\")\n    if path and path[-1] == separator:\n        path = path[:-1]\n    return path\n\n\ndef _IsWindowsAbsPath(path):\n    \"\"\"\n    On Cygwin systems Python needs a little help determining if a path\n    is an absolute Windows path or not, so that\n    it does not treat those as relative, which results in bad paths like:\n    '..\\\\C:\\\\<some path>\\\\some_source_code_file.cc'\n    \"\"\"\n    return path.startswith((\"c:\", \"C:\"))\n\n\ndef _FixPaths(paths, separator=\"\\\\\"):\n    \"\"\"Fix each of the paths of the list.\"\"\"\n    return [_FixPath(i, separator) for i in paths]\n\n\ndef _ConvertSourcesToFilterHierarchy(\n    sources, prefix=None, excluded=None, list_excluded=True, msvs_version=None\n):\n    \"\"\"Converts a list split source file paths into a vcproj folder hierarchy.\n\n    Arguments:\n      sources: A list of source file paths split.\n      prefix: A list of source file path layers meant to apply to each of sources.\n      excluded: A set of excluded files.\n      msvs_version: A MSVSVersion object.\n\n    Returns:\n      A hierarchy of filenames and MSVSProject.Filter objects that matches the\n      layout of the source tree.\n      For example:\n      _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']],\n                                       prefix=['joe'])\n      -->\n      [MSVSProject.Filter('a', contents=['joe\\\\a\\\\bob1.c']),\n       MSVSProject.Filter('b', contents=['joe\\\\b\\\\bob2.c'])]\n    \"\"\"\n    if not prefix:\n        prefix = []\n    result = []\n    excluded_result = []\n    folders = OrderedDict()\n    # Gather files into the final result, excluded, or folders.\n    for s in sources:\n        if len(s) == 1:\n            filename = _NormalizedSource(\"\\\\\".join(prefix + s))\n            if filename in excluded:\n                excluded_result.append(filename)\n            else:\n                result.append(filename)\n        elif msvs_version and not msvs_version.UsesVcxproj():\n            # For MSVS 2008 and earlier, we need to process all files before walking\n            # the sub folders.\n            if not folders.get(s[0]):\n                folders[s[0]] = []\n            folders[s[0]].append(s[1:])\n        else:\n            contents = _ConvertSourcesToFilterHierarchy(\n                [s[1:]],\n                prefix + [s[0]],\n                excluded=excluded,\n                list_excluded=list_excluded,\n                msvs_version=msvs_version,\n            )\n            contents = MSVSProject.Filter(s[0], contents=contents)\n            result.append(contents)\n    # Add a folder for excluded files.\n    if excluded_result and list_excluded:\n        excluded_folder = MSVSProject.Filter(\n            \"_excluded_files\", contents=excluded_result\n        )\n        result.append(excluded_folder)\n\n    if msvs_version and msvs_version.UsesVcxproj():\n        return result\n\n    # Populate all the folders.\n    for f in folders:\n        contents = _ConvertSourcesToFilterHierarchy(\n            folders[f],\n            prefix=prefix + [f],\n            excluded=excluded,\n            list_excluded=list_excluded,\n            msvs_version=msvs_version,\n        )\n        contents = MSVSProject.Filter(f, contents=contents)\n        result.append(contents)\n    return result\n\n\ndef _ToolAppend(tools, tool_name, setting, value, only_if_unset=False):\n    if not value:\n        return\n    _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset)\n\n\ndef _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):\n    # TODO(bradnelson): ugly hack, fix this more generally!!!\n    if \"Directories\" in setting or \"Dependencies\" in setting:\n        if isinstance(value, str):\n            value = value.replace(\"/\", \"\\\\\")\n        else:\n            value = [i.replace(\"/\", \"\\\\\") for i in value]\n    if not tools.get(tool_name):\n        tools[tool_name] = {}\n    tool = tools[tool_name]\n    if setting == \"CompileAsWinRT\":\n        return\n    if tool.get(setting):\n        if only_if_unset:\n            return\n        if isinstance(tool[setting], list) and isinstance(value, list):\n            tool[setting] += value\n        else:\n            raise TypeError(\n                'Appending \"%s\" to a non-list setting \"%s\" for tool \"%s\" is '\n                \"not allowed, previous value: %s\"\n                % (value, setting, tool_name, str(tool[setting]))\n            )\n    else:\n        tool[setting] = value\n\n\ndef _ConfigTargetVersion(config_data):\n    return config_data.get(\"msvs_target_version\", \"Windows7\")\n\n\ndef _ConfigPlatform(config_data):\n    return config_data.get(\"msvs_configuration_platform\", \"Win32\")\n\n\ndef _ConfigBaseName(config_name, platform_name):\n    if config_name.endswith(\"_\" + platform_name):\n        return config_name[0 : -len(platform_name) - 1]\n    else:\n        return config_name\n\n\ndef _ConfigFullName(config_name, config_data):\n    platform_name = _ConfigPlatform(config_data)\n    return f\"{_ConfigBaseName(config_name, platform_name)}|{platform_name}\"\n\n\ndef _ConfigWindowsTargetPlatformVersion(config_data, version):\n    target_ver = config_data.get(\"msvs_windows_target_platform_version\")\n    if target_ver and re.match(r\"^\\d+\", target_ver):\n        return target_ver\n    config_ver = config_data.get(\"msvs_windows_sdk_version\")\n    vers = [config_ver] if config_ver else version.compatible_sdks\n    for ver in vers:\n        for key in [\n            r\"HKLM\\Software\\Microsoft\\Microsoft SDKs\\Windows\\%s\",\n            r\"HKLM\\Software\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\%s\",\n        ]:\n            sdk_dir = MSVSVersion._RegistryGetValue(key % ver, \"InstallationFolder\")\n            if not sdk_dir:\n                continue\n            version = MSVSVersion._RegistryGetValue(key % ver, \"ProductVersion\") or \"\"\n            # Find a matching entry in sdk_dir\\include.\n            expected_sdk_dir = r\"%s\\include\" % sdk_dir\n            names = sorted(\n                (\n                    x\n                    for x in (\n                        os.listdir(expected_sdk_dir)\n                        if os.path.isdir(expected_sdk_dir)\n                        else []\n                    )\n                    if x.startswith(version)\n                ),\n                reverse=True,\n            )\n            if names:\n                return names[0]\n            else:\n                print(\n                    \"Warning: No include files found for detected \"\n                    \"Windows SDK version %s\" % (version),\n                    file=sys.stdout,\n                )\n\n\ndef _BuildCommandLineForRuleRaw(\n    spec, cmd, cygwin_shell, has_input_path, quote_cmd, do_setup_env\n):\n    if [x for x in cmd if \"$(InputDir)\" in x]:\n        input_dir_preamble = (\n            \"set INPUTDIR=$(InputDir)\\n\"\n            \"if NOT DEFINED INPUTDIR set INPUTDIR=.\\\\\\n\"\n            \"set INPUTDIR=%INPUTDIR:~0,-1%\\n\"\n        )\n    else:\n        input_dir_preamble = \"\"\n\n    if cygwin_shell:\n        # Find path to cygwin.\n        cygwin_dir = _FixPath(spec.get(\"msvs_cygwin_dirs\", [\".\"])[0])\n        # Prepare command.\n        direct_cmd = cmd\n        direct_cmd = [\n            i.replace(\"$(IntDir)\", '`cygpath -m \"${INTDIR}\"`') for i in direct_cmd\n        ]\n        direct_cmd = [\n            i.replace(\"$(OutDir)\", '`cygpath -m \"${OUTDIR}\"`') for i in direct_cmd\n        ]\n        direct_cmd = [\n            i.replace(\"$(InputDir)\", '`cygpath -m \"${INPUTDIR}\"`') for i in direct_cmd\n        ]\n        if has_input_path:\n            direct_cmd = [\n                i.replace(\"$(InputPath)\", '`cygpath -m \"${INPUTPATH}\"`')\n                for i in direct_cmd\n            ]\n        direct_cmd = ['\\\\\"%s\\\\\"' % i.replace('\"', '\\\\\\\\\\\\\"') for i in direct_cmd]\n        # direct_cmd = gyp.common.EncodePOSIXShellList(direct_cmd)\n        direct_cmd = \" \".join(direct_cmd)\n        # TODO(quote):  regularize quoting path names throughout the module\n        cmd = \"\"\n        if do_setup_env:\n            cmd += 'call \"$(ProjectDir)%(cygwin_dir)s\\\\setup_env.bat\" && '\n        cmd += \"set CYGWIN=nontsec&& \"\n        if direct_cmd.find(\"NUMBER_OF_PROCESSORS\") >= 0:\n            cmd += \"set /a NUMBER_OF_PROCESSORS_PLUS_1=%%NUMBER_OF_PROCESSORS%%+1&& \"\n        if direct_cmd.find(\"INTDIR\") >= 0:\n            cmd += \"set INTDIR=$(IntDir)&& \"\n        if direct_cmd.find(\"OUTDIR\") >= 0:\n            cmd += \"set OUTDIR=$(OutDir)&& \"\n        if has_input_path and direct_cmd.find(\"INPUTPATH\") >= 0:\n            cmd += \"set INPUTPATH=$(InputPath) && \"\n        cmd += 'bash -c \"%(cmd)s\"'\n        cmd = cmd % {\"cygwin_dir\": cygwin_dir, \"cmd\": direct_cmd}\n        return input_dir_preamble + cmd\n    else:\n        # Convert cat --> type to mimic unix.\n        command = [\"type\"] if cmd[0] == \"cat\" else [cmd[0].replace(\"/\", \"\\\\\")]\n        # Add call before command to ensure that commands can be tied together one\n        # after the other without aborting in Incredibuild, since IB makes a bat\n        # file out of the raw command string, and some commands (like python) are\n        # actually batch files themselves.\n        command.insert(0, \"call\")\n        # Fix the paths\n        # TODO(quote): This is a really ugly heuristic, and will miss path fixing\n        #              for arguments like \"--arg=path\", arg=path, or \"/opt:path\".\n        # If the argument starts with a slash or dash, or contains an equal sign,\n        # it's probably a command line switch.\n        # Return the path with forward slashes because the command using it might\n        # not support backslashes.\n        arguments = [\n            i if (i[:1] in \"/-\" or \"=\" in i) else _FixPath(i, \"/\") for i in cmd[1:]\n        ]\n        arguments = [i.replace(\"$(InputDir)\", \"%INPUTDIR%\") for i in arguments]\n        arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments]\n        if quote_cmd:\n            # Support a mode for using cmd directly.\n            # Convert any paths to native form (first element is used directly).\n            # TODO(quote):  regularize quoting path names throughout the module\n            command[1] = '\"%s\"' % command[1]\n            arguments = ['\"%s\"' % i for i in arguments]\n        # Collapse into a single command.\n        return input_dir_preamble + \" \".join(command + arguments)\n\n\ndef _BuildCommandLineForRule(spec, rule, has_input_path, do_setup_env):\n    # Currently this weird argument munging is used to duplicate the way a\n    # python script would need to be run as part of the chrome tree.\n    # Eventually we should add some sort of rule_default option to set this\n    # per project. For now the behavior chrome needs is the default.\n    mcs = rule.get(\"msvs_cygwin_shell\")\n    if mcs is None:\n        mcs = int(spec.get(\"msvs_cygwin_shell\", 1))\n    elif isinstance(mcs, str):\n        mcs = int(mcs)\n    quote_cmd = int(rule.get(\"msvs_quote_cmd\", 1))\n    return _BuildCommandLineForRuleRaw(\n        spec, rule[\"action\"], mcs, has_input_path, quote_cmd, do_setup_env=do_setup_env\n    )\n\n\ndef _AddActionStep(actions_dict, inputs, outputs, description, command):\n    \"\"\"Merge action into an existing list of actions.\n\n    Care must be taken so that actions which have overlapping inputs either don't\n    get assigned to the same input, or get collapsed into one.\n\n    Arguments:\n      actions_dict: dictionary keyed on input name, which maps to a list of\n        dicts describing the actions attached to that input file.\n      inputs: list of inputs\n      outputs: list of outputs\n      description: description of the action\n      command: command line to execute\n    \"\"\"\n    # Require there to be at least one input (call sites will ensure this).\n    assert inputs\n\n    action = {\n        \"inputs\": inputs,\n        \"outputs\": outputs,\n        \"description\": description,\n        \"command\": command,\n    }\n\n    # Pick where to stick this action.\n    # While less than optimal in terms of build time, attach them to the first\n    # input for now.\n    chosen_input = inputs[0]\n\n    # Add it there.\n    if chosen_input not in actions_dict:\n        actions_dict[chosen_input] = []\n    actions_dict[chosen_input].append(action)\n\n\ndef _AddCustomBuildToolForMSVS(\n    p, spec, primary_input, inputs, outputs, description, cmd\n):\n    \"\"\"Add a custom build tool to execute something.\n\n    Arguments:\n      p: the target project\n      spec: the target project dict\n      primary_input: input file to attach the build tool to\n      inputs: list of inputs\n      outputs: list of outputs\n      description: description of the action\n      cmd: command line to execute\n    \"\"\"\n    inputs = _FixPaths(inputs)\n    outputs = _FixPaths(outputs)\n    tool = MSVSProject.Tool(\n        \"VCCustomBuildTool\",\n        {\n            \"Description\": description,\n            \"AdditionalDependencies\": \";\".join(inputs),\n            \"Outputs\": \";\".join(outputs),\n            \"CommandLine\": cmd,\n        },\n    )\n    # Add to the properties of primary input for each config.\n    for config_name, c_data in spec[\"configurations\"].items():\n        p.AddFileConfig(\n            _FixPath(primary_input), _ConfigFullName(config_name, c_data), tools=[tool]\n        )\n\n\ndef _AddAccumulatedActionsToMSVS(p, spec, actions_dict):\n    \"\"\"Add actions accumulated into an actions_dict, merging as needed.\n\n    Arguments:\n      p: the target project\n      spec: the target project dict\n      actions_dict: dictionary keyed on input name, which maps to a list of\n          dicts describing the actions attached to that input file.\n    \"\"\"\n    for primary_input in actions_dict:\n        inputs = OrderedSet()\n        outputs = OrderedSet()\n        descriptions = []\n        commands = []\n        for action in actions_dict[primary_input]:\n            inputs.update(OrderedSet(action[\"inputs\"]))\n            outputs.update(OrderedSet(action[\"outputs\"]))\n            descriptions.append(action[\"description\"])\n            commands.append(action[\"command\"])\n        # Add the custom build step for one input file.\n        description = \", and also \".join(descriptions)\n        command = \"\\r\\n\".join(commands)\n        _AddCustomBuildToolForMSVS(\n            p,\n            spec,\n            primary_input=primary_input,\n            inputs=inputs,\n            outputs=outputs,\n            description=description,\n            cmd=command,\n        )\n\n\ndef _RuleExpandPath(path, input_file):\n    \"\"\"Given the input file to which a rule applied, string substitute a path.\n\n    Arguments:\n      path: a path to string expand\n      input_file: the file to which the rule applied.\n    Returns:\n      The string substituted path.\n    \"\"\"\n    path = path.replace(\n        \"$(InputName)\", os.path.splitext(os.path.split(input_file)[1])[0]\n    )\n    path = path.replace(\"$(InputDir)\", os.path.dirname(input_file))\n    path = path.replace(\n        \"$(InputExt)\", os.path.splitext(os.path.split(input_file)[1])[1]\n    )\n    path = path.replace(\"$(InputFileName)\", os.path.split(input_file)[1])\n    path = path.replace(\"$(InputPath)\", input_file)\n    return path\n\n\ndef _FindRuleTriggerFiles(rule, sources):\n    \"\"\"Find the list of files which a particular rule applies to.\n\n    Arguments:\n      rule: the rule in question\n      sources: the set of all known source files for this project\n    Returns:\n      The list of sources that trigger a particular rule.\n    \"\"\"\n    return rule.get(\"rule_sources\", [])\n\n\ndef _RuleInputsAndOutputs(rule, trigger_file):\n    \"\"\"Find the inputs and outputs generated by a rule.\n\n    Arguments:\n      rule: the rule in question.\n      trigger_file: the main trigger for this rule.\n    Returns:\n      The pair of (inputs, outputs) involved in this rule.\n    \"\"\"\n    raw_inputs = _FixPaths(rule.get(\"inputs\", []))\n    raw_outputs = _FixPaths(rule.get(\"outputs\", []))\n    inputs = OrderedSet()\n    outputs = OrderedSet()\n    inputs.add(trigger_file)\n    for i in raw_inputs:\n        inputs.add(_RuleExpandPath(i, trigger_file))\n    for o in raw_outputs:\n        outputs.add(_RuleExpandPath(o, trigger_file))\n    return (inputs, outputs)\n\n\ndef _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options):\n    \"\"\"Generate a native rules file.\n\n    Arguments:\n      p: the target project\n      rules: the set of rules to include\n      output_dir: the directory in which the project/gyp resides\n      spec: the project dict\n      options: global generator options\n    \"\"\"\n    rules_filename = \"{}{}.rules\".format(spec[\"target_name\"], options.suffix)\n    rules_file = MSVSToolFile.Writer(\n        os.path.join(output_dir, rules_filename), spec[\"target_name\"]\n    )\n    # Add each rule.\n    for r in rules:\n        rule_name = r[\"rule_name\"]\n        rule_ext = r[\"extension\"]\n        inputs = _FixPaths(r.get(\"inputs\", []))\n        outputs = _FixPaths(r.get(\"outputs\", []))\n        # Skip a rule with no action and no inputs.\n        if \"action\" not in r and not r.get(\"rule_sources\", []):\n            continue\n        cmd = _BuildCommandLineForRule(spec, r, has_input_path=True, do_setup_env=True)\n        rules_file.AddCustomBuildRule(\n            name=rule_name,\n            description=r.get(\"message\", rule_name),\n            extensions=[rule_ext],\n            additional_dependencies=inputs,\n            outputs=outputs,\n            cmd=cmd,\n        )\n    # Write out rules file.\n    rules_file.WriteIfChanged()\n\n    # Add rules file to project.\n    p.AddToolFile(rules_filename)\n\n\ndef _Cygwinify(path):\n    path = path.replace(\"$(OutDir)\", \"$(OutDirCygwin)\")\n    path = path.replace(\"$(IntDir)\", \"$(IntDirCygwin)\")\n    return path\n\n\ndef _GenerateExternalRules(rules, output_dir, spec, sources, options, actions_to_add):\n    \"\"\"Generate an external makefile to do a set of rules.\n\n    Arguments:\n      rules: the list of rules to include\n      output_dir: path containing project and gyp files\n      spec: project specification data\n      sources: set of sources known\n      options: global generator options\n      actions_to_add: The list of actions we will add to.\n    \"\"\"\n    filename = \"{}_rules{}.mk\".format(spec[\"target_name\"], options.suffix)\n    mk_file = gyp.common.WriteOnDiff(os.path.join(output_dir, filename))\n    # Find cygwin style versions of some paths.\n    mk_file.write('OutDirCygwin:=$(shell cygpath -u \"$(OutDir)\")\\n')\n    mk_file.write('IntDirCygwin:=$(shell cygpath -u \"$(IntDir)\")\\n')\n    # Gather stuff needed to emit all: target.\n    all_inputs = OrderedSet()\n    all_outputs = OrderedSet()\n    all_output_dirs = OrderedSet()\n    first_outputs = []\n    for rule in rules:\n        trigger_files = _FindRuleTriggerFiles(rule, sources)\n        for tf in trigger_files:\n            inputs, outputs = _RuleInputsAndOutputs(rule, tf)\n            all_inputs.update(OrderedSet(inputs))\n            all_outputs.update(OrderedSet(outputs))\n            # Only use one target from each rule as the dependency for\n            # 'all' so we don't try to build each rule multiple times.\n            first_outputs.append(next(iter(outputs)))\n            # Get the unique output directories for this rule.\n            output_dirs = [os.path.split(i)[0] for i in outputs]\n            for od in output_dirs:\n                all_output_dirs.add(od)\n    first_outputs_cyg = [_Cygwinify(i) for i in first_outputs]\n    # Write out all: target, including mkdir for each output directory.\n    mk_file.write(\"all: %s\\n\" % \" \".join(first_outputs_cyg))\n    for od in all_output_dirs:\n        if od:\n            mk_file.write('\\tmkdir -p `cygpath -u \"%s\"`\\n' % od)\n    mk_file.write(\"\\n\")\n    # Define how each output is generated.\n    for rule in rules:\n        trigger_files = _FindRuleTriggerFiles(rule, sources)\n        for tf in trigger_files:\n            # Get all the inputs and outputs for this rule for this trigger file.\n            inputs, outputs = _RuleInputsAndOutputs(rule, tf)\n            inputs = [_Cygwinify(i) for i in inputs]\n            outputs = [_Cygwinify(i) for i in outputs]\n            # Prepare the command line for this rule.\n            cmd = [_RuleExpandPath(c, tf) for c in rule[\"action\"]]\n            cmd = ['\"%s\"' % i for i in cmd]\n            cmd = \" \".join(cmd)\n            # Add it to the makefile.\n            mk_file.write(\"{}: {}\\n\".format(\" \".join(outputs), \" \".join(inputs)))\n            mk_file.write(\"\\t%s\\n\\n\" % cmd)\n    # Close up the file.\n    mk_file.close()\n\n    # Add makefile to list of sources.\n    sources.add(filename)\n    # Add a build action to call makefile.\n    cmd = [\n        \"make\",\n        \"OutDir=$(OutDir)\",\n        \"IntDir=$(IntDir)\",\n        \"-j\",\n        \"${NUMBER_OF_PROCESSORS_PLUS_1}\",\n        \"-f\",\n        filename,\n    ]\n    cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True, True)\n    # Insert makefile as 0'th input, so it gets the action attached there,\n    # as this is easier to understand from in the IDE.\n    all_inputs = list(all_inputs)\n    all_inputs.insert(0, filename)\n    _AddActionStep(\n        actions_to_add,\n        inputs=_FixPaths(all_inputs),\n        outputs=_FixPaths(all_outputs),\n        description=\"Running external rules for %s\" % spec[\"target_name\"],\n        command=cmd,\n    )\n\n\ndef _EscapeEnvironmentVariableExpansion(s):\n    \"\"\"Escapes % characters.\n\n    Escapes any % characters so that Windows-style environment variable\n    expansions will leave them alone.\n    See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile\n    to understand why we have to do this.\n\n    Args:\n        s: The string to be escaped.\n\n    Returns:\n        The escaped string.\n    \"\"\"\n    s = s.replace(\"%\", \"%%\")\n    return s\n\n\nquote_replacer_regex = re.compile(r'(\\\\*)\"')\n\n\ndef _EscapeCommandLineArgumentForMSVS(s):\n    \"\"\"Escapes a Windows command-line argument.\n\n    So that the Win32 CommandLineToArgv function will turn the escaped result back\n    into the original string.\n    See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx\n    (\"Parsing C++ Command-Line Arguments\") to understand why we have to do\n    this.\n\n    Args:\n        s: the string to be escaped.\n    Returns:\n        the escaped string.\n    \"\"\"\n\n    def _Replace(match):\n        # For a literal quote, CommandLineToArgv requires an odd number of\n        # backslashes preceding it, and it produces half as many literal backslashes\n        # (rounded down). So we need to produce 2n+1 backslashes.\n        return 2 * match.group(1) + '\\\\\"'\n\n    # Escape all quotes so that they are interpreted literally.\n    s = quote_replacer_regex.sub(_Replace, s)\n    # Now add unescaped quotes so that any whitespace is interpreted literally.\n    s = '\"' + s + '\"'\n    return s\n\n\ndelimiters_replacer_regex = re.compile(r\"(\\\\*)([,;]+)\")\n\n\ndef _EscapeVCProjCommandLineArgListItem(s):\n    \"\"\"Escapes command line arguments for MSVS.\n\n    The VCProj format stores string lists in a single string using commas and\n    semi-colons as separators, which must be quoted if they are to be\n    interpreted literally. However, command-line arguments may already have\n    quotes, and the VCProj parser is ignorant of the backslash escaping\n    convention used by CommandLineToArgv, so the command-line quotes and the\n    VCProj quotes may not be the same quotes. So to store a general\n    command-line argument in a VCProj list, we need to parse the existing\n    quoting according to VCProj's convention and quote any delimiters that are\n    not already quoted by that convention. The quotes that we add will also be\n    seen by CommandLineToArgv, so if backslashes precede them then we also have\n    to escape those backslashes according to the CommandLineToArgv\n    convention.\n\n    Args:\n        s: the string to be escaped.\n    Returns:\n        the escaped string.\n    \"\"\"\n\n    def _Replace(match):\n        # For a non-literal quote, CommandLineToArgv requires an even number of\n        # backslashes preceding it, and it produces half as many literal\n        # backslashes. So we need to produce 2n backslashes.\n        return 2 * match.group(1) + '\"' + match.group(2) + '\"'\n\n    segments = s.split('\"')\n    # The unquoted segments are at the even-numbered indices.\n    for i in range(0, len(segments), 2):\n        segments[i] = delimiters_replacer_regex.sub(_Replace, segments[i])\n    # Concatenate back into a single string\n    s = '\"'.join(segments)\n    if len(segments) % 2 == 0:\n        # String ends while still quoted according to VCProj's convention. This\n        # means the delimiter and the next list item that follow this one in the\n        # .vcproj file will be misinterpreted as part of this item. There is nothing\n        # we can do about this. Adding an extra quote would correct the problem in\n        # the VCProj but cause the same problem on the final command-line. Moving\n        # the item to the end of the list does works, but that's only possible if\n        # there's only one such item. Let's just warn the user.\n        print(\n            \"Warning: MSVS may misinterpret the odd number of \" + \"quotes in \" + s,\n            file=sys.stderr,\n        )\n    return s\n\n\ndef _EscapeCppDefineForMSVS(s):\n    \"\"\"Escapes a CPP define so that it will reach the compiler unaltered.\"\"\"\n    s = _EscapeEnvironmentVariableExpansion(s)\n    s = _EscapeCommandLineArgumentForMSVS(s)\n    s = _EscapeVCProjCommandLineArgListItem(s)\n    # cl.exe replaces literal # characters with = in preprocessor definitions for\n    # some reason. Octal-encode to work around that.\n    s = s.replace(\"#\", \"\\\\%03o\" % ord(\"#\"))\n    return s\n\n\nquote_replacer_regex2 = re.compile(r'(\\\\+)\"')\n\n\ndef _EscapeCommandLineArgumentForMSBuild(s):\n    \"\"\"Escapes a Windows command-line argument for use by MSBuild.\"\"\"\n\n    def _Replace(match):\n        return (len(match.group(1)) / 2 * 4) * \"\\\\\" + '\\\\\"'\n\n    # Escape all quotes so that they are interpreted literally.\n    s = quote_replacer_regex2.sub(_Replace, s)\n    return s\n\n\ndef _EscapeMSBuildSpecialCharacters(s):\n    escape_dictionary = {\n        \"%\": \"%25\",\n        \"$\": \"%24\",\n        \"@\": \"%40\",\n        \"'\": \"%27\",\n        \";\": \"%3B\",\n        \"?\": \"%3F\",\n        \"*\": \"%2A\",\n    }\n    result = \"\".join([escape_dictionary.get(c, c) for c in s])\n    return result\n\n\ndef _EscapeCppDefineForMSBuild(s):\n    \"\"\"Escapes a CPP define so that it will reach the compiler unaltered.\"\"\"\n    s = _EscapeEnvironmentVariableExpansion(s)\n    s = _EscapeCommandLineArgumentForMSBuild(s)\n    s = _EscapeMSBuildSpecialCharacters(s)\n    # cl.exe replaces literal # characters with = in preprocessor definitions for\n    # some reason. Octal-encode to work around that.\n    s = s.replace(\"#\", \"\\\\%03o\" % ord(\"#\"))\n    return s\n\n\ndef _GenerateRulesForMSVS(\n    p, output_dir, options, spec, sources, excluded_sources, actions_to_add\n):\n    \"\"\"Generate all the rules for a particular project.\n\n    Arguments:\n      p: the project\n      output_dir: directory to emit rules to\n      options: global options passed to the generator\n      spec: the specification for this project\n      sources: the set of all known source files in this project\n      excluded_sources: the set of sources excluded from normal processing\n      actions_to_add: deferred list of actions to add in\n    \"\"\"\n    rules = spec.get(\"rules\", [])\n    rules_native = [r for r in rules if not int(r.get(\"msvs_external_rule\", 0))]\n    rules_external = [r for r in rules if int(r.get(\"msvs_external_rule\", 0))]\n\n    # Handle rules that use a native rules file.\n    if rules_native:\n        _GenerateNativeRulesForMSVS(p, rules_native, output_dir, spec, options)\n\n    # Handle external rules (non-native rules).\n    if rules_external:\n        _GenerateExternalRules(\n            rules_external, output_dir, spec, sources, options, actions_to_add\n        )\n    _AdjustSourcesForRules(rules, sources, excluded_sources, False)\n\n\ndef _AdjustSourcesForRules(rules, sources, excluded_sources, is_msbuild):\n    # Add outputs generated by each rule (if applicable).\n    for rule in rules:\n        # Add in the outputs from this rule.\n        trigger_files = _FindRuleTriggerFiles(rule, sources)\n        for trigger_file in trigger_files:\n            # Remove trigger_file from excluded_sources to let the rule be triggered\n            # (e.g. rule trigger ax_enums.idl is added to excluded_sources\n            # because it's also in an action's inputs in the same project)\n            excluded_sources.discard(_FixPath(trigger_file))\n            # Done if not processing outputs as sources.\n            if int(rule.get(\"process_outputs_as_sources\", False)):\n                inputs, outputs = _RuleInputsAndOutputs(rule, trigger_file)\n                inputs = OrderedSet(_FixPaths(inputs))\n                outputs = OrderedSet(_FixPaths(outputs))\n                inputs.remove(_FixPath(trigger_file))\n                sources.update(inputs)\n                if not is_msbuild:\n                    excluded_sources.update(inputs)\n                sources.update(outputs)\n\n\ndef _FilterActionsFromExcluded(excluded_sources, actions_to_add):\n    \"\"\"Take inputs with actions attached out of the list of exclusions.\n\n    Arguments:\n      excluded_sources: list of source files not to be built.\n      actions_to_add: dict of actions keyed on source file they're attached to.\n    Returns:\n      excluded_sources with files that have actions attached removed.\n    \"\"\"\n    must_keep = OrderedSet(_FixPaths(actions_to_add.keys()))\n    return [s for s in excluded_sources if s not in must_keep]\n\n\ndef _GetDefaultConfiguration(spec):\n    return spec[\"configurations\"][spec[\"default_configuration\"]]\n\n\ndef _GetGuidOfProject(proj_path, spec):\n    \"\"\"Get the guid for the project.\n\n    Arguments:\n      proj_path: Path of the vcproj or vcxproj file to generate.\n      spec: The target dictionary containing the properties of the target.\n    Returns:\n      the guid.\n    Raises:\n      ValueError: if the specified GUID is invalid.\n    \"\"\"\n    # Pluck out the default configuration.\n    default_config = _GetDefaultConfiguration(spec)\n    # Decide the guid of the project.\n    guid = default_config.get(\"msvs_guid\")\n    if guid:\n        if VALID_MSVS_GUID_CHARS.match(guid) is None:\n            raise ValueError(\n                'Invalid MSVS guid: \"%s\".  Must match regex: \"%s\".'\n                % (guid, VALID_MSVS_GUID_CHARS.pattern)\n            )\n        guid = \"{%s}\" % guid\n    guid = guid or MSVSNew.MakeGuid(proj_path)\n    return guid\n\n\ndef _GetMsbuildToolsetOfProject(proj_path, spec, version):\n    \"\"\"Get the platform toolset for the project.\n\n    Arguments:\n      proj_path: Path of the vcproj or vcxproj file to generate.\n      spec: The target dictionary containing the properties of the target.\n      version: The MSVSVersion object.\n    Returns:\n      the platform toolset string or None.\n    \"\"\"\n    # Pluck out the default configuration.\n    default_config = _GetDefaultConfiguration(spec)\n    toolset = default_config.get(\"msbuild_toolset\")\n    if not toolset and version.DefaultToolset():\n        toolset = version.DefaultToolset()\n    if spec[\"type\"] == \"windows_driver\":\n        toolset = \"WindowsKernelModeDriver10.0\"\n    return toolset\n\n\ndef _GenerateProject(project, options, version, generator_flags, spec):\n    \"\"\"Generates a vcproj file.\n\n    Arguments:\n      project: the MSVSProject object.\n      options: global generator options.\n      version: the MSVSVersion object.\n      generator_flags: dict of generator-specific flags.\n    Returns:\n      A list of source files that cannot be found on disk.\n    \"\"\"\n    default_config = _GetDefaultConfiguration(project.spec)\n\n    # Skip emitting anything if told to with msvs_existing_vcproj option.\n    if default_config.get(\"msvs_existing_vcproj\"):\n        return []\n\n    if version.UsesVcxproj():\n        return _GenerateMSBuildProject(project, options, version, generator_flags, spec)\n    else:\n        return _GenerateMSVSProject(project, options, version, generator_flags)\n\n\ndef _GenerateMSVSProject(project, options, version, generator_flags):\n    \"\"\"Generates a .vcproj file.  It may create .rules and .user files too.\n\n    Arguments:\n      project: The project object we will generate the file for.\n      options: Global options passed to the generator.\n      version: The VisualStudioVersion object.\n      generator_flags: dict of generator-specific flags.\n    \"\"\"\n    spec = project.spec\n    gyp.common.EnsureDirExists(project.path)\n\n    platforms = _GetUniquePlatforms(spec)\n    p = MSVSProject.Writer(\n        project.path, version, spec[\"target_name\"], project.guid, platforms\n    )\n\n    # Get directory project file is in.\n    project_dir = os.path.split(project.path)[0]\n    gyp_path = _NormalizedSource(project.build_file)\n    relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir)\n\n    config_type = _GetMSVSConfigurationType(spec, project.build_file)\n    for config_name, config in spec[\"configurations\"].items():\n        _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config)\n\n    # Prepare list of sources and excluded sources.\n    gyp_file = os.path.split(project.build_file)[1]\n    sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, gyp_file)\n\n    # Add rules.\n    actions_to_add = {}\n    _GenerateRulesForMSVS(\n        p, project_dir, options, spec, sources, excluded_sources, actions_to_add\n    )\n    list_excluded = generator_flags.get(\"msvs_list_excluded_files\", True)\n    sources, excluded_sources, excluded_idl = _AdjustSourcesAndConvertToFilterHierarchy(\n        spec, options, project_dir, sources, excluded_sources, list_excluded, version\n    )\n\n    # Add in files.\n    missing_sources = _VerifySourcesExist(sources, project_dir)\n    p.AddFiles(sources)\n\n    _AddToolFilesToMSVS(p, spec)\n    _HandlePreCompiledHeaders(p, sources, spec)\n    _AddActions(actions_to_add, spec, relative_path_of_gyp_file)\n    _AddCopies(actions_to_add, spec)\n    _WriteMSVSUserFile(project.path, version, spec)\n\n    # NOTE: this stanza must appear after all actions have been decided.\n    # Don't excluded sources with actions attached, or they won't run.\n    excluded_sources = _FilterActionsFromExcluded(excluded_sources, actions_to_add)\n    _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl, list_excluded)\n    _AddAccumulatedActionsToMSVS(p, spec, actions_to_add)\n\n    # Write it out.\n    p.WriteIfChanged()\n\n    return missing_sources\n\n\ndef _GetUniquePlatforms(spec):\n    \"\"\"Returns the list of unique platforms for this spec, e.g ['win32', ...].\n\n    Arguments:\n      spec: The target dictionary containing the properties of the target.\n    Returns:\n      The MSVSUserFile object created.\n    \"\"\"\n    # Gather list of unique platforms.\n    platforms = OrderedSet()\n    for configuration in spec[\"configurations\"]:\n        platforms.add(_ConfigPlatform(spec[\"configurations\"][configuration]))\n    platforms = list(platforms)\n    return platforms\n\n\ndef _CreateMSVSUserFile(proj_path, version, spec):\n    \"\"\"Generates a .user file for the user running this Gyp program.\n\n    Arguments:\n      proj_path: The path of the project file being created.  The .user file\n                 shares the same path (with an appropriate suffix).\n      version: The VisualStudioVersion object.\n      spec: The target dictionary containing the properties of the target.\n    Returns:\n      The MSVSUserFile object created.\n    \"\"\"\n    (domain, username) = _GetDomainAndUserName()\n    vcuser_filename = \".\".join([proj_path, domain, username, \"user\"])\n    user_file = MSVSUserFile.Writer(vcuser_filename, version, spec[\"target_name\"])\n    return user_file\n\n\ndef _GetMSVSConfigurationType(spec, build_file):\n    \"\"\"Returns the configuration type for this project.\n\n    It's a number defined by Microsoft.  May raise an exception.\n\n    Args:\n        spec: The target dictionary containing the properties of the target.\n        build_file: The path of the gyp file.\n    Returns:\n        An integer, the configuration type.\n    \"\"\"\n    try:\n        config_type = {\n            \"executable\": \"1\",  # .exe\n            \"shared_library\": \"2\",  # .dll\n            \"loadable_module\": \"2\",  # .dll\n            \"static_library\": \"4\",  # .lib\n            \"windows_driver\": \"5\",  # .sys\n            \"none\": \"10\",  # Utility type\n        }[spec[\"type\"]]\n    except KeyError:\n        if spec.get(\"type\"):\n            raise GypError(\n                \"Target type %s is not a valid target type for \"\n                \"target %s in %s.\" % (spec[\"type\"], spec[\"target_name\"], build_file)\n            )\n        else:\n            raise GypError(\n                \"Missing type field for target %s in %s.\"\n                % (spec[\"target_name\"], build_file)\n            )\n    return config_type\n\n\ndef _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config):\n    \"\"\"Adds a configuration to the MSVS project.\n\n    Many settings in a vcproj file are specific to a configuration.  This\n    function the main part of the vcproj file that's configuration specific.\n\n    Arguments:\n      p: The target project being generated.\n      spec: The target dictionary containing the properties of the target.\n      config_type: The configuration type, a number as defined by Microsoft.\n      config_name: The name of the configuration.\n      config: The dictionary that defines the special processing to be done\n              for this configuration.\n    \"\"\"\n    # Get the information for this configuration\n    include_dirs, midl_include_dirs, resource_include_dirs = _GetIncludeDirs(config)\n    libraries = _GetLibraries(spec)\n    library_dirs = _GetLibraryDirs(config)\n    out_file, vc_tool, _ = _GetOutputFilePathAndTool(spec, msbuild=False)\n    defines = _GetDefines(config)\n    defines = [_EscapeCppDefineForMSVS(d) for d in defines]\n    disabled_warnings = _GetDisabledWarnings(config)\n    prebuild = config.get(\"msvs_prebuild\")\n    postbuild = config.get(\"msvs_postbuild\")\n    def_file = _GetModuleDefinition(spec)\n    precompiled_header = config.get(\"msvs_precompiled_header\")\n\n    # Prepare the list of tools as a dictionary.\n    tools = {}\n    # Add in user specified msvs_settings.\n    msvs_settings = config.get(\"msvs_settings\", {})\n    MSVSSettings.ValidateMSVSSettings(msvs_settings)\n\n    # Prevent default library inheritance from the environment.\n    _ToolAppend(tools, \"VCLinkerTool\", \"AdditionalDependencies\", [\"$(NOINHERIT)\"])\n\n    for tool in msvs_settings:\n        settings = config[\"msvs_settings\"][tool]\n        for setting in settings:\n            _ToolAppend(tools, tool, setting, settings[setting])\n    # Add the information to the appropriate tool\n    _ToolAppend(tools, \"VCCLCompilerTool\", \"AdditionalIncludeDirectories\", include_dirs)\n    _ToolAppend(tools, \"VCMIDLTool\", \"AdditionalIncludeDirectories\", midl_include_dirs)\n    _ToolAppend(\n        tools,\n        \"VCResourceCompilerTool\",\n        \"AdditionalIncludeDirectories\",\n        resource_include_dirs,\n    )\n    # Add in libraries.\n    _ToolAppend(tools, \"VCLinkerTool\", \"AdditionalDependencies\", libraries)\n    _ToolAppend(tools, \"VCLinkerTool\", \"AdditionalLibraryDirectories\", library_dirs)\n    if out_file:\n        _ToolAppend(tools, vc_tool, \"OutputFile\", out_file, only_if_unset=True)\n    # Add defines.\n    _ToolAppend(tools, \"VCCLCompilerTool\", \"PreprocessorDefinitions\", defines)\n    _ToolAppend(tools, \"VCResourceCompilerTool\", \"PreprocessorDefinitions\", defines)\n    # Change program database directory to prevent collisions.\n    _ToolAppend(\n        tools,\n        \"VCCLCompilerTool\",\n        \"ProgramDataBaseFileName\",\n        \"$(IntDir)$(ProjectName)\\\\vc80.pdb\",\n        only_if_unset=True,\n    )\n    # Add disabled warnings.\n    _ToolAppend(tools, \"VCCLCompilerTool\", \"DisableSpecificWarnings\", disabled_warnings)\n    # Add Pre-build.\n    _ToolAppend(tools, \"VCPreBuildEventTool\", \"CommandLine\", prebuild)\n    # Add Post-build.\n    _ToolAppend(tools, \"VCPostBuildEventTool\", \"CommandLine\", postbuild)\n    # Turn on precompiled headers if appropriate.\n    if precompiled_header:\n        precompiled_header = os.path.split(precompiled_header)[1]\n        _ToolAppend(tools, \"VCCLCompilerTool\", \"UsePrecompiledHeader\", \"2\")\n        _ToolAppend(\n            tools, \"VCCLCompilerTool\", \"PrecompiledHeaderThrough\", precompiled_header\n        )\n        _ToolAppend(tools, \"VCCLCompilerTool\", \"ForcedIncludeFiles\", precompiled_header)\n    # Loadable modules don't generate import libraries;\n    # tell dependent projects to not expect one.\n    if spec[\"type\"] == \"loadable_module\":\n        _ToolAppend(tools, \"VCLinkerTool\", \"IgnoreImportLibrary\", \"true\")\n    # Set the module definition file if any.\n    if def_file:\n        _ToolAppend(tools, \"VCLinkerTool\", \"ModuleDefinitionFile\", def_file)\n\n    _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name)\n\n\ndef _GetIncludeDirs(config):\n    \"\"\"Returns the list of directories to be used for #include directives.\n\n    Arguments:\n      config: The dictionary that defines the special processing to be done\n              for this configuration.\n    Returns:\n      The list of directory paths.\n    \"\"\"\n    # TODO(bradnelson): include_dirs should really be flexible enough not to\n    #                   require this sort of thing.\n    include_dirs = config.get(\"include_dirs\", []) + config.get(\n        \"msvs_system_include_dirs\", []\n    )\n    midl_include_dirs = config.get(\"midl_include_dirs\", []) + config.get(\n        \"msvs_system_include_dirs\", []\n    )\n    resource_include_dirs = config.get(\"resource_include_dirs\", include_dirs)\n    include_dirs = _FixPaths(include_dirs)\n    midl_include_dirs = _FixPaths(midl_include_dirs)\n    resource_include_dirs = _FixPaths(resource_include_dirs)\n    return include_dirs, midl_include_dirs, resource_include_dirs\n\n\ndef _GetLibraryDirs(config):\n    \"\"\"Returns the list of directories to be used for library search paths.\n\n    Arguments:\n      config: The dictionary that defines the special processing to be done\n              for this configuration.\n    Returns:\n      The list of directory paths.\n    \"\"\"\n\n    library_dirs = config.get(\"library_dirs\", [])\n    library_dirs = _FixPaths(library_dirs)\n    return library_dirs\n\n\ndef _GetLibraries(spec):\n    \"\"\"Returns the list of libraries for this configuration.\n\n    Arguments:\n      spec: The target dictionary containing the properties of the target.\n    Returns:\n      The list of directory paths.\n    \"\"\"\n    libraries = spec.get(\"libraries\", [])\n    # Strip out -l, as it is not used on windows (but is needed so we can pass\n    # in libraries that are assumed to be in the default library path).\n    # Also remove duplicate entries, leaving only the last duplicate, while\n    # preserving order.\n    found = OrderedSet()\n    unique_libraries_list = []\n    for entry in reversed(libraries):\n        library = re.sub(r\"^\\-l\", \"\", entry)\n        if not os.path.splitext(library)[1]:\n            library += \".lib\"\n        if library not in found:\n            found.add(library)\n            unique_libraries_list.append(library)\n    unique_libraries_list.reverse()\n    return unique_libraries_list\n\n\ndef _GetOutputFilePathAndTool(spec, msbuild):\n    \"\"\"Returns the path and tool to use for this target.\n\n    Figures out the path of the file this spec will create and the name of\n    the VC tool that will create it.\n\n    Arguments:\n      spec: The target dictionary containing the properties of the target.\n    Returns:\n      A triple of (file path, name of the vc tool, name of the msbuild tool)\n    \"\"\"\n    # Select a name for the output file.\n    out_file = \"\"\n    vc_tool = \"\"\n    msbuild_tool = \"\"\n    output_file_map = {\n        \"executable\": (\"VCLinkerTool\", \"Link\", \"$(OutDir)\", \".exe\"),\n        \"shared_library\": (\"VCLinkerTool\", \"Link\", \"$(OutDir)\", \".dll\"),\n        \"loadable_module\": (\"VCLinkerTool\", \"Link\", \"$(OutDir)\", \".dll\"),\n        \"windows_driver\": (\"VCLinkerTool\", \"Link\", \"$(OutDir)\", \".sys\"),\n        \"static_library\": (\"VCLibrarianTool\", \"Lib\", \"$(OutDir)lib\\\\\", \".lib\"),\n    }\n    output_file_props = output_file_map.get(spec[\"type\"])\n    if output_file_props and int(spec.get(\"msvs_auto_output_file\", 1)):\n        vc_tool, msbuild_tool, out_dir, suffix = output_file_props\n        if spec.get(\"standalone_static_library\", 0):\n            out_dir = \"$(OutDir)\"\n        out_dir = spec.get(\"product_dir\", out_dir)\n        product_extension = spec.get(\"product_extension\")\n        if product_extension:\n            suffix = \".\" + product_extension\n        elif msbuild:\n            suffix = \"$(TargetExt)\"\n        prefix = spec.get(\"product_prefix\", \"\")\n        product_name = spec.get(\"product_name\", \"$(ProjectName)\")\n        out_file = ntpath.join(out_dir, prefix + product_name + suffix)\n    return out_file, vc_tool, msbuild_tool\n\n\ndef _GetOutputTargetExt(spec):\n    \"\"\"Returns the extension for this target, including the dot\n\n    If product_extension is specified, set target_extension to this to avoid\n    MSB8012, returns None otherwise. Ignores any target_extension settings in\n    the input files.\n\n    Arguments:\n      spec: The target dictionary containing the properties of the target.\n    Returns:\n      A string with the extension, or None\n    \"\"\"\n    if target_extension := spec.get(\"product_extension\"):\n        return \".\" + target_extension\n    return None\n\n\ndef _GetDefines(config):\n    \"\"\"Returns the list of preprocessor definitions for this configuration.\n\n    Arguments:\n      config: The dictionary that defines the special processing to be done\n              for this configuration.\n    Returns:\n      The list of preprocessor definitions.\n    \"\"\"\n    defines = []\n    for d in config.get(\"defines\", []):\n        fd = \"=\".join([str(dpart) for dpart in d]) if isinstance(d, list) else str(d)\n        defines.append(fd)\n    return defines\n\n\ndef _GetDisabledWarnings(config):\n    return [str(i) for i in config.get(\"msvs_disabled_warnings\", [])]\n\n\ndef _GetModuleDefinition(spec):\n    def_file = \"\"\n    if spec[\"type\"] in [\n        \"shared_library\",\n        \"loadable_module\",\n        \"executable\",\n        \"windows_driver\",\n    ]:\n        def_files = [s for s in spec.get(\"sources\", []) if s.endswith(\".def\")]\n        if len(def_files) == 1:\n            def_file = _FixPath(def_files[0])\n        elif def_files:\n            raise ValueError(\n                \"Multiple module definition files in one target, target %s lists \"\n                \"multiple .def files: %s\" % (spec[\"target_name\"], \" \".join(def_files))\n            )\n    return def_file\n\n\ndef _ConvertToolsToExpectedForm(tools):\n    \"\"\"Convert tools to a form expected by Visual Studio.\n\n    Arguments:\n      tools: A dictionary of settings; the tool name is the key.\n    Returns:\n      A list of Tool objects.\n    \"\"\"\n    tool_list = []\n    for tool, settings in tools.items():\n        # Collapse settings with lists.\n        settings_fixed = {}\n        for setting, value in settings.items():\n            if isinstance(value, list):\n                if (\n                    tool == \"VCLinkerTool\" and setting == \"AdditionalDependencies\"\n                ) or setting == \"AdditionalOptions\":\n                    settings_fixed[setting] = \" \".join(value)\n                else:\n                    settings_fixed[setting] = \";\".join(value)\n            else:\n                settings_fixed[setting] = value\n        # Add in this tool.\n        tool_list.append(MSVSProject.Tool(tool, settings_fixed))\n    return tool_list\n\n\ndef _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name):\n    \"\"\"Add to the project file the configuration specified by config.\n\n    Arguments:\n      p: The target project being generated.\n      spec: the target project dict.\n      tools: A dictionary of settings; the tool name is the key.\n      config: The dictionary that defines the special processing to be done\n              for this configuration.\n      config_type: The configuration type, a number as defined by Microsoft.\n      config_name: The name of the configuration.\n    \"\"\"\n    attributes = _GetMSVSAttributes(spec, config, config_type)\n    # Add in this configuration.\n    tool_list = _ConvertToolsToExpectedForm(tools)\n    p.AddConfig(_ConfigFullName(config_name, config), attrs=attributes, tools=tool_list)\n\n\ndef _GetMSVSAttributes(spec, config, config_type):\n    # Prepare configuration attributes.\n    prepared_attrs = {}\n    source_attrs = config.get(\"msvs_configuration_attributes\", {})\n    for a in source_attrs:\n        prepared_attrs[a] = source_attrs[a]\n    # Add props files.\n    vsprops_dirs = config.get(\"msvs_props\", [])\n    vsprops_dirs = _FixPaths(vsprops_dirs)\n    if vsprops_dirs:\n        prepared_attrs[\"InheritedPropertySheets\"] = \";\".join(vsprops_dirs)\n    # Set configuration type.\n    prepared_attrs[\"ConfigurationType\"] = config_type\n    output_dir = prepared_attrs.get(\n        \"OutputDirectory\", \"$(SolutionDir)$(ConfigurationName)\"\n    )\n    prepared_attrs[\"OutputDirectory\"] = _FixPath(output_dir) + \"\\\\\"\n    if \"IntermediateDirectory\" not in prepared_attrs:\n        intermediate = \"$(ConfigurationName)\\\\obj\\\\$(ProjectName)\"\n        prepared_attrs[\"IntermediateDirectory\"] = _FixPath(intermediate) + \"\\\\\"\n    else:\n        intermediate = _FixPath(prepared_attrs[\"IntermediateDirectory\"]) + \"\\\\\"\n        intermediate = MSVSSettings.FixVCMacroSlashes(intermediate)\n        prepared_attrs[\"IntermediateDirectory\"] = intermediate\n    return prepared_attrs\n\n\ndef _AddNormalizedSources(sources_set, sources_array):\n    sources_set.update(_NormalizedSource(s) for s in sources_array)\n\n\ndef _PrepareListOfSources(spec, generator_flags, gyp_file):\n    \"\"\"Prepare list of sources and excluded sources.\n\n    Besides the sources specified directly in the spec, adds the gyp file so\n    that a change to it will cause a re-compile. Also adds appropriate sources\n    for actions and copies. Assumes later stage will un-exclude files which\n    have custom build steps attached.\n\n    Arguments:\n      spec: The target dictionary containing the properties of the target.\n      gyp_file: The name of the gyp file.\n    Returns:\n      A pair of (list of sources, list of excluded sources).\n      The sources will be relative to the gyp file.\n    \"\"\"\n    sources = OrderedSet()\n    _AddNormalizedSources(sources, spec.get(\"sources\", []))\n    excluded_sources = OrderedSet()\n    # Add in the gyp file.\n    if not generator_flags.get(\"standalone\"):\n        sources.add(gyp_file)\n\n    # Add in 'action' inputs and outputs.\n    for a in spec.get(\"actions\", []):\n        inputs = a[\"inputs\"]\n        inputs = [_NormalizedSource(i) for i in inputs]\n        # Add all inputs to sources and excluded sources.\n        inputs = OrderedSet(inputs)\n        sources.update(inputs)\n        if not spec.get(\"msvs_external_builder\"):\n            excluded_sources.update(inputs)\n        if int(a.get(\"process_outputs_as_sources\", False)):\n            _AddNormalizedSources(sources, a.get(\"outputs\", []))\n    # Add in 'copies' inputs and outputs.\n    for cpy in spec.get(\"copies\", []):\n        _AddNormalizedSources(sources, cpy.get(\"files\", []))\n    return (sources, excluded_sources)\n\n\ndef _AdjustSourcesAndConvertToFilterHierarchy(\n    spec, options, gyp_dir, sources, excluded_sources, list_excluded, version\n):\n    \"\"\"Adjusts the list of sources and excluded sources.\n\n    Also converts the sets to lists.\n\n    Arguments:\n      spec: The target dictionary containing the properties of the target.\n      options: Global generator options.\n      gyp_dir: The path to the gyp file being processed.\n      sources: A set of sources to be included for this project.\n      excluded_sources: A set of sources to be excluded for this project.\n      version: A MSVSVersion object.\n    Returns:\n      A trio of (list of sources, list of excluded sources,\n                 path of excluded IDL file)\n    \"\"\"\n    # Exclude excluded sources coming into the generator.\n    excluded_sources.update(OrderedSet(spec.get(\"sources_excluded\", [])))\n    # Add excluded sources into sources for good measure.\n    sources.update(excluded_sources)\n    # Convert to proper windows form.\n    # NOTE: sources goes from being a set to a list here.\n    # NOTE: excluded_sources goes from being a set to a list here.\n    sources = _FixPaths(sources)\n    # Convert to proper windows form.\n    excluded_sources = _FixPaths(excluded_sources)\n\n    excluded_idl = _IdlFilesHandledNonNatively(spec, sources)\n\n    precompiled_related = _GetPrecompileRelatedFiles(spec)\n    # Find the excluded ones, minus the precompiled header related ones.\n    fully_excluded = [i for i in excluded_sources if i not in precompiled_related]\n\n    # Convert to folders and the right slashes.\n    sources = [i.split(\"\\\\\") for i in sources]\n    sources = _ConvertSourcesToFilterHierarchy(\n        sources,\n        excluded=fully_excluded,\n        list_excluded=list_excluded,\n        msvs_version=version,\n    )\n\n    # Prune filters with a single child to flatten ugly directory structures\n    # such as ../../src/modules/module1 etc.\n    if version.UsesVcxproj():\n        while (\n            all(isinstance(s, MSVSProject.Filter) for s in sources)\n            and len({s.name for s in sources}) == 1\n        ):\n            assert all(len(s.contents) == 1 for s in sources)\n            sources = [s.contents[0] for s in sources]\n    else:\n        while len(sources) == 1 and isinstance(sources[0], MSVSProject.Filter):\n            sources = sources[0].contents\n\n    return sources, excluded_sources, excluded_idl\n\n\ndef _IdlFilesHandledNonNatively(spec, sources):\n    # If any non-native rules use 'idl' as an extension exclude idl files.\n    # Gather a list here to use later.\n    using_idl = False\n    for rule in spec.get(\"rules\", []):\n        if rule[\"extension\"] == \"idl\" and int(rule.get(\"msvs_external_rule\", 0)):\n            using_idl = True\n            break\n    excluded_idl = [i for i in sources if i.endswith(\".idl\")] if using_idl else []\n    return excluded_idl\n\n\ndef _GetPrecompileRelatedFiles(spec):\n    # Gather a list of precompiled header related sources.\n    precompiled_related = []\n    for _, config in spec[\"configurations\"].items():\n        for k in precomp_keys:\n            f = config.get(k)\n            if f:\n                precompiled_related.append(_FixPath(f))\n    return precompiled_related\n\n\ndef _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl, list_excluded):\n    exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl)\n    for file_name, excluded_configs in exclusions.items():\n        if not list_excluded and len(excluded_configs) == len(spec[\"configurations\"]):\n            # If we're not listing excluded files, then they won't appear in the\n            # project, so don't try to configure them to be excluded.\n            pass\n        else:\n            for config_name, config in excluded_configs:\n                p.AddFileConfig(\n                    file_name,\n                    _ConfigFullName(config_name, config),\n                    {\"ExcludedFromBuild\": \"true\"},\n                )\n\n\ndef _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl):\n    exclusions = {}\n    # Exclude excluded sources from being built.\n    for f in excluded_sources:\n        excluded_configs = []\n        for config_name, config in spec[\"configurations\"].items():\n            precomped = [_FixPath(config.get(i, \"\")) for i in precomp_keys]\n            # Don't do this for ones that are precompiled header related.\n            if f not in precomped:\n                excluded_configs.append((config_name, config))\n        exclusions[f] = excluded_configs\n    # If any non-native rules use 'idl' as an extension exclude idl files.\n    # Exclude them now.\n    for f in excluded_idl:\n        excluded_configs = []\n        for config_name, config in spec[\"configurations\"].items():\n            excluded_configs.append((config_name, config))\n        exclusions[f] = excluded_configs\n    return exclusions\n\n\ndef _AddToolFilesToMSVS(p, spec):\n    # Add in tool files (rules).\n    tool_files = OrderedSet()\n    for _, config in spec[\"configurations\"].items():\n        for f in config.get(\"msvs_tool_files\", []):\n            tool_files.add(f)\n    for f in tool_files:\n        p.AddToolFile(f)\n\n\ndef _HandlePreCompiledHeaders(p, sources, spec):\n    # Pre-compiled header source stubs need a different compiler flag\n    # (generate precompiled header) and any source file not of the same\n    # kind (i.e. C vs. C++) as the precompiled header source stub needs\n    # to have use of precompiled headers disabled.\n    extensions_excluded_from_precompile = []\n    for config_name, config in spec[\"configurations\"].items():\n        source = config.get(\"msvs_precompiled_source\")\n        if source:\n            source = _FixPath(source)\n            # UsePrecompiledHeader=1 for if using precompiled headers.\n            tool = MSVSProject.Tool(\"VCCLCompilerTool\", {\"UsePrecompiledHeader\": \"1\"})\n            p.AddFileConfig(\n                source, _ConfigFullName(config_name, config), {}, tools=[tool]\n            )\n            _basename, extension = os.path.splitext(source)\n            if extension == \".c\":\n                extensions_excluded_from_precompile = [\".cc\", \".cpp\", \".cxx\"]\n            else:\n                extensions_excluded_from_precompile = [\".c\"]\n\n    def DisableForSourceTree(source_tree):\n        for source in source_tree:\n            if isinstance(source, MSVSProject.Filter):\n                DisableForSourceTree(source.contents)\n            else:\n                _basename, extension = os.path.splitext(source)\n                if extension in extensions_excluded_from_precompile:\n                    for config_name, config in spec[\"configurations\"].items():\n                        tool = MSVSProject.Tool(\n                            \"VCCLCompilerTool\",\n                            {\n                                \"UsePrecompiledHeader\": \"0\",\n                                \"ForcedIncludeFiles\": \"$(NOINHERIT)\",\n                            },\n                        )\n                        p.AddFileConfig(\n                            _FixPath(source),\n                            _ConfigFullName(config_name, config),\n                            {},\n                            tools=[tool],\n                        )\n\n    # Do nothing if there was no precompiled source.\n    if extensions_excluded_from_precompile:\n        DisableForSourceTree(sources)\n\n\ndef _AddActions(actions_to_add, spec, relative_path_of_gyp_file):\n    # Add actions.\n    actions = spec.get(\"actions\", [])\n    # Don't setup_env every time. When all the actions are run together in one\n    # batch file in VS, the PATH will grow too long.\n    # Membership in this set means that the cygwin environment has been set up,\n    # and does not need to be set up again.\n    have_setup_env = set()\n    for a in actions:\n        # Attach actions to the gyp file if nothing else is there.\n        inputs = a.get(\"inputs\") or [relative_path_of_gyp_file]\n        attached_to = inputs[0]\n        need_setup_env = attached_to not in have_setup_env\n        cmd = _BuildCommandLineForRule(\n            spec, a, has_input_path=False, do_setup_env=need_setup_env\n        )\n        have_setup_env.add(attached_to)\n        # Add the action.\n        _AddActionStep(\n            actions_to_add,\n            inputs=inputs,\n            outputs=a.get(\"outputs\", []),\n            description=a.get(\"message\", a[\"action_name\"]),\n            command=cmd,\n        )\n\n\ndef _WriteMSVSUserFile(project_path, version, spec):\n    # Add run_as and test targets.\n    if \"run_as\" in spec:\n        run_as = spec[\"run_as\"]\n        action = run_as.get(\"action\", [])\n        environment = run_as.get(\"environment\", [])\n        working_directory = run_as.get(\"working_directory\", \".\")\n    elif int(spec.get(\"test\", 0)):\n        action = [\"$(TargetPath)\", \"--gtest_print_time\"]\n        environment = []\n        working_directory = \".\"\n    else:\n        return  # Nothing to add\n    # Write out the user file.\n    user_file = _CreateMSVSUserFile(project_path, version, spec)\n    for config_name, c_data in spec[\"configurations\"].items():\n        user_file.AddDebugSettings(\n            _ConfigFullName(config_name, c_data), action, environment, working_directory\n        )\n    user_file.WriteIfChanged()\n\n\ndef _AddCopies(actions_to_add, spec):\n    copies = _GetCopies(spec)\n    for inputs, outputs, cmd, description in copies:\n        _AddActionStep(\n            actions_to_add,\n            inputs=inputs,\n            outputs=outputs,\n            description=description,\n            command=cmd,\n        )\n\n\ndef _GetCopies(spec):\n    copies = []\n    # Add copies.\n    for cpy in spec.get(\"copies\", []):\n        for src in cpy.get(\"files\", []):\n            dst = os.path.join(cpy[\"destination\"], os.path.basename(src))\n            # _AddCustomBuildToolForMSVS() will call _FixPath() on the inputs and\n            # outputs, so do the same for our generated command line.\n            if src.endswith(\"/\"):\n                src_bare = src[:-1]\n                base_dir = posixpath.split(src_bare)[0]\n                outer_dir = posixpath.split(src_bare)[1]\n                fixed_dst = _FixPath(dst)\n                full_dst = f'\"{fixed_dst}\\\\{outer_dir}\\\\\"'\n                cmd = (\n                    f'mkdir {full_dst} 2>nul & cd \"{_FixPath(base_dir)}\" '\n                    f'&& xcopy /e /f /y \"{outer_dir}\" {full_dst}'\n                )\n                copies.append(\n                    (\n                        [src],\n                        [\"dummy_copies\", dst],\n                        cmd,\n                        f\"Copying {src} to {fixed_dst}\",\n                    )\n                )\n            else:\n                fix_dst = _FixPath(cpy[\"destination\"])\n                cmd = (\n                    f'mkdir \"{fix_dst}\" 2>nul & set ERRORLEVEL=0 & '\n                    f'copy /Y \"{_FixPath(src)}\" \"{_FixPath(dst)}\"'\n                )\n                copies.append(([src], [dst], cmd, f\"Copying {src} to {fix_dst}\"))\n    return copies\n\n\ndef _GetPathDict(root, path):\n    # |path| will eventually be empty (in the recursive calls) if it was initially\n    # relative; otherwise it will eventually end up as '\\', 'D:\\', etc.\n    if not path or path.endswith(os.sep):\n        return root\n    parent, folder = os.path.split(path)\n    parent_dict = _GetPathDict(root, parent)\n    if folder not in parent_dict:\n        parent_dict[folder] = {}\n    return parent_dict[folder]\n\n\ndef _DictsToFolders(base_path, bucket, flat):\n    # Convert to folders recursively.\n    children = []\n    for folder, contents in bucket.items():\n        if isinstance(contents, dict):\n            folder_children = _DictsToFolders(\n                os.path.join(base_path, folder), contents, flat\n            )\n            if flat:\n                children += folder_children\n            else:\n                folder_children = MSVSNew.MSVSFolder(\n                    os.path.join(base_path, folder),\n                    name=\"(\" + folder + \")\",\n                    entries=folder_children,\n                )\n                children.append(folder_children)\n        else:\n            children.append(contents)\n    return children\n\n\ndef _CollapseSingles(parent, node):\n    # Recursively explorer the tree of dicts looking for projects which are\n    # the sole item in a folder which has the same name as the project. Bring\n    # such projects up one level.\n    if (\n        isinstance(node, dict)\n        and len(node) == 1\n        and next(iter(node)) == parent + \".vcproj\"\n    ):\n        return node[next(iter(node))]\n    if not isinstance(node, dict):\n        return node\n    for child in node:\n        node[child] = _CollapseSingles(child, node[child])\n    return node\n\n\ndef _GatherSolutionFolders(sln_projects, project_objects, flat):\n    root = {}\n    # Convert into a tree of dicts on path.\n    for p in sln_projects:\n        gyp_file, target = gyp.common.ParseQualifiedTarget(p)[0:2]\n        if p.endswith(\"#host\"):\n            target += \"_host\"\n        gyp_dir = os.path.dirname(gyp_file)\n        path_dict = _GetPathDict(root, gyp_dir)\n        path_dict[target + \".vcproj\"] = project_objects[p]\n    # Walk down from the top until we hit a folder that has more than one entry.\n    # In practice, this strips the top-level \"src/\" dir from the hierarchy in\n    # the solution.\n    while len(root) == 1 and isinstance(root[next(iter(root))], dict):\n        root = root[next(iter(root))]\n    # Collapse singles.\n    root = _CollapseSingles(\"\", root)\n    # Merge buckets until everything is a root entry.\n    return _DictsToFolders(\"\", root, flat)\n\n\ndef _GetPathOfProject(qualified_target, spec, options, msvs_version):\n    default_config = _GetDefaultConfiguration(spec)\n    proj_filename = default_config.get(\"msvs_existing_vcproj\")\n    if not proj_filename:\n        proj_filename = spec[\"target_name\"]\n        if spec[\"toolset\"] == \"host\":\n            proj_filename += \"_host\"\n        proj_filename = proj_filename + options.suffix + msvs_version.ProjectExtension()\n\n    build_file = gyp.common.BuildFile(qualified_target)\n    proj_path = os.path.join(os.path.dirname(build_file), proj_filename)\n    fix_prefix = None\n    if options.generator_output:\n        project_dir_path = os.path.dirname(os.path.abspath(proj_path))\n        proj_path = os.path.join(options.generator_output, proj_path)\n        fix_prefix = gyp.common.RelativePath(\n            project_dir_path, os.path.dirname(proj_path)\n        )\n    return proj_path, fix_prefix\n\n\ndef _GetPlatformOverridesOfProject(spec):\n    # Prepare a dict indicating which project configurations are used for which\n    # solution configurations for this target.\n    config_platform_overrides = {}\n    for config_name, c in spec[\"configurations\"].items():\n        config_fullname = _ConfigFullName(config_name, c)\n        platform = c.get(\"msvs_target_platform\", _ConfigPlatform(c))\n        base_name = _ConfigBaseName(config_name, _ConfigPlatform(c))\n        fixed_config_fullname = f\"{base_name}|{platform}\"\n        if spec[\"toolset\"] == \"host\" and generator_supports_multiple_toolsets:\n            fixed_config_fullname = f\"{config_name}|x64\"\n        config_platform_overrides[config_fullname] = fixed_config_fullname\n    return config_platform_overrides\n\n\ndef _CreateProjectObjects(target_list, target_dicts, options, msvs_version):\n    \"\"\"Create a MSVSProject object for the targets found in target list.\n\n    Arguments:\n      target_list: the list of targets to generate project objects for.\n      target_dicts: the dictionary of specifications.\n      options: global generator options.\n      msvs_version: the MSVSVersion object.\n    Returns:\n      A set of created projects, keyed by target.\n    \"\"\"\n    global fixpath_prefix\n    # Generate each project.\n    projects = {}\n    for qualified_target in target_list:\n        spec = target_dicts[qualified_target]\n        proj_path, fixpath_prefix = _GetPathOfProject(\n            qualified_target, spec, options, msvs_version\n        )\n        guid = _GetGuidOfProject(proj_path, spec)\n        overrides = _GetPlatformOverridesOfProject(spec)\n        build_file = gyp.common.BuildFile(qualified_target)\n        # Create object for this project.\n        target_name = spec[\"target_name\"]\n        if spec[\"toolset\"] == \"host\":\n            target_name += \"_host\"\n        obj = MSVSNew.MSVSProject(\n            proj_path,\n            name=target_name,\n            guid=guid,\n            spec=spec,\n            build_file=build_file,\n            config_platform_overrides=overrides,\n            fixpath_prefix=fixpath_prefix,\n        )\n        # Set project toolset if any (MS build only)\n        if msvs_version.UsesVcxproj():\n            obj.set_msbuild_toolset(\n                _GetMsbuildToolsetOfProject(proj_path, spec, msvs_version)\n            )\n        projects[qualified_target] = obj\n    # Set all the dependencies, but not if we are using an external builder like\n    # ninja\n    for project in projects.values():\n        if not project.spec.get(\"msvs_external_builder\"):\n            deps = project.spec.get(\"dependencies\", [])\n            deps = [projects[d] for d in deps]\n            project.set_dependencies(deps)\n    return projects\n\n\ndef _InitNinjaFlavor(params, target_list, target_dicts):\n    \"\"\"Initialize targets for the ninja flavor.\n\n    This sets up the necessary variables in the targets to generate msvs projects\n    that use ninja as an external builder. The variables in the spec are only set\n    if they have not been set. This allows individual specs to override the\n    default values initialized here.\n    Arguments:\n      params: Params provided to the generator.\n      target_list: List of target pairs: 'base/base.gyp:base'.\n      target_dicts: Dict of target properties keyed on target pair.\n    \"\"\"\n    for qualified_target in target_list:\n        spec = target_dicts[qualified_target]\n        if spec.get(\"msvs_external_builder\"):\n            # The spec explicitly defined an external builder, so don't change it.\n            continue\n\n        path_to_ninja = spec.get(\"msvs_path_to_ninja\", \"ninja.exe\")\n\n        spec[\"msvs_external_builder\"] = \"ninja\"\n        if not spec.get(\"msvs_external_builder_out_dir\"):\n            gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target)\n            gyp_dir = os.path.dirname(gyp_file)\n            configuration = \"$(Configuration)\"\n            if params.get(\"target_arch\") == \"x64\":\n                configuration += \"_x64\"\n            if params.get(\"target_arch\") == \"arm64\":\n                configuration += \"_arm64\"\n            spec[\"msvs_external_builder_out_dir\"] = os.path.join(\n                gyp.common.RelativePath(params[\"options\"].toplevel_dir, gyp_dir),\n                ninja_generator.ComputeOutputDir(params),\n                configuration,\n            )\n        if not spec.get(\"msvs_external_builder_build_cmd\"):\n            spec[\"msvs_external_builder_build_cmd\"] = [\n                path_to_ninja,\n                \"-C\",\n                \"$(OutDir)\",\n                \"$(ProjectName)\",\n            ]\n        if not spec.get(\"msvs_external_builder_clean_cmd\"):\n            spec[\"msvs_external_builder_clean_cmd\"] = [\n                path_to_ninja,\n                \"-C\",\n                \"$(OutDir)\",\n                \"-tclean\",\n                \"$(ProjectName)\",\n            ]\n\n\ndef CalculateVariables(default_variables, params):\n    \"\"\"Generated variables that require params to be known.\"\"\"\n\n    generator_flags = params.get(\"generator_flags\", {})\n\n    # Select project file format version (if unset, default to auto detecting).\n    msvs_version = MSVSVersion.SelectVisualStudioVersion(\n        generator_flags.get(\"msvs_version\", \"auto\")\n    )\n    # Stash msvs_version for later (so we don't have to probe the system twice).\n    params[\"msvs_version\"] = msvs_version\n\n    # Set a variable so conditions can be based on msvs_version.\n    default_variables[\"MSVS_VERSION\"] = msvs_version.ShortName()\n\n    # To determine processor word size on Windows, in addition to checking\n    # PROCESSOR_ARCHITECTURE (which reflects the word size of the current\n    # process), it is also necessary to check PROCESSOR_ARCITEW6432 (which\n    # contains the actual word size of the system when running thru WOW64).\n    if (\n        os.environ.get(\"PROCESSOR_ARCHITECTURE\", \"\").find(\"64\") >= 0\n        or os.environ.get(\"PROCESSOR_ARCHITEW6432\", \"\").find(\"64\") >= 0\n    ):\n        default_variables[\"MSVS_OS_BITS\"] = 64\n    else:\n        default_variables[\"MSVS_OS_BITS\"] = 32\n\n    if gyp.common.GetFlavor(params) == \"ninja\":\n        default_variables[\"SHARED_INTERMEDIATE_DIR\"] = \"$(OutDir)gen\"\n\n\ndef PerformBuild(data, configurations, params):\n    options = params[\"options\"]\n    msvs_version = params[\"msvs_version\"]\n    devenv = os.path.join(msvs_version.path, \"Common7\", \"IDE\", \"devenv.com\")\n\n    for build_file, build_file_dict in data.items():\n        (build_file_root, build_file_ext) = os.path.splitext(build_file)\n        if build_file_ext != \".gyp\":\n            continue\n        sln_path = build_file_root + options.suffix + \".sln\"\n        if options.generator_output:\n            sln_path = os.path.join(options.generator_output, sln_path)\n\n    for config in configurations:\n        arguments = [devenv, sln_path, \"/Build\", config]\n        print(f\"Building [{config}]: {arguments}\")\n        subprocess.check_call(arguments)\n\n\ndef CalculateGeneratorInputInfo(params):\n    if params.get(\"flavor\") == \"ninja\":\n        toplevel = params[\"options\"].toplevel_dir\n        qualified_out_dir = os.path.normpath(\n            os.path.join(\n                toplevel,\n                ninja_generator.ComputeOutputDir(params),\n                \"gypfiles-msvs-ninja\",\n            )\n        )\n\n        global generator_filelist_paths\n        generator_filelist_paths = {\n            \"toplevel\": toplevel,\n            \"qualified_out_dir\": qualified_out_dir,\n        }\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    \"\"\"Generate .sln and .vcproj files.\n\n    This is the entry point for this generator.\n    Arguments:\n      target_list: List of target pairs: 'base/base.gyp:base'.\n      target_dicts: Dict of target properties keyed on target pair.\n      data: Dictionary containing per .gyp data.\n    \"\"\"\n    global fixpath_prefix\n\n    options = params[\"options\"]\n\n    # Get the project file format version back out of where we stashed it in\n    # GeneratorCalculatedVariables.\n    msvs_version = params[\"msvs_version\"]\n\n    generator_flags = params.get(\"generator_flags\", {})\n\n    # Optionally shard targets marked with 'msvs_shard': SHARD_COUNT.\n    (target_list, target_dicts) = MSVSUtil.ShardTargets(target_list, target_dicts)\n\n    # Optionally use the large PDB workaround for targets marked with\n    # 'msvs_large_pdb': 1.\n    (target_list, target_dicts) = MSVSUtil.InsertLargePdbShims(\n        target_list, target_dicts, generator_default_variables\n    )\n\n    # Optionally configure each spec to use ninja as the external builder.\n    if params.get(\"flavor\") == \"ninja\":\n        _InitNinjaFlavor(params, target_list, target_dicts)\n\n    # Prepare the set of configurations.\n    configs = set()\n    for qualified_target in target_list:\n        spec = target_dicts[qualified_target]\n        for config_name, config in spec[\"configurations\"].items():\n            config_name = _ConfigFullName(config_name, config)\n            configs.add(config_name)\n            if config_name == \"Release|arm64\":\n                configs.add(\"Release|x64\")\n    configs = list(configs)\n\n    # Figure out all the projects that will be generated and their guids\n    project_objects = _CreateProjectObjects(\n        target_list, target_dicts, options, msvs_version\n    )\n\n    # Generate each project.\n    missing_sources = []\n    for project in project_objects.values():\n        fixpath_prefix = project.fixpath_prefix\n        missing_sources.extend(\n            _GenerateProject(project, options, msvs_version, generator_flags, spec)\n        )\n    fixpath_prefix = None\n\n    for build_file in data:\n        # Validate build_file extension\n        target_only_configs = configs\n        if generator_supports_multiple_toolsets:\n            target_only_configs = [i for i in configs if i.endswith(\"arm64\")]\n        if not build_file.endswith(\".gyp\"):\n            continue\n        sln_path = os.path.splitext(build_file)[0] + options.suffix + \".sln\"\n        if options.generator_output:\n            sln_path = os.path.join(options.generator_output, sln_path)\n        # Get projects in the solution, and their dependents.\n        sln_projects = gyp.common.BuildFileTargets(target_list, build_file)\n        sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects)\n        # Create folder hierarchy.\n        root_entries = _GatherSolutionFolders(\n            sln_projects, project_objects, flat=msvs_version.FlatSolution()\n        )\n        # Create solution.\n        sln = MSVSNew.MSVSSolution(\n            sln_path,\n            entries=root_entries,\n            variants=target_only_configs,\n            websiteProperties=False,\n            version=msvs_version,\n        )\n        sln.Write()\n\n    if missing_sources:\n        error_message = \"Missing input files:\\n\" + \"\\n\".join(set(missing_sources))\n        if generator_flags.get(\"msvs_error_on_missing_sources\", False):\n            raise GypError(error_message)\n        else:\n            print(\"Warning: \" + error_message, file=sys.stdout)\n\n\ndef _GenerateMSBuildFiltersFile(\n    filters_path,\n    source_files,\n    rule_dependencies,\n    extension_to_rule_name,\n    platforms,\n    toolset,\n):\n    \"\"\"Generate the filters file.\n\n    This file is used by Visual Studio to organize the presentation of source\n    files into folders.\n\n    Arguments:\n        filters_path: The path of the file to be created.\n        source_files: The hierarchical structure of all the sources.\n        extension_to_rule_name: A dictionary mapping file extensions to rules.\n    \"\"\"\n    filter_group = []\n    source_group = []\n    _AppendFiltersForMSBuild(\n        \"\",\n        source_files,\n        rule_dependencies,\n        extension_to_rule_name,\n        platforms,\n        toolset,\n        filter_group,\n        source_group,\n    )\n    if filter_group:\n        content = [\n            \"Project\",\n            {\n                \"ToolsVersion\": \"4.0\",\n                \"xmlns\": \"http://schemas.microsoft.com/developer/msbuild/2003\",\n            },\n            [\"ItemGroup\"] + filter_group,\n            [\"ItemGroup\"] + source_group,\n        ]\n        easy_xml.WriteXmlIfChanged(content, filters_path, pretty=True, win32=True)\n    elif os.path.exists(filters_path):\n        # We don't need this filter anymore.  Delete the old filter file.\n        os.unlink(filters_path)\n\n\ndef _AppendFiltersForMSBuild(\n    parent_filter_name,\n    sources,\n    rule_dependencies,\n    extension_to_rule_name,\n    platforms,\n    toolset,\n    filter_group,\n    source_group,\n):\n    \"\"\"Creates the list of filters and sources to be added in the filter file.\n\n    Args:\n        parent_filter_name: The name of the filter under which the sources are\n            found.\n        sources: The hierarchy of filters and sources to process.\n        extension_to_rule_name: A dictionary mapping file extensions to rules.\n        filter_group: The list to which filter entries will be appended.\n        source_group: The list to which source entries will be appended.\n    \"\"\"\n    for source in sources:\n        if isinstance(source, MSVSProject.Filter):\n            # We have a sub-filter.  Create the name of that sub-filter.\n            if not parent_filter_name:\n                filter_name = source.name\n            else:\n                filter_name = f\"{parent_filter_name}\\\\{source.name}\"\n            # Add the filter to the group.\n            filter_group.append(\n                [\n                    \"Filter\",\n                    {\"Include\": filter_name},\n                    [\"UniqueIdentifier\", MSVSNew.MakeGuid(source.name)],\n                ]\n            )\n            # Recurse and add its dependents.\n            _AppendFiltersForMSBuild(\n                filter_name,\n                source.contents,\n                rule_dependencies,\n                extension_to_rule_name,\n                platforms,\n                toolset,\n                filter_group,\n                source_group,\n            )\n        else:\n            # It's a source.  Create a source entry.\n            _, element = _MapFileToMsBuildSourceType(\n                source, rule_dependencies, extension_to_rule_name, platforms, toolset\n            )\n            source_entry = [element, {\"Include\": source}]\n            # Specify the filter it is part of, if any.\n            if parent_filter_name:\n                source_entry.append([\"Filter\", parent_filter_name])\n            source_group.append(source_entry)\n\n\ndef _MapFileToMsBuildSourceType(\n    source, rule_dependencies, extension_to_rule_name, platforms, toolset\n):\n    \"\"\"Returns the group and element type of the source file.\n\n    Arguments:\n        source: The source file name.\n        extension_to_rule_name: A dictionary mapping file extensions to rules.\n\n    Returns:\n        A pair of (group this file should be part of, the label of element)\n    \"\"\"\n    _, ext = os.path.splitext(source)\n    ext = ext.lower()\n    if ext in extension_to_rule_name:\n        group = \"rule\"\n        element = extension_to_rule_name[ext]\n    elif ext in [\".cc\", \".cpp\", \".c\", \".cxx\", \".mm\"]:\n        group = \"compile\"\n        element = \"ClCompile\"\n    elif ext in [\".h\", \".hxx\"]:\n        group = \"include\"\n        element = \"ClInclude\"\n    elif ext == \".rc\":\n        group = \"resource\"\n        element = \"ResourceCompile\"\n    elif ext in [\".s\", \".asm\"]:\n        group = \"masm\"\n        element = \"MASM\"\n        if \"arm64\" in platforms and toolset == \"target\":\n            element = \"MARMASM\"\n    elif ext == \".idl\":\n        group = \"midl\"\n        element = \"Midl\"\n    elif source in rule_dependencies:\n        group = \"rule_dependency\"\n        element = \"CustomBuild\"\n    else:\n        group = \"none\"\n        element = \"None\"\n    return (group, element)\n\n\ndef _GenerateRulesForMSBuild(\n    output_dir,\n    options,\n    spec,\n    sources,\n    excluded_sources,\n    props_files_of_rules,\n    targets_files_of_rules,\n    actions_to_add,\n    rule_dependencies,\n    extension_to_rule_name,\n):\n    # MSBuild rules are implemented using three files: an XML file, a .targets\n    # file and a .props file.\n    # For more details see:\n    # https://devblogs.microsoft.com/cppblog/quick-help-on-vs2010-custom-build-rule/\n    rules = spec.get(\"rules\", [])\n    rules_native = [r for r in rules if not int(r.get(\"msvs_external_rule\", 0))]\n    rules_external = [r for r in rules if int(r.get(\"msvs_external_rule\", 0))]\n\n    msbuild_rules = []\n    for rule in rules_native:\n        # Skip a rule with no action and no inputs.\n        if \"action\" not in rule and not rule.get(\"rule_sources\", []):\n            continue\n        msbuild_rule = MSBuildRule(rule, spec)\n        msbuild_rules.append(msbuild_rule)\n        rule_dependencies.update(msbuild_rule.additional_dependencies.split(\";\"))\n        extension_to_rule_name[msbuild_rule.extension] = msbuild_rule.rule_name\n    if msbuild_rules:\n        base = spec[\"target_name\"] + options.suffix\n        props_name = base + \".props\"\n        targets_name = base + \".targets\"\n        xml_name = base + \".xml\"\n\n        props_files_of_rules.add(props_name)\n        targets_files_of_rules.add(targets_name)\n\n        props_path = os.path.join(output_dir, props_name)\n        targets_path = os.path.join(output_dir, targets_name)\n        xml_path = os.path.join(output_dir, xml_name)\n\n        _GenerateMSBuildRulePropsFile(props_path, msbuild_rules)\n        _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules)\n        _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules)\n\n    if rules_external:\n        _GenerateExternalRules(\n            rules_external, output_dir, spec, sources, options, actions_to_add\n        )\n    _AdjustSourcesForRules(rules, sources, excluded_sources, True)\n\n\nclass MSBuildRule:\n    \"\"\"Used to store information used to generate an MSBuild rule.\n\n    Attributes:\n      rule_name: The rule name, sanitized to use in XML.\n      target_name: The name of the target.\n      after_targets: The name of the AfterTargets element.\n      before_targets: The name of the BeforeTargets element.\n      depends_on: The name of the DependsOn element.\n      compute_output: The name of the ComputeOutput element.\n      dirs_to_make: The name of the DirsToMake element.\n      inputs: The name of the _inputs element.\n      tlog: The name of the _tlog element.\n      extension: The extension this rule applies to.\n      description: The message displayed when this rule is invoked.\n      additional_dependencies: A string listing additional dependencies.\n      outputs: The outputs of this rule.\n      command: The command used to run the rule.\n    \"\"\"\n\n    def __init__(self, rule, spec):\n        self.display_name = rule[\"rule_name\"]\n        # Assure that the rule name is only characters and numbers\n        self.rule_name = re.sub(r\"\\W\", \"_\", self.display_name)\n        # Create the various element names, following the example set by the\n        # Visual Studio 2008 to 2010 conversion.  I don't know if VS2010\n        # is sensitive to the exact names.\n        self.target_name = \"_\" + self.rule_name\n        self.after_targets = self.rule_name + \"AfterTargets\"\n        self.before_targets = self.rule_name + \"BeforeTargets\"\n        self.depends_on = self.rule_name + \"DependsOn\"\n        self.compute_output = \"Compute%sOutput\" % self.rule_name\n        self.dirs_to_make = self.rule_name + \"DirsToMake\"\n        self.inputs = self.rule_name + \"_inputs\"\n        self.tlog = self.rule_name + \"_tlog\"\n        self.extension = rule[\"extension\"]\n        if not self.extension.startswith(\".\"):\n            self.extension = \".\" + self.extension\n\n        self.description = MSVSSettings.ConvertVCMacrosToMSBuild(\n            rule.get(\"message\", self.rule_name)\n        )\n        old_additional_dependencies = _FixPaths(rule.get(\"inputs\", []))\n        self.additional_dependencies = \";\".join(\n            [\n                MSVSSettings.ConvertVCMacrosToMSBuild(i)\n                for i in old_additional_dependencies\n            ]\n        )\n        old_outputs = _FixPaths(rule.get(\"outputs\", []))\n        self.outputs = \";\".join(\n            [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in old_outputs]\n        )\n        old_command = _BuildCommandLineForRule(\n            spec, rule, has_input_path=True, do_setup_env=True\n        )\n        self.command = MSVSSettings.ConvertVCMacrosToMSBuild(old_command)\n\n\ndef _GenerateMSBuildRulePropsFile(props_path, msbuild_rules):\n    \"\"\"Generate the .props file.\"\"\"\n    content = [\n        \"Project\",\n        {\"xmlns\": \"http://schemas.microsoft.com/developer/msbuild/2003\"},\n    ]\n    for rule in msbuild_rules:\n        content.extend(\n            [\n                [\n                    \"PropertyGroup\",\n                    {\n                        \"Condition\": \"'$(%s)' == '' and '$(%s)' == '' and \"\n                        \"'$(ConfigurationType)' != 'Makefile'\"\n                        % (rule.before_targets, rule.after_targets)\n                    },\n                    [rule.before_targets, \"Midl\"],\n                    [rule.after_targets, \"CustomBuild\"],\n                ],\n                [\n                    \"PropertyGroup\",\n                    [\n                        rule.depends_on,\n                        {\"Condition\": \"'$(ConfigurationType)' != 'Makefile'\"},\n                        \"_SelectedFiles;$(%s)\" % rule.depends_on,\n                    ],\n                ],\n                [\n                    \"ItemDefinitionGroup\",\n                    [\n                        rule.rule_name,\n                        [\"CommandLineTemplate\", rule.command],\n                        [\"Outputs\", rule.outputs],\n                        [\"ExecutionDescription\", rule.description],\n                        [\"AdditionalDependencies\", rule.additional_dependencies],\n                    ],\n                ],\n            ]\n        )\n    easy_xml.WriteXmlIfChanged(content, props_path, pretty=True, win32=True)\n\n\ndef _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules):\n    \"\"\"Generate the .targets file.\"\"\"\n    content = [\n        \"Project\",\n        {\"xmlns\": \"http://schemas.microsoft.com/developer/msbuild/2003\"},\n    ]\n    item_group = [\n        \"ItemGroup\",\n        [\n            \"PropertyPageSchema\",\n            {\"Include\": \"$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml\"},\n        ],\n    ]\n    for rule in msbuild_rules:\n        item_group.append(\n            [\n                \"AvailableItemName\",\n                {\"Include\": rule.rule_name},\n                [\"Targets\", rule.target_name],\n            ]\n        )\n    content.append(item_group)\n\n    for rule in msbuild_rules:\n        content.append(\n            [\n                \"UsingTask\",\n                {\n                    \"TaskName\": rule.rule_name,\n                    \"TaskFactory\": \"XamlTaskFactory\",\n                    \"AssemblyName\": \"Microsoft.Build.Tasks.v4.0\",\n                },\n                [\"Task\", \"$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml\"],\n            ]\n        )\n    for rule in msbuild_rules:\n        rule_name = rule.rule_name\n        target_outputs = \"%%(%s.Outputs)\" % rule_name\n        target_inputs = (\n            \"%%(%s.Identity);%%(%s.AdditionalDependencies);$(MSBuildProjectFile)\"\n        ) % (rule_name, rule_name)\n        rule_inputs = \"%%(%s.Identity)\" % rule_name\n        extension_condition = (\n            \"'%(Extension)'=='.obj' or \"\n            \"'%(Extension)'=='.res' or \"\n            \"'%(Extension)'=='.rsc' or \"\n            \"'%(Extension)'=='.lib'\"\n        )\n        remove_section = [\n            \"ItemGroup\",\n            {\"Condition\": \"'@(SelectedFiles)' != ''\"},\n            [\n                rule_name,\n                {\n                    \"Remove\": \"@(%s)\" % rule_name,\n                    \"Condition\": \"'%(Identity)' != '@(SelectedFiles)'\",\n                },\n            ],\n        ]\n        inputs_section = [\n            \"ItemGroup\",\n            [rule.inputs, {\"Include\": \"%%(%s.AdditionalDependencies)\" % rule_name}],\n        ]\n        logging_section = [\n            \"ItemGroup\",\n            [\n                rule.tlog,\n                {\n                    \"Include\": \"%%(%s.Outputs)\" % rule_name,\n                    \"Condition\": (\n                        \"'%%(%s.Outputs)' != '' and \"\n                        \"'%%(%s.ExcludedFromBuild)' != 'true'\" % (rule_name, rule_name)\n                    ),\n                },\n                [\"Source\", \"@(%s, '|')\" % rule_name],\n                [\"Inputs\", \"@(%s -> '%%(Fullpath)', ';')\" % rule.inputs],\n            ],\n        ]\n        message_section = [\n            \"Message\",\n            {\"Importance\": \"High\", \"Text\": \"%%(%s.ExecutionDescription)\" % rule_name},\n        ]\n        write_tlog_section = [\n            \"WriteLinesToFile\",\n            {\n                \"Condition\": \"'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != \"\n                \"'true'\" % (rule.tlog, rule.tlog),\n                \"File\": \"$(IntDir)$(ProjectName).write.1.tlog\",\n                \"Lines\": \"^%%(%s.Source);@(%s->'%%(Fullpath)')\"\n                % (rule.tlog, rule.tlog),\n            },\n        ]\n        read_tlog_section = [\n            \"WriteLinesToFile\",\n            {\n                \"Condition\": \"'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != \"\n                \"'true'\" % (rule.tlog, rule.tlog),\n                \"File\": \"$(IntDir)$(ProjectName).read.1.tlog\",\n                \"Lines\": f\"^%({rule.tlog}.Source);%({rule.tlog}.Inputs)\",\n            },\n        ]\n        command_and_input_section = [\n            rule_name,\n            {\n                \"Condition\": \"'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != \"\n                \"'true'\" % (rule_name, rule_name),\n                \"EchoOff\": \"true\",\n                \"StandardOutputImportance\": \"High\",\n                \"StandardErrorImportance\": \"High\",\n                \"CommandLineTemplate\": \"%%(%s.CommandLineTemplate)\" % rule_name,\n                \"AdditionalOptions\": \"%%(%s.AdditionalOptions)\" % rule_name,\n                \"Inputs\": rule_inputs,\n            },\n        ]\n        content.extend(\n            [\n                [\n                    \"Target\",\n                    {\n                        \"Name\": rule.target_name,\n                        \"BeforeTargets\": \"$(%s)\" % rule.before_targets,\n                        \"AfterTargets\": \"$(%s)\" % rule.after_targets,\n                        \"Condition\": \"'@(%s)' != ''\" % rule_name,\n                        \"DependsOnTargets\": \"$(%s);%s\"\n                        % (rule.depends_on, rule.compute_output),\n                        \"Outputs\": target_outputs,\n                        \"Inputs\": target_inputs,\n                    },\n                    remove_section,\n                    inputs_section,\n                    logging_section,\n                    message_section,\n                    write_tlog_section,\n                    read_tlog_section,\n                    command_and_input_section,\n                ],\n                [\n                    \"PropertyGroup\",\n                    [\n                        \"ComputeLinkInputsTargets\",\n                        \"$(ComputeLinkInputsTargets);\",\n                        \"%s;\" % rule.compute_output,\n                    ],\n                    [\n                        \"ComputeLibInputsTargets\",\n                        \"$(ComputeLibInputsTargets);\",\n                        \"%s;\" % rule.compute_output,\n                    ],\n                ],\n                [\n                    \"Target\",\n                    {\n                        \"Name\": rule.compute_output,\n                        \"Condition\": \"'@(%s)' != ''\" % rule_name,\n                    },\n                    [\n                        \"ItemGroup\",\n                        [\n                            rule.dirs_to_make,\n                            {\n                                \"Condition\": \"'@(%s)' != '' and \"\n                                \"'%%(%s.ExcludedFromBuild)' != 'true'\"\n                                % (rule_name, rule_name),\n                                \"Include\": \"%%(%s.Outputs)\" % rule_name,\n                            },\n                        ],\n                        [\n                            \"Link\",\n                            {\n                                \"Include\": \"%%(%s.Identity)\" % rule.dirs_to_make,\n                                \"Condition\": extension_condition,\n                            },\n                        ],\n                        [\n                            \"Lib\",\n                            {\n                                \"Include\": \"%%(%s.Identity)\" % rule.dirs_to_make,\n                                \"Condition\": extension_condition,\n                            },\n                        ],\n                        [\n                            \"ImpLib\",\n                            {\n                                \"Include\": \"%%(%s.Identity)\" % rule.dirs_to_make,\n                                \"Condition\": extension_condition,\n                            },\n                        ],\n                    ],\n                    [\n                        \"MakeDir\",\n                        {\n                            \"Directories\": (\n                                \"@(%s->'%%(RootDir)%%(Directory)')\" % rule.dirs_to_make\n                            )\n                        },\n                    ],\n                ],\n            ]\n        )\n    easy_xml.WriteXmlIfChanged(content, targets_path, pretty=True, win32=True)\n\n\ndef _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):\n    # Generate the .xml file\n    content = [\n        \"ProjectSchemaDefinitions\",\n        {\n            \"xmlns\": (\n                \"clr-namespace:Microsoft.Build.Framework.XamlTypes;\"\n                \"assembly=Microsoft.Build.Framework\"\n            ),\n            \"xmlns:x\": \"http://schemas.microsoft.com/winfx/2006/xaml\",\n            \"xmlns:sys\": \"clr-namespace:System;assembly=mscorlib\",\n            \"xmlns:transformCallback\": \"Microsoft.Cpp.Dev10.ConvertPropertyCallback\",\n        },\n    ]\n    for rule in msbuild_rules:\n        content.extend(\n            [\n                [\n                    \"Rule\",\n                    {\n                        \"Name\": rule.rule_name,\n                        \"PageTemplate\": \"tool\",\n                        \"DisplayName\": rule.display_name,\n                        \"Order\": \"200\",\n                    },\n                    [\n                        \"Rule.DataSource\",\n                        [\n                            \"DataSource\",\n                            {\"Persistence\": \"ProjectFile\", \"ItemType\": rule.rule_name},\n                        ],\n                    ],\n                    [\n                        \"Rule.Categories\",\n                        [\n                            \"Category\",\n                            {\"Name\": \"General\"},\n                            [\"Category.DisplayName\", [\"sys:String\", \"General\"]],\n                        ],\n                        [\n                            \"Category\",\n                            {\"Name\": \"Command Line\", \"Subtype\": \"CommandLine\"},\n                            [\"Category.DisplayName\", [\"sys:String\", \"Command Line\"]],\n                        ],\n                    ],\n                    [\n                        \"StringListProperty\",\n                        {\n                            \"Name\": \"Inputs\",\n                            \"Category\": \"Command Line\",\n                            \"IsRequired\": \"true\",\n                            \"Switch\": \" \",\n                        },\n                        [\n                            \"StringListProperty.DataSource\",\n                            [\n                                \"DataSource\",\n                                {\n                                    \"Persistence\": \"ProjectFile\",\n                                    \"ItemType\": rule.rule_name,\n                                    \"SourceType\": \"Item\",\n                                },\n                            ],\n                        ],\n                    ],\n                    [\n                        \"StringProperty\",\n                        {\n                            \"Name\": \"CommandLineTemplate\",\n                            \"DisplayName\": \"Command Line\",\n                            \"Visible\": \"False\",\n                            \"IncludeInCommandLine\": \"False\",\n                        },\n                    ],\n                    [\n                        \"DynamicEnumProperty\",\n                        {\n                            \"Name\": rule.before_targets,\n                            \"Category\": \"General\",\n                            \"EnumProvider\": \"Targets\",\n                            \"IncludeInCommandLine\": \"False\",\n                        },\n                        [\n                            \"DynamicEnumProperty.DisplayName\",\n                            [\"sys:String\", \"Execute Before\"],\n                        ],\n                        [\n                            \"DynamicEnumProperty.Description\",\n                            [\n                                \"sys:String\",\n                                \"Specifies the targets for the build customization\"\n                                \" to run before.\",\n                            ],\n                        ],\n                        [\n                            \"DynamicEnumProperty.ProviderSettings\",\n                            [\n                                \"NameValuePair\",\n                                {\n                                    \"Name\": \"Exclude\",\n                                    \"Value\": \"^%s|^Compute\" % rule.before_targets,\n                                },\n                            ],\n                        ],\n                        [\n                            \"DynamicEnumProperty.DataSource\",\n                            [\n                                \"DataSource\",\n                                {\n                                    \"Persistence\": \"ProjectFile\",\n                                    \"HasConfigurationCondition\": \"true\",\n                                },\n                            ],\n                        ],\n                    ],\n                    [\n                        \"DynamicEnumProperty\",\n                        {\n                            \"Name\": rule.after_targets,\n                            \"Category\": \"General\",\n                            \"EnumProvider\": \"Targets\",\n                            \"IncludeInCommandLine\": \"False\",\n                        },\n                        [\n                            \"DynamicEnumProperty.DisplayName\",\n                            [\"sys:String\", \"Execute After\"],\n                        ],\n                        [\n                            \"DynamicEnumProperty.Description\",\n                            [\n                                \"sys:String\",\n                                (\n                                    \"Specifies the targets for the build customization\"\n                                    \" to run after.\"\n                                ),\n                            ],\n                        ],\n                        [\n                            \"DynamicEnumProperty.ProviderSettings\",\n                            [\n                                \"NameValuePair\",\n                                {\n                                    \"Name\": \"Exclude\",\n                                    \"Value\": \"^%s|^Compute\" % rule.after_targets,\n                                },\n                            ],\n                        ],\n                        [\n                            \"DynamicEnumProperty.DataSource\",\n                            [\n                                \"DataSource\",\n                                {\n                                    \"Persistence\": \"ProjectFile\",\n                                    \"ItemType\": \"\",\n                                    \"HasConfigurationCondition\": \"true\",\n                                },\n                            ],\n                        ],\n                    ],\n                    [\n                        \"StringListProperty\",\n                        {\n                            \"Name\": \"Outputs\",\n                            \"DisplayName\": \"Outputs\",\n                            \"Visible\": \"False\",\n                            \"IncludeInCommandLine\": \"False\",\n                        },\n                    ],\n                    [\n                        \"StringProperty\",\n                        {\n                            \"Name\": \"ExecutionDescription\",\n                            \"DisplayName\": \"Execution Description\",\n                            \"Visible\": \"False\",\n                            \"IncludeInCommandLine\": \"False\",\n                        },\n                    ],\n                    [\n                        \"StringListProperty\",\n                        {\n                            \"Name\": \"AdditionalDependencies\",\n                            \"DisplayName\": \"Additional Dependencies\",\n                            \"IncludeInCommandLine\": \"False\",\n                            \"Visible\": \"false\",\n                        },\n                    ],\n                    [\n                        \"StringProperty\",\n                        {\n                            \"Subtype\": \"AdditionalOptions\",\n                            \"Name\": \"AdditionalOptions\",\n                            \"Category\": \"Command Line\",\n                        },\n                        [\n                            \"StringProperty.DisplayName\",\n                            [\"sys:String\", \"Additional Options\"],\n                        ],\n                        [\n                            \"StringProperty.Description\",\n                            [\"sys:String\", \"Additional Options\"],\n                        ],\n                    ],\n                ],\n                [\n                    \"ItemType\",\n                    {\"Name\": rule.rule_name, \"DisplayName\": rule.display_name},\n                ],\n                [\n                    \"FileExtension\",\n                    {\"Name\": \"*\" + rule.extension, \"ContentType\": rule.rule_name},\n                ],\n                [\n                    \"ContentType\",\n                    {\n                        \"Name\": rule.rule_name,\n                        \"DisplayName\": \"\",\n                        \"ItemType\": rule.rule_name,\n                    },\n                ],\n            ]\n        )\n    easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)\n\n\ndef _GetConfigurationAndPlatform(name, settings, spec):\n    configuration = name.rsplit(\"_\", 1)[0]\n    platform = settings.get(\"msvs_configuration_platform\", \"Win32\")\n    if spec[\"toolset\"] == \"host\" and platform == \"arm64\":\n        platform = \"x64\"  # Host-only tools are always built for x64\n    return (configuration, platform)\n\n\ndef _GetConfigurationCondition(name, settings, spec):\n    return r\"'$(Configuration)|$(Platform)'=='%s|%s'\" % _GetConfigurationAndPlatform(\n        name, settings, spec\n    )\n\n\ndef _GetMSBuildProjectConfigurations(configurations, spec):\n    group = [\"ItemGroup\", {\"Label\": \"ProjectConfigurations\"}]\n    for name, settings in sorted(configurations.items()):\n        configuration, platform = _GetConfigurationAndPlatform(name, settings, spec)\n        designation = f\"{configuration}|{platform}\"\n        group.append(\n            [\n                \"ProjectConfiguration\",\n                {\"Include\": designation},\n                [\"Configuration\", configuration],\n                [\"Platform\", platform],\n            ]\n        )\n    return [group]\n\n\ndef _GetMSBuildGlobalProperties(spec, version, guid, gyp_file_name):\n    namespace = os.path.splitext(gyp_file_name)[0]\n    properties = [\n        [\n            \"PropertyGroup\",\n            {\"Label\": \"Globals\"},\n            [\"ProjectGuid\", guid],\n            [\"Keyword\", \"Win32Proj\"],\n            [\"RootNamespace\", namespace],\n            [\"IgnoreWarnCompileDuplicatedFilename\", \"true\"],\n        ]\n    ]\n\n    if (\n        os.environ.get(\"PROCESSOR_ARCHITECTURE\") == \"AMD64\"\n        or os.environ.get(\"PROCESSOR_ARCHITEW6432\") == \"AMD64\"\n    ):\n        properties[0].append([\"PreferredToolArchitecture\", \"x64\"])\n\n    if spec.get(\"msvs_target_platform_version\"):\n        target_platform_version = spec.get(\"msvs_target_platform_version\")\n        properties[0].append([\"WindowsTargetPlatformVersion\", target_platform_version])\n        if spec.get(\"msvs_target_platform_minversion\"):\n            target_platform_minversion = spec.get(\"msvs_target_platform_minversion\")\n            properties[0].append(\n                [\"WindowsTargetPlatformMinVersion\", target_platform_minversion]\n            )\n        else:\n            properties[0].append(\n                [\"WindowsTargetPlatformMinVersion\", target_platform_version]\n            )\n\n    if spec.get(\"msvs_enable_winrt\"):\n        properties[0].append([\"DefaultLanguage\", \"en-US\"])\n        properties[0].append([\"AppContainerApplication\", \"true\"])\n        if spec.get(\"msvs_application_type_revision\"):\n            app_type_revision = spec.get(\"msvs_application_type_revision\")\n            properties[0].append([\"ApplicationTypeRevision\", app_type_revision])\n        else:\n            properties[0].append([\"ApplicationTypeRevision\", \"8.1\"])\n        if spec.get(\"msvs_enable_winphone\"):\n            properties[0].append([\"ApplicationType\", \"Windows Phone\"])\n        else:\n            properties[0].append([\"ApplicationType\", \"Windows Store\"])\n\n    platform_name = None\n    msvs_windows_sdk_version = None\n    for configuration in spec[\"configurations\"].values():\n        platform_name = platform_name or _ConfigPlatform(configuration)\n        msvs_windows_sdk_version = (\n            msvs_windows_sdk_version\n            or _ConfigWindowsTargetPlatformVersion(configuration, version)\n        )\n        if platform_name and msvs_windows_sdk_version:\n            break\n    if msvs_windows_sdk_version:\n        properties[0].append(\n            [\"WindowsTargetPlatformVersion\", str(msvs_windows_sdk_version)]\n        )\n    elif version.compatible_sdks:\n        raise GypError(\n            \"%s requires any SDK of %s version, but none were found\"\n            % (version.description, version.compatible_sdks)\n        )\n\n    if platform_name == \"ARM\":\n        properties[0].append([\"WindowsSDKDesktopARMSupport\", \"true\"])\n\n    return properties\n\n\ndef _GetMSBuildConfigurationDetails(spec, build_file):\n    properties = {}\n    for name, settings in spec[\"configurations\"].items():\n        msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file)\n        condition = _GetConfigurationCondition(name, settings, spec)\n        character_set = msbuild_attributes.get(\"CharacterSet\")\n        vctools_version = msbuild_attributes.get(\"VCToolsVersion\")\n        config_type = msbuild_attributes.get(\"ConfigurationType\")\n        _AddConditionalProperty(properties, condition, \"ConfigurationType\", config_type)\n        spectre_mitigation = msbuild_attributes.get(\"SpectreMitigation\")\n        if spectre_mitigation:\n            _AddConditionalProperty(\n                properties, condition, \"SpectreMitigation\", spectre_mitigation\n            )\n        if config_type == \"Driver\":\n            _AddConditionalProperty(properties, condition, \"DriverType\", \"WDM\")\n            _AddConditionalProperty(\n                properties, condition, \"TargetVersion\", _ConfigTargetVersion(settings)\n            )\n        if character_set and \"msvs_enable_winrt\" not in spec:\n            _AddConditionalProperty(\n                properties, condition, \"CharacterSet\", character_set\n            )\n        if vctools_version and \"msvs_enable_winrt\" not in spec:\n            _AddConditionalProperty(\n                properties, condition, \"VCToolsVersion\", vctools_version\n            )\n    return _GetMSBuildPropertyGroup(spec, \"Configuration\", properties)\n\n\ndef _GetMSBuildLocalProperties(msbuild_toolset):\n    # Currently the only local property we support is PlatformToolset\n    properties = {}\n    if msbuild_toolset:\n        properties = [\n            [\n                \"PropertyGroup\",\n                {\"Label\": \"Locals\"},\n                [\"PlatformToolset\", msbuild_toolset],\n            ]\n        ]\n    return properties\n\n\ndef _GetMSBuildPropertySheets(configurations, spec):\n    user_props = r\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\"\n    additional_props = {}\n    props_specified = False\n    for name, settings in sorted(configurations.items()):\n        configuration = _GetConfigurationCondition(name, settings, spec)\n        if \"msbuild_props\" in settings:\n            additional_props[configuration] = _FixPaths(settings[\"msbuild_props\"])\n            props_specified = True\n        else:\n            additional_props[configuration] = \"\"\n\n    if not props_specified:\n        return [\n            [\n                \"ImportGroup\",\n                {\"Label\": \"PropertySheets\"},\n                [\n                    \"Import\",\n                    {\n                        \"Project\": user_props,\n                        \"Condition\": \"exists('%s')\" % user_props,\n                        \"Label\": \"LocalAppDataPlatform\",\n                    },\n                ],\n            ]\n        ]\n    else:\n        sheets = []\n        for condition, props in additional_props.items():\n            import_group = [\n                \"ImportGroup\",\n                {\"Label\": \"PropertySheets\", \"Condition\": condition},\n                [\n                    \"Import\",\n                    {\n                        \"Project\": user_props,\n                        \"Condition\": \"exists('%s')\" % user_props,\n                        \"Label\": \"LocalAppDataPlatform\",\n                    },\n                ],\n            ]\n            for props_file in props:\n                import_group.append([\"Import\", {\"Project\": props_file}])\n            sheets.append(import_group)\n        return sheets\n\n\ndef _ConvertMSVSBuildAttributes(spec, config, build_file):\n    config_type = _GetMSVSConfigurationType(spec, build_file)\n    msvs_attributes = _GetMSVSAttributes(spec, config, config_type)\n    msbuild_attributes = {}\n    for a in msvs_attributes:\n        if a in [\"IntermediateDirectory\", \"OutputDirectory\"]:\n            directory = MSVSSettings.ConvertVCMacrosToMSBuild(msvs_attributes[a])\n            if not directory.endswith(\"\\\\\"):\n                directory += \"\\\\\"\n            msbuild_attributes[a] = directory\n        elif a == \"CharacterSet\":\n            msbuild_attributes[a] = _ConvertMSVSCharacterSet(msvs_attributes[a])\n        elif a == \"ConfigurationType\":\n            msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a])\n        elif a == \"SpectreMitigation\" or a == \"VCToolsVersion\":\n            msbuild_attributes[a] = msvs_attributes[a]\n        else:\n            print(\"Warning: Do not know how to convert MSVS attribute \" + a)\n    return msbuild_attributes\n\n\ndef _ConvertMSVSCharacterSet(char_set):\n    if char_set.isdigit():\n        char_set = {\"0\": \"MultiByte\", \"1\": \"Unicode\", \"2\": \"MultiByte\"}[char_set]\n    return char_set\n\n\ndef _ConvertMSVSConfigurationType(config_type):\n    if config_type.isdigit():\n        config_type = {\n            \"1\": \"Application\",\n            \"2\": \"DynamicLibrary\",\n            \"4\": \"StaticLibrary\",\n            \"5\": \"Driver\",\n            \"10\": \"Utility\",\n        }[config_type]\n    return config_type\n\n\ndef _GetMSBuildAttributes(spec, config, build_file):\n    if \"msbuild_configuration_attributes\" not in config:\n        msbuild_attributes = _ConvertMSVSBuildAttributes(spec, config, build_file)\n\n    else:\n        config_type = _GetMSVSConfigurationType(spec, build_file)\n        config_type = _ConvertMSVSConfigurationType(config_type)\n        msbuild_attributes = config.get(\"msbuild_configuration_attributes\", {})\n        msbuild_attributes.setdefault(\"ConfigurationType\", config_type)\n        output_dir = msbuild_attributes.get(\n            \"OutputDirectory\", \"$(SolutionDir)$(Configuration)\"\n        )\n        msbuild_attributes[\"OutputDirectory\"] = _FixPath(output_dir) + \"\\\\\"\n        if \"IntermediateDirectory\" not in msbuild_attributes:\n            intermediate = _FixPath(\"$(Configuration)\") + \"\\\\\"\n            msbuild_attributes[\"IntermediateDirectory\"] = intermediate\n        if \"CharacterSet\" in msbuild_attributes:\n            msbuild_attributes[\"CharacterSet\"] = _ConvertMSVSCharacterSet(\n                msbuild_attributes[\"CharacterSet\"]\n            )\n    if \"TargetName\" not in msbuild_attributes:\n        prefix = spec.get(\"product_prefix\", \"\")\n        product_name = spec.get(\"product_name\", \"$(ProjectName)\")\n        target_name = prefix + product_name\n        msbuild_attributes[\"TargetName\"] = target_name\n    if \"TargetExt\" not in msbuild_attributes and \"product_extension\" in spec:\n        ext = spec.get(\"product_extension\")\n        msbuild_attributes[\"TargetExt\"] = \".\" + ext\n\n    if spec.get(\"msvs_external_builder\"):\n        external_out_dir = spec.get(\"msvs_external_builder_out_dir\", \".\")\n        msbuild_attributes[\"OutputDirectory\"] = _FixPath(external_out_dir) + \"\\\\\"\n\n    # Make sure that 'TargetPath' matches 'Lib.OutputFile' or 'Link.OutputFile'\n    # (depending on the tool used) to avoid MSB8012 warning.\n    msbuild_tool_map = {\n        \"executable\": \"Link\",\n        \"shared_library\": \"Link\",\n        \"loadable_module\": \"Link\",\n        \"windows_driver\": \"Link\",\n        \"static_library\": \"Lib\",\n    }\n    if msbuild_tool := msbuild_tool_map.get(spec[\"type\"]):\n        msbuild_settings = config[\"finalized_msbuild_settings\"]\n        out_file = msbuild_settings[msbuild_tool].get(\"OutputFile\")\n        if out_file:\n            msbuild_attributes[\"TargetPath\"] = _FixPath(out_file)\n        target_ext = msbuild_settings[msbuild_tool].get(\"TargetExt\")\n        if target_ext:\n            msbuild_attributes[\"TargetExt\"] = target_ext\n\n    return msbuild_attributes\n\n\ndef _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):\n    # TODO(jeanluc) We could optimize out the following and do it only if\n    # there are actions.\n    # TODO(jeanluc) Handle the equivalent of setting 'CYGWIN=nontsec'.\n    new_paths = []\n    if cygwin_dirs := spec.get(\"msvs_cygwin_dirs\", [\".\"])[0]:\n        cyg_path = \"$(MSBuildProjectDirectory)\\\\%s\\\\bin\\\\\" % _FixPath(cygwin_dirs)\n        new_paths.append(cyg_path)\n        # TODO(jeanluc) Change the convention to have both a cygwin_dir and a\n        # python_dir.\n        python_path = cyg_path.replace(\"cygwin\\\\bin\", \"python_26\")\n        new_paths.append(python_path)\n        if new_paths:\n            new_paths = \"$(ExecutablePath);\" + \";\".join(new_paths)\n\n    properties = {}\n    for name, configuration in sorted(configurations.items()):\n        condition = _GetConfigurationCondition(name, configuration, spec)\n        attributes = _GetMSBuildAttributes(spec, configuration, build_file)\n        msbuild_settings = configuration[\"finalized_msbuild_settings\"]\n        _AddConditionalProperty(\n            properties, condition, \"IntDir\", attributes[\"IntermediateDirectory\"]\n        )\n        _AddConditionalProperty(\n            properties, condition, \"OutDir\", attributes[\"OutputDirectory\"]\n        )\n        _AddConditionalProperty(\n            properties, condition, \"TargetName\", attributes[\"TargetName\"]\n        )\n        if \"TargetExt\" in attributes:\n            _AddConditionalProperty(\n                properties, condition, \"TargetExt\", attributes[\"TargetExt\"]\n            )\n\n        if attributes.get(\"TargetPath\"):\n            _AddConditionalProperty(\n                properties, condition, \"TargetPath\", attributes[\"TargetPath\"]\n            )\n        if attributes.get(\"TargetExt\"):\n            _AddConditionalProperty(\n                properties, condition, \"TargetExt\", attributes[\"TargetExt\"]\n            )\n\n        if new_paths:\n            _AddConditionalProperty(properties, condition, \"ExecutablePath\", new_paths)\n        tool_settings = msbuild_settings.get(\"\", {})\n        for name, value in sorted(tool_settings.items()):\n            formatted_value = _GetValueFormattedForMSBuild(\"\", name, value)\n            _AddConditionalProperty(properties, condition, name, formatted_value)\n    return _GetMSBuildPropertyGroup(spec, None, properties)\n\n\ndef _AddConditionalProperty(properties, condition, name, value):\n    \"\"\"Adds a property / conditional value pair to a dictionary.\n\n    Arguments:\n      properties: The dictionary to be modified.  The key is the name of the\n          property.  The value is itself a dictionary; its key is the value and\n          the value a list of condition for which this value is true.\n      condition: The condition under which the named property has the value.\n      name: The name of the property.\n      value: The value of the property.\n    \"\"\"\n    if name not in properties:\n        properties[name] = {}\n    values = properties[name]\n    if value not in values:\n        values[value] = []\n    conditions = values[value]\n    conditions.append(condition)\n\n\n# Regex for msvs variable references ( i.e. $(FOO) ).\nMSVS_VARIABLE_REFERENCE = re.compile(r\"\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)\")\n\n\ndef _GetMSBuildPropertyGroup(spec, label, properties):\n    \"\"\"Returns a PropertyGroup definition for the specified properties.\n\n    Arguments:\n      spec: The target project dict.\n      label: An optional label for the PropertyGroup.\n      properties: The dictionary to be converted.  The key is the name of the\n          property.  The value is itself a dictionary; its key is the value and\n          the value a list of condition for which this value is true.\n    \"\"\"\n    group = [\"PropertyGroup\"]\n    if label:\n        group.append({\"Label\": label})\n    num_configurations = len(spec[\"configurations\"])\n\n    def GetEdges(node):\n        # Use a definition of edges such that user_of_variable -> used_variable.\n        # This happens to be easier in this case, since a variable's\n        # definition contains all variables it references in a single string.\n        edges = set()\n        for value in sorted(properties[node].keys()):\n            # Add to edges all $(...) references to variables.\n            #\n            # Variable references that refer to names not in properties are excluded\n            # These can exist for instance to refer built in definitions like\n            # $(SolutionDir).\n            #\n            # Self references are ignored. Self reference is used in a few places to\n            # append to the default value. I.e. PATH=$(PATH);other_path\n            edges.update(\n                {\n                    v\n                    for v in MSVS_VARIABLE_REFERENCE.findall(value)\n                    if v in properties and v != node\n                }\n            )\n        return edges\n\n    properties_ordered = gyp.common.TopologicallySorted(properties.keys(), GetEdges)\n    # Walk properties in the reverse of a topological sort on\n    # user_of_variable -> used_variable as this ensures variables are\n    # defined before they are used.\n    # NOTE: reverse(topsort(DAG)) = topsort(reverse_edges(DAG))\n    for name in reversed(properties_ordered):\n        values = properties[name]\n        for value, conditions in sorted(values.items()):\n            if len(conditions) == num_configurations:\n                # If the value is the same all configurations,\n                # just add one unconditional entry.\n                group.append([name, value])\n            else:\n                for condition in conditions:\n                    group.append([name, {\"Condition\": condition}, value])\n    return [group]\n\n\ndef _GetMSBuildToolSettingsSections(spec, configurations):\n    groups = []\n    for name, configuration in sorted(configurations.items()):\n        msbuild_settings = configuration[\"finalized_msbuild_settings\"]\n        group = [\n            \"ItemDefinitionGroup\",\n            {\"Condition\": _GetConfigurationCondition(name, configuration, spec)},\n        ]\n        for tool_name, tool_settings in sorted(msbuild_settings.items()):\n            # Skip the tool named '' which is a holder of global settings handled\n            # by _GetMSBuildConfigurationGlobalProperties.\n            if tool_name and tool_settings:\n                tool = [tool_name]\n                for name, value in sorted(tool_settings.items()):\n                    formatted_value = _GetValueFormattedForMSBuild(\n                        tool_name, name, value\n                    )\n                    tool.append([name, formatted_value])\n                group.append(tool)\n        groups.append(group)\n    return groups\n\n\ndef _FinalizeMSBuildSettings(spec, configuration):\n    if \"msbuild_settings\" in configuration:\n        converted = False\n        msbuild_settings = configuration[\"msbuild_settings\"]\n        MSVSSettings.ValidateMSBuildSettings(msbuild_settings)\n    else:\n        converted = True\n        msvs_settings = configuration.get(\"msvs_settings\", {})\n        msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings)\n    include_dirs, midl_include_dirs, resource_include_dirs = _GetIncludeDirs(\n        configuration\n    )\n    libraries = _GetLibraries(spec)\n    library_dirs = _GetLibraryDirs(configuration)\n    out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec, msbuild=True)\n    target_ext = _GetOutputTargetExt(spec)\n    defines = _GetDefines(configuration)\n    if converted:\n        # Visual Studio 2010 has TR1\n        defines = [d for d in defines if d != \"_HAS_TR1=0\"]\n        # Warn of ignored settings\n        ignored_settings = [\"msvs_tool_files\"]\n        for ignored_setting in ignored_settings:\n            value = configuration.get(ignored_setting)\n            if value:\n                print(\n                    \"Warning: The automatic conversion to MSBuild does not handle \"\n                    \"%s.  Ignoring setting of %s\" % (ignored_setting, str(value))\n                )\n\n    defines = [_EscapeCppDefineForMSBuild(d) for d in defines]\n    disabled_warnings = _GetDisabledWarnings(configuration)\n    prebuild = configuration.get(\"msvs_prebuild\")\n    postbuild = configuration.get(\"msvs_postbuild\")\n    def_file = _GetModuleDefinition(spec)\n\n    # Add the information to the appropriate tool\n    # TODO(jeanluc) We could optimize and generate these settings only if\n    # the corresponding files are found, e.g. don't generate ResourceCompile\n    # if you don't have any resources.\n    _ToolAppend(\n        msbuild_settings, \"ClCompile\", \"AdditionalIncludeDirectories\", include_dirs\n    )\n    _ToolAppend(\n        msbuild_settings, \"Midl\", \"AdditionalIncludeDirectories\", midl_include_dirs\n    )\n    _ToolAppend(\n        msbuild_settings,\n        \"ResourceCompile\",\n        \"AdditionalIncludeDirectories\",\n        resource_include_dirs,\n    )\n    # Add in libraries, note that even for empty libraries, we want this\n    # set, to prevent inheriting default libraries from the environment.\n    _ToolSetOrAppend(msbuild_settings, \"Link\", \"AdditionalDependencies\", libraries)\n    _ToolAppend(msbuild_settings, \"Link\", \"AdditionalLibraryDirectories\", library_dirs)\n    if out_file:\n        _ToolAppend(\n            msbuild_settings, msbuild_tool, \"OutputFile\", out_file, only_if_unset=True\n        )\n    if target_ext:\n        _ToolAppend(\n            msbuild_settings, msbuild_tool, \"TargetExt\", target_ext, only_if_unset=True\n        )\n    # Add defines.\n    _ToolAppend(msbuild_settings, \"ClCompile\", \"PreprocessorDefinitions\", defines)\n    _ToolAppend(msbuild_settings, \"ResourceCompile\", \"PreprocessorDefinitions\", defines)\n    # Add disabled warnings.\n    _ToolAppend(\n        msbuild_settings, \"ClCompile\", \"DisableSpecificWarnings\", disabled_warnings\n    )\n    # Turn on precompiled headers if appropriate.\n    if precompiled_header := configuration.get(\"msvs_precompiled_header\"):\n        # While MSVC works with just file name eg. \"v8_pch.h\", ClangCL requires\n        # the full path eg. \"tools/msvs/pch/v8_pch.h\" to find the file.\n        # P.S. Only ClangCL defines msbuild_toolset, for MSVC it is None.\n        if configuration.get(\"msbuild_toolset\") != \"ClangCL\":\n            precompiled_header = os.path.split(precompiled_header)[1]\n        _ToolAppend(msbuild_settings, \"ClCompile\", \"PrecompiledHeader\", \"Use\")\n        _ToolAppend(\n            msbuild_settings, \"ClCompile\", \"PrecompiledHeaderFile\", precompiled_header\n        )\n        _ToolAppend(\n            msbuild_settings, \"ClCompile\", \"ForcedIncludeFiles\", [precompiled_header]\n        )\n    else:\n        _ToolAppend(msbuild_settings, \"ClCompile\", \"PrecompiledHeader\", \"NotUsing\")\n    # Turn off WinRT compilation\n    _ToolAppend(msbuild_settings, \"ClCompile\", \"CompileAsWinRT\", \"false\")\n    # Turn on import libraries if appropriate\n    if spec.get(\"msvs_requires_importlibrary\"):\n        _ToolAppend(msbuild_settings, \"\", \"IgnoreImportLibrary\", \"false\")\n    # Loadable modules don't generate import libraries;\n    # tell dependent projects to not expect one.\n    if spec[\"type\"] == \"loadable_module\":\n        _ToolAppend(msbuild_settings, \"\", \"IgnoreImportLibrary\", \"true\")\n    # Set the module definition file if any.\n    if def_file:\n        _ToolAppend(msbuild_settings, \"Link\", \"ModuleDefinitionFile\", def_file)\n    configuration[\"finalized_msbuild_settings\"] = msbuild_settings\n    if prebuild:\n        _ToolAppend(msbuild_settings, \"PreBuildEvent\", \"Command\", prebuild)\n    if postbuild:\n        _ToolAppend(msbuild_settings, \"PostBuildEvent\", \"Command\", postbuild)\n\n\ndef _GetValueFormattedForMSBuild(tool_name, name, value):\n    if isinstance(value, list):\n        # For some settings, VS2010 does not automatically extends the settings\n        # TODO(jeanluc) Is this what we want?\n        if name in [\n            \"AdditionalIncludeDirectories\",\n            \"AdditionalLibraryDirectories\",\n            \"AdditionalOptions\",\n            \"DelayLoadDLLs\",\n            \"DisableSpecificWarnings\",\n            \"PreprocessorDefinitions\",\n        ]:\n            value.append(\"%%(%s)\" % name)\n        # For most tools, entries in a list should be separated with ';' but some\n        # settings use a space.  Check for those first.\n        exceptions = {\n            \"ClCompile\": [\"AdditionalOptions\"],\n            \"Link\": [\"AdditionalOptions\"],\n            \"Lib\": [\"AdditionalOptions\"],\n        }\n        char = \" \" if name in exceptions.get(tool_name, []) else \";\"\n        formatted_value = char.join(\n            [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in value]\n        )\n    else:\n        formatted_value = MSVSSettings.ConvertVCMacrosToMSBuild(value)\n    return formatted_value\n\n\ndef _VerifySourcesExist(sources, root_dir):\n    \"\"\"Verifies that all source files exist on disk.\n\n    Checks that all regular source files, i.e. not created at run time,\n    exist on disk.  Missing files cause needless recompilation but no otherwise\n    visible errors.\n\n    Arguments:\n      sources: A recursive list of Filter/file names.\n      root_dir: The root directory for the relative path names.\n    Returns:\n      A list of source files that cannot be found on disk.\n    \"\"\"\n    missing_sources = []\n    for source in sources:\n        if isinstance(source, MSVSProject.Filter):\n            missing_sources.extend(_VerifySourcesExist(source.contents, root_dir))\n        elif \"$\" not in source:\n            full_path = os.path.join(root_dir, source)\n            if not os.path.exists(full_path):\n                missing_sources.append(full_path)\n    return missing_sources\n\n\ndef _GetMSBuildSources(\n    spec,\n    sources,\n    exclusions,\n    rule_dependencies,\n    extension_to_rule_name,\n    actions_spec,\n    sources_handled_by_action,\n    list_excluded,\n):\n    groups = [\n        \"none\",\n        \"masm\",\n        \"midl\",\n        \"include\",\n        \"compile\",\n        \"resource\",\n        \"rule\",\n        \"rule_dependency\",\n    ]\n    grouped_sources = {}\n    for g in groups:\n        grouped_sources[g] = []\n\n    _AddSources2(\n        spec,\n        sources,\n        exclusions,\n        grouped_sources,\n        rule_dependencies,\n        extension_to_rule_name,\n        sources_handled_by_action,\n        list_excluded,\n    )\n    sources = []\n    for g in groups:\n        if grouped_sources[g]:\n            sources.append([\"ItemGroup\"] + grouped_sources[g])\n    if actions_spec:\n        sources.append([\"ItemGroup\"] + actions_spec)\n    return sources\n\n\ndef _AddSources2(\n    spec,\n    sources,\n    exclusions,\n    grouped_sources,\n    rule_dependencies,\n    extension_to_rule_name,\n    sources_handled_by_action,\n    list_excluded,\n):\n    extensions_excluded_from_precompile = []\n    for source in sources:\n        if isinstance(source, MSVSProject.Filter):\n            _AddSources2(\n                spec,\n                source.contents,\n                exclusions,\n                grouped_sources,\n                rule_dependencies,\n                extension_to_rule_name,\n                sources_handled_by_action,\n                list_excluded,\n            )\n        elif source not in sources_handled_by_action:\n            detail = []\n            excluded_configurations = exclusions.get(source, [])\n            if len(excluded_configurations) == len(spec[\"configurations\"]):\n                detail.append([\"ExcludedFromBuild\", \"true\"])\n            else:\n                for config_name, configuration in sorted(excluded_configurations):\n                    condition = _GetConfigurationCondition(config_name, configuration)\n                    detail.append(\n                        [\"ExcludedFromBuild\", {\"Condition\": condition}, \"true\"]\n                    )\n            # Add precompile if needed\n            for config_name, configuration in spec[\"configurations\"].items():\n                precompiled_source = configuration.get(\"msvs_precompiled_source\", \"\")\n                if precompiled_source != \"\":\n                    precompiled_source = _FixPath(precompiled_source)\n                    if not extensions_excluded_from_precompile:\n                        # If the precompiled header is generated by a C source,\n                        # we must not try to use it for C++ sources,\n                        # and vice versa.\n                        _basename, extension = os.path.splitext(precompiled_source)\n                        if extension == \".c\":\n                            extensions_excluded_from_precompile = [\n                                \".cc\",\n                                \".cpp\",\n                                \".cxx\",\n                            ]\n                        else:\n                            extensions_excluded_from_precompile = [\".c\"]\n\n                if precompiled_source == source:\n                    condition = _GetConfigurationCondition(\n                        config_name, configuration, spec\n                    )\n                    detail.append(\n                        [\"PrecompiledHeader\", {\"Condition\": condition}, \"Create\"]\n                    )\n                else:\n                    # Turn off precompiled header usage for source files of a\n                    # different type than the file that generated the\n                    # precompiled header.\n                    for extension in extensions_excluded_from_precompile:\n                        if source.endswith(extension):\n                            detail.append([\"PrecompiledHeader\", \"\"])\n                            detail.append([\"ForcedIncludeFiles\", \"\"])\n\n            group, element = _MapFileToMsBuildSourceType(\n                source,\n                rule_dependencies,\n                extension_to_rule_name,\n                _GetUniquePlatforms(spec),\n                spec[\"toolset\"],\n            )\n            if group == \"compile\" and not os.path.isabs(source):\n                # Add an <ObjectFileName> value to support duplicate source\n                # file basenames, except for absolute paths to avoid paths\n                # with more than 260 characters.\n                file_name = os.path.splitext(source)[0] + \".obj\"\n                if file_name.startswith(\"..\\\\\"):\n                    file_name = re.sub(r\"^(\\.\\.\\\\)+\", \"\", file_name)\n                elif file_name.startswith(\"$(\"):\n                    file_name = re.sub(r\"^\\$\\([^)]+\\)\\\\\", \"\", file_name)\n                detail.append([\"ObjectFileName\", \"$(IntDir)\\\\\" + file_name])\n            grouped_sources[group].append([element, {\"Include\": source}] + detail)\n\n\ndef _GetMSBuildProjectReferences(project):\n    references = []\n    if project.dependencies:\n        group = [\"ItemGroup\"]\n        added_dependency_set = set()\n        for dependency in project.dependencies:\n            dependency_spec = dependency.spec\n            should_skip_dep = False\n            if project.spec[\"toolset\"] == \"target\":\n                if dependency_spec[\"toolset\"] == \"host\":\n                    if dependency_spec[\"type\"] == \"static_library\":\n                        should_skip_dep = True\n            if dependency.name.startswith(\"run_\"):\n                should_skip_dep = False\n            if should_skip_dep:\n                continue\n\n            canonical_name = dependency.name.replace(\"_host\", \"\")\n            added_dependency_set.add(canonical_name)\n            guid = dependency.guid\n            project_dir = os.path.split(project.path)[0]\n            relative_path = gyp.common.RelativePath(dependency.path, project_dir)\n            project_ref = [\n                \"ProjectReference\",\n                {\"Include\": relative_path},\n                [\"Project\", guid],\n                [\"ReferenceOutputAssembly\", \"false\"],\n            ]\n            for config in dependency.spec.get(\"configurations\", {}).values():\n                if config.get(\"msvs_use_library_dependency_inputs\", 0):\n                    project_ref.append([\"UseLibraryDependencyInputs\", \"true\"])\n                    break\n                # If it's disabled in any config, turn it off in the reference.\n                if config.get(\"msvs_2010_disable_uldi_when_referenced\", 0):\n                    project_ref.append([\"UseLibraryDependencyInputs\", \"false\"])\n                    break\n            group.append(project_ref)\n        references.append(group)\n    return references\n\n\ndef _GenerateMSBuildProject(project, options, version, generator_flags, spec):\n    spec = project.spec\n    configurations = spec[\"configurations\"]\n    toolset = spec[\"toolset\"]\n    project_dir, project_file_name = os.path.split(project.path)\n    gyp.common.EnsureDirExists(project.path)\n    # Prepare list of sources and excluded sources.\n\n    gyp_file = os.path.split(project.build_file)[1]\n    sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, gyp_file)\n    # Add rules.\n    actions_to_add = {}\n    props_files_of_rules = set()\n    targets_files_of_rules = set()\n    rule_dependencies = set()\n    extension_to_rule_name = {}\n    list_excluded = generator_flags.get(\"msvs_list_excluded_files\", True)\n    platforms = _GetUniquePlatforms(spec)\n\n    # Don't generate rules if we are using an external builder like ninja.\n    if not spec.get(\"msvs_external_builder\"):\n        _GenerateRulesForMSBuild(\n            project_dir,\n            options,\n            spec,\n            sources,\n            excluded_sources,\n            props_files_of_rules,\n            targets_files_of_rules,\n            actions_to_add,\n            rule_dependencies,\n            extension_to_rule_name,\n        )\n    else:\n        rules = spec.get(\"rules\", [])\n        _AdjustSourcesForRules(rules, sources, excluded_sources, True)\n\n    sources, excluded_sources, excluded_idl = _AdjustSourcesAndConvertToFilterHierarchy(\n        spec, options, project_dir, sources, excluded_sources, list_excluded, version\n    )\n\n    # Don't add actions if we are using an external builder like ninja.\n    if not spec.get(\"msvs_external_builder\"):\n        _AddActions(actions_to_add, spec, project.build_file)\n        _AddCopies(actions_to_add, spec)\n\n        # NOTE: this stanza must appear after all actions have been decided.\n        # Don't excluded sources with actions attached, or they won't run.\n        excluded_sources = _FilterActionsFromExcluded(excluded_sources, actions_to_add)\n\n    exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl)\n    actions_spec, sources_handled_by_action = _GenerateActionsForMSBuild(\n        spec, actions_to_add\n    )\n\n    _GenerateMSBuildFiltersFile(\n        project.path + \".filters\",\n        sources,\n        rule_dependencies,\n        extension_to_rule_name,\n        platforms,\n        toolset,\n    )\n    missing_sources = _VerifySourcesExist(sources, project_dir)\n\n    for configuration in configurations.values():\n        _FinalizeMSBuildSettings(spec, configuration)\n\n    # Add attributes to root element\n\n    import_default_section = [\n        [\"Import\", {\"Project\": r\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\"}]\n    ]\n    import_cpp_props_section = [\n        [\"Import\", {\"Project\": r\"$(VCTargetsPath)\\Microsoft.Cpp.props\"}]\n    ]\n    import_cpp_targets_section = [\n        [\"Import\", {\"Project\": r\"$(VCTargetsPath)\\Microsoft.Cpp.targets\"}]\n    ]\n    import_masm_props_section = [\n        [\"Import\", {\"Project\": r\"$(VCTargetsPath)\\BuildCustomizations\\masm.props\"}]\n    ]\n    import_masm_targets_section = [\n        [\"Import\", {\"Project\": r\"$(VCTargetsPath)\\BuildCustomizations\\masm.targets\"}]\n    ]\n    import_marmasm_props_section = [\n        [\"Import\", {\"Project\": r\"$(VCTargetsPath)\\BuildCustomizations\\marmasm.props\"}]\n    ]\n    import_marmasm_targets_section = [\n        [\"Import\", {\"Project\": r\"$(VCTargetsPath)\\BuildCustomizations\\marmasm.targets\"}]\n    ]\n    macro_section = [[\"PropertyGroup\", {\"Label\": \"UserMacros\"}]]\n\n    content = [\n        \"Project\",\n        {\n            \"xmlns\": \"http://schemas.microsoft.com/developer/msbuild/2003\",\n            \"ToolsVersion\": version.ProjectVersion(),\n            \"DefaultTargets\": \"Build\",\n        },\n    ]\n\n    content += _GetMSBuildProjectConfigurations(configurations, spec)\n    content += _GetMSBuildGlobalProperties(\n        spec, version, project.guid, project_file_name\n    )\n    content += import_default_section\n    content += _GetMSBuildConfigurationDetails(spec, project.build_file)\n    if spec.get(\"msvs_enable_winphone\"):\n        content += _GetMSBuildLocalProperties(\"v120_wp81\")\n    else:\n        content += _GetMSBuildLocalProperties(project.msbuild_toolset)\n    content += import_cpp_props_section\n    content += import_masm_props_section\n    if \"arm64\" in platforms and toolset == \"target\":\n        content += import_marmasm_props_section\n    content += _GetMSBuildExtensions(props_files_of_rules)\n    content += _GetMSBuildPropertySheets(configurations, spec)\n    content += macro_section\n    content += _GetMSBuildConfigurationGlobalProperties(\n        spec, configurations, project.build_file\n    )\n    content += _GetMSBuildToolSettingsSections(spec, configurations)\n    content += _GetMSBuildSources(\n        spec,\n        sources,\n        exclusions,\n        rule_dependencies,\n        extension_to_rule_name,\n        actions_spec,\n        sources_handled_by_action,\n        list_excluded,\n    )\n    content += _GetMSBuildProjectReferences(project)\n    content += import_cpp_targets_section\n    content += import_masm_targets_section\n    if \"arm64\" in platforms and toolset == \"target\":\n        content += import_marmasm_targets_section\n    content += _GetMSBuildExtensionTargets(targets_files_of_rules)\n\n    if spec.get(\"msvs_external_builder\"):\n        content += _GetMSBuildExternalBuilderTargets(spec)\n\n    # TODO(jeanluc) File a bug to get rid of runas.  We had in MSVS:\n    # has_run_as = _WriteMSVSUserFile(project.path, version, spec)\n\n    easy_xml.WriteXmlIfChanged(content, project.path, pretty=True, win32=True)\n\n    return missing_sources\n\n\ndef _GetMSBuildExternalBuilderTargets(spec):\n    \"\"\"Return a list of MSBuild targets for external builders.\n\n    The \"Build\" and \"Clean\" targets are always generated.  If the spec contains\n    'msvs_external_builder_clcompile_cmd', then the \"ClCompile\" target will also\n    be generated, to support building selected C/C++ files.\n\n    Arguments:\n      spec: The gyp target spec.\n    Returns:\n      List of MSBuild 'Target' specs.\n    \"\"\"\n    build_cmd = _BuildCommandLineForRuleRaw(\n        spec, spec[\"msvs_external_builder_build_cmd\"], False, False, False, False\n    )\n    build_target = [\"Target\", {\"Name\": \"Build\"}]\n    build_target.append([\"Exec\", {\"Command\": build_cmd}])\n\n    clean_cmd = _BuildCommandLineForRuleRaw(\n        spec, spec[\"msvs_external_builder_clean_cmd\"], False, False, False, False\n    )\n    clean_target = [\"Target\", {\"Name\": \"Clean\"}]\n    clean_target.append([\"Exec\", {\"Command\": clean_cmd}])\n\n    targets = [build_target, clean_target]\n\n    if spec.get(\"msvs_external_builder_clcompile_cmd\"):\n        clcompile_cmd = _BuildCommandLineForRuleRaw(\n            spec,\n            spec[\"msvs_external_builder_clcompile_cmd\"],\n            False,\n            False,\n            False,\n            False,\n        )\n        clcompile_target = [\"Target\", {\"Name\": \"ClCompile\"}]\n        clcompile_target.append([\"Exec\", {\"Command\": clcompile_cmd}])\n        targets.append(clcompile_target)\n\n    return targets\n\n\ndef _GetMSBuildExtensions(props_files_of_rules):\n    extensions = [\"ImportGroup\", {\"Label\": \"ExtensionSettings\"}]\n    for props_file in props_files_of_rules:\n        extensions.append([\"Import\", {\"Project\": props_file}])\n    return [extensions]\n\n\ndef _GetMSBuildExtensionTargets(targets_files_of_rules):\n    targets_node = [\"ImportGroup\", {\"Label\": \"ExtensionTargets\"}]\n    for targets_file in sorted(targets_files_of_rules):\n        targets_node.append([\"Import\", {\"Project\": targets_file}])\n    return [targets_node]\n\n\ndef _GenerateActionsForMSBuild(spec, actions_to_add):\n    \"\"\"Add actions accumulated into an actions_to_add, merging as needed.\n\n    Arguments:\n      spec: the target project dict\n      actions_to_add: dictionary keyed on input name, which maps to a list of\n          dicts describing the actions attached to that input file.\n\n    Returns:\n      A pair of (action specification, the sources handled by this action).\n    \"\"\"\n    sources_handled_by_action = OrderedSet()\n    actions_spec = []\n    for primary_input, actions in actions_to_add.items():\n        if generator_supports_multiple_toolsets:\n            primary_input = primary_input.replace(\".exe\", \"_host.exe\")\n        inputs = OrderedSet()\n        outputs = OrderedSet()\n        descriptions = []\n        commands = []\n        for action in actions:\n\n            def fixup_host_exe(i):\n                if \"$(OutDir)\" in i:\n                    i = i.replace(\".exe\", \"_host.exe\")\n                return i\n\n            if generator_supports_multiple_toolsets:\n                action[\"inputs\"] = [fixup_host_exe(i) for i in action[\"inputs\"]]\n            inputs.update(OrderedSet(action[\"inputs\"]))\n            outputs.update(OrderedSet(action[\"outputs\"]))\n            descriptions.append(action[\"description\"])\n            cmd = action[\"command\"]\n            if generator_supports_multiple_toolsets:\n                cmd = cmd.replace(\".exe\", \"_host.exe\")\n            # For most actions, add 'call' so that actions that invoke batch files\n            # return and continue executing.  msbuild_use_call provides a way to\n            # disable this but I have not seen any adverse effect from doing that\n            # for everything.\n            if action.get(\"msbuild_use_call\", True):\n                cmd = \"call \" + cmd\n            commands.append(cmd)\n        # Add the custom build action for one input file.\n        description = \", and also \".join(descriptions)\n\n        # We can't join the commands simply with && because the command line will\n        # get too long. See also _AddActions: cygwin's setup_env mustn't be called\n        # for every invocation or the command that sets the PATH will grow too\n        # long.\n        command = \"\\r\\n\".join(\n            [c + \"\\r\\nif %errorlevel% neq 0 exit /b %errorlevel%\" for c in commands]\n        )\n        _AddMSBuildAction(\n            spec,\n            primary_input,\n            inputs,\n            outputs,\n            command,\n            description,\n            sources_handled_by_action,\n            actions_spec,\n        )\n    return actions_spec, sources_handled_by_action\n\n\ndef _AddMSBuildAction(\n    spec,\n    primary_input,\n    inputs,\n    outputs,\n    cmd,\n    description,\n    sources_handled_by_action,\n    actions_spec,\n):\n    command = MSVSSettings.ConvertVCMacrosToMSBuild(cmd)\n    primary_input = _FixPath(primary_input)\n    inputs_array = _FixPaths(inputs)\n    outputs_array = _FixPaths(outputs)\n    additional_inputs = \";\".join([i for i in inputs_array if i != primary_input])\n    outputs = \";\".join(outputs_array)\n    sources_handled_by_action.add(primary_input)\n    action_spec = [\"CustomBuild\", {\"Include\": primary_input}]\n    action_spec.extend(\n        # TODO(jeanluc) 'Document' for all or just if as_sources?\n        [\n            [\"FileType\", \"Document\"],\n            [\"Command\", command],\n            [\"Message\", description],\n            [\"Outputs\", outputs],\n        ]\n    )\n    if additional_inputs:\n        action_spec.append([\"AdditionalInputs\", additional_inputs])\n    actions_spec.append(action_spec)\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/msvs_test.py",
    "content": "#!/usr/bin/env python3\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Unit tests for the msvs.py file.\"\"\"\n\nimport unittest\nfrom io import StringIO\n\nfrom gyp.generator import msvs\n\n\nclass TestSequenceFunctions(unittest.TestCase):\n    def setUp(self):\n        self.stderr = StringIO()\n\n    def test_GetLibraries(self):\n        self.assertEqual(msvs._GetLibraries({}), [])\n        self.assertEqual(msvs._GetLibraries({\"libraries\": []}), [])\n        self.assertEqual(\n            msvs._GetLibraries({\"other\": \"foo\", \"libraries\": [\"a.lib\"]}), [\"a.lib\"]\n        )\n        self.assertEqual(msvs._GetLibraries({\"libraries\": [\"-la\"]}), [\"a.lib\"])\n        self.assertEqual(\n            msvs._GetLibraries(\n                {\n                    \"libraries\": [\n                        \"a.lib\",\n                        \"b.lib\",\n                        \"c.lib\",\n                        \"-lb.lib\",\n                        \"-lb.lib\",\n                        \"d.lib\",\n                        \"a.lib\",\n                    ]\n                }\n            ),\n            [\"c.lib\", \"b.lib\", \"d.lib\", \"a.lib\"],\n        )\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/ninja.py",
    "content": "# Copyright (c) 2013 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\nimport collections\nimport copy\nimport ctypes\nimport hashlib\nimport json\nimport multiprocessing\nimport os.path\nimport re\nimport shutil\nimport signal\nimport subprocess\nimport sys\nfrom io import StringIO\n\nimport gyp\nimport gyp.common\nimport gyp.msvs_emulation\nimport gyp.xcode_emulation\nfrom gyp import MSVSUtil, ninja_syntax\nfrom gyp.common import GetEnvironFallback\n\ngenerator_default_variables = {\n    \"EXECUTABLE_PREFIX\": \"\",\n    \"EXECUTABLE_SUFFIX\": \"\",\n    \"STATIC_LIB_PREFIX\": \"lib\",\n    \"STATIC_LIB_SUFFIX\": \".a\",\n    \"SHARED_LIB_PREFIX\": \"lib\",\n    # Gyp expects the following variables to be expandable by the build\n    # system to the appropriate locations.  Ninja prefers paths to be\n    # known at gyp time.  To resolve this, introduce special\n    # variables starting with $! and $| (which begin with a $ so gyp knows it\n    # should be treated specially, but is otherwise an invalid\n    # ninja/shell variable) that are passed to gyp here but expanded\n    # before writing out into the target .ninja files; see\n    # ExpandSpecial.\n    # $! is used for variables that represent a path and that can only appear at\n    # the start of a string, while $| is used for variables that can appear\n    # anywhere in a string.\n    \"INTERMEDIATE_DIR\": \"$!INTERMEDIATE_DIR\",\n    \"SHARED_INTERMEDIATE_DIR\": \"$!PRODUCT_DIR/gen\",\n    \"PRODUCT_DIR\": \"$!PRODUCT_DIR\",\n    \"CONFIGURATION_NAME\": \"$|CONFIGURATION_NAME\",\n    # Special variables that may be used by gyp 'rule' targets.\n    # We generate definitions for these variables on the fly when processing a\n    # rule.\n    \"RULE_INPUT_ROOT\": \"${root}\",\n    \"RULE_INPUT_DIRNAME\": \"${dirname}\",\n    \"RULE_INPUT_PATH\": \"${source}\",\n    \"RULE_INPUT_EXT\": \"${ext}\",\n    \"RULE_INPUT_NAME\": \"${name}\",\n}\n\n# Placates pylint.\ngenerator_additional_non_configuration_keys = []\ngenerator_additional_path_sections = []\ngenerator_extra_sources_for_rules = []\ngenerator_filelist_paths = None\n\ngenerator_supports_multiple_toolsets = gyp.common.CrossCompileRequested()\n\n\ndef StripPrefix(arg, prefix):\n    if arg.startswith(prefix):\n        return arg[len(prefix) :]\n    return arg\n\n\ndef QuoteShellArgument(arg, flavor):\n    \"\"\"Quote a string such that it will be interpreted as a single argument\n    by the shell.\"\"\"\n    # Rather than attempting to enumerate the bad shell characters, just\n    # allow common OK ones and quote anything else.\n    if re.match(r\"^[a-zA-Z0-9_=.\\\\/-]+$\", arg):\n        return arg  # No quoting necessary.\n    if flavor == \"win\":\n        return gyp.msvs_emulation.QuoteForRspFile(arg)\n    return \"'\" + arg.replace(\"'\", \"'\" + '\"\\'\"' + \"'\") + \"'\"\n\n\ndef Define(d, flavor):\n    \"\"\"Takes a preprocessor define and returns a -D parameter that's ninja- and\n    shell-escaped.\"\"\"\n    if flavor == \"win\":\n        # cl.exe replaces literal # characters with = in preprocessor definitions for\n        # some reason. Octal-encode to work around that.\n        d = d.replace(\"#\", \"\\\\%03o\" % ord(\"#\"))\n    return QuoteShellArgument(ninja_syntax.escape(\"-D\" + d), flavor)\n\n\ndef AddArch(output, arch):\n    \"\"\"Adds an arch string to an output path.\"\"\"\n    output, extension = os.path.splitext(output)\n    return f\"{output}.{arch}{extension}\"\n\n\nclass Target:\n    \"\"\"Target represents the paths used within a single gyp target.\n\n    Conceptually, building a single target A is a series of steps:\n\n    1) actions/rules/copies  generates source/resources/etc.\n    2) compiles              generates .o files\n    3) link                  generates a binary (library/executable)\n    4) bundle                merges the above in a mac bundle\n\n    (Any of these steps can be optional.)\n\n    From a build ordering perspective, a dependent target B could just\n    depend on the last output of this series of steps.\n\n    But some dependent commands sometimes need to reach inside the box.\n    For example, when linking B it needs to get the path to the static\n    library generated by A.\n\n    This object stores those paths.  To keep things simple, member\n    variables only store concrete paths to single files, while methods\n    compute derived values like \"the last output of the target\".\n    \"\"\"\n\n    def __init__(self, type):\n        # Gyp type (\"static_library\", etc.) of this target.\n        self.type = type\n        # File representing whether any input dependencies necessary for\n        # dependent actions have completed.\n        self.preaction_stamp = None\n        # File representing whether any input dependencies necessary for\n        # dependent compiles have completed.\n        self.precompile_stamp = None\n        # File representing the completion of actions/rules/copies, if any.\n        self.actions_stamp = None\n        # Path to the output of the link step, if any.\n        self.binary = None\n        # Path to the file representing the completion of building the bundle,\n        # if any.\n        self.bundle = None\n        # On Windows, incremental linking requires linking against all the .objs\n        # that compose a .lib (rather than the .lib itself). That list is stored\n        # here. In this case, we also need to save the compile_deps for the target,\n        # so that the target that directly depends on the .objs can also depend\n        # on those.\n        self.component_objs = None\n        self.compile_deps = None\n        # Windows only. The import .lib is the output of a build step, but\n        # because dependents only link against the lib (not both the lib and the\n        # dll) we keep track of the import library here.\n        self.import_lib = None\n        # Track if this target contains any C++ files, to decide if gcc or g++\n        # should be used for linking.\n        self.uses_cpp = False\n\n    def Linkable(self):\n        \"\"\"Return true if this is a target that can be linked against.\"\"\"\n        return self.type in (\"static_library\", \"shared_library\")\n\n    def UsesToc(self, flavor):\n        \"\"\"Return true if the target should produce a restat rule based on a TOC\n        file.\"\"\"\n        # For bundles, the .TOC should be produced for the binary, not for\n        # FinalOutput(). But the naive approach would put the TOC file into the\n        # bundle, so don't do this for bundles for now.\n        if flavor == \"win\" or self.bundle:\n            return False\n        return self.type in (\"shared_library\", \"loadable_module\")\n\n    def PreActionInput(self, flavor):\n        \"\"\"Return the path, if any, that should be used as a dependency of\n        any dependent action step.\"\"\"\n        if self.UsesToc(flavor):\n            return self.FinalOutput() + \".TOC\"\n        return self.FinalOutput() or self.preaction_stamp\n\n    def PreCompileInput(self):\n        \"\"\"Return the path, if any, that should be used as a dependency of\n        any dependent compile step.\"\"\"\n        return self.actions_stamp or self.precompile_stamp\n\n    def FinalOutput(self):\n        \"\"\"Return the last output of the target, which depends on all prior\n        steps.\"\"\"\n        return self.bundle or self.binary or self.actions_stamp\n\n\n# A small discourse on paths as used within the Ninja build:\n# All files we produce (both at gyp and at build time) appear in the\n# build directory (e.g. out/Debug).\n#\n# Paths within a given .gyp file are always relative to the directory\n# containing the .gyp file.  Call these \"gyp paths\".  This includes\n# sources as well as the starting directory a given gyp rule/action\n# expects to be run from.  We call the path from the source root to\n# the gyp file the \"base directory\" within the per-.gyp-file\n# NinjaWriter code.\n#\n# All paths as written into the .ninja files are relative to the build\n# directory.  Call these paths \"ninja paths\".\n#\n# We translate between these two notions of paths with two helper\n# functions:\n#\n# - GypPathToNinja translates a gyp path (i.e. relative to the .gyp file)\n#   into the equivalent ninja path.\n#\n# - GypPathToUniqueOutput translates a gyp path into a ninja path to write\n#   an output file; the result can be namespaced such that it is unique\n#   to the input file name as well as the output target name.\n\n\nclass NinjaWriter:\n    def __init__(\n        self,\n        hash_for_rules,\n        target_outputs,\n        base_dir,\n        build_dir,\n        output_file,\n        toplevel_build,\n        output_file_name,\n        flavor,\n        toplevel_dir=None,\n    ):\n        \"\"\"\n        base_dir: path from source root to directory containing this gyp file,\n                  by gyp semantics, all input paths are relative to this\n        build_dir: path from source root to build output\n        toplevel_dir: path to the toplevel directory\n        \"\"\"\n\n        self.hash_for_rules = hash_for_rules\n        self.target_outputs = target_outputs\n        self.base_dir = base_dir\n        self.build_dir = build_dir\n        self.ninja = ninja_syntax.Writer(output_file)\n        self.toplevel_build = toplevel_build\n        self.output_file_name = output_file_name\n\n        self.flavor = flavor\n        self.abs_build_dir = None\n        if toplevel_dir is not None:\n            self.abs_build_dir = os.path.abspath(os.path.join(toplevel_dir, build_dir))\n        self.obj_ext = \".obj\" if flavor == \"win\" else \".o\"\n        if flavor == \"win\":\n            # See docstring of msvs_emulation.GenerateEnvironmentFiles().\n            self.win_env = {}\n            for arch in (\"x86\", \"x64\"):\n                self.win_env[arch] = \"environment.\" + arch\n\n        # Relative path from build output dir to base dir.\n        build_to_top = gyp.common.InvertRelativePath(build_dir, toplevel_dir)\n        self.build_to_base = os.path.join(build_to_top, base_dir)\n        # Relative path from base dir to build dir.\n        base_to_top = gyp.common.InvertRelativePath(base_dir, toplevel_dir)\n        self.base_to_build = os.path.join(base_to_top, build_dir)\n\n    def ExpandSpecial(self, path, product_dir=None):\n        \"\"\"Expand specials like $!PRODUCT_DIR in |path|.\n\n        If |product_dir| is None, assumes the cwd is already the product\n        dir.  Otherwise, |product_dir| is the relative path to the product\n        dir.\n        \"\"\"\n\n        if (PRODUCT_DIR := \"$!PRODUCT_DIR\") in path:\n            if product_dir:\n                path = path.replace(PRODUCT_DIR, product_dir)\n            else:\n                path = path.replace(PRODUCT_DIR + \"/\", \"\")\n                path = path.replace(PRODUCT_DIR + \"\\\\\", \"\")\n                path = path.replace(PRODUCT_DIR, \".\")\n\n        if (INTERMEDIATE_DIR := \"$!INTERMEDIATE_DIR\") in path:\n            int_dir = self.GypPathToUniqueOutput(\"gen\")\n            # GypPathToUniqueOutput generates a path relative to the product dir,\n            # so insert product_dir in front if it is provided.\n            path = path.replace(\n                INTERMEDIATE_DIR, os.path.join(product_dir or \"\", int_dir)\n            )\n\n        CONFIGURATION_NAME = \"$|CONFIGURATION_NAME\"\n        path = path.replace(CONFIGURATION_NAME, self.config_name)\n\n        return path\n\n    def ExpandRuleVariables(self, path, root, dirname, source, ext, name):\n        if self.flavor == \"win\":\n            path = self.msvs_settings.ConvertVSMacros(path, config=self.config_name)\n        path = path.replace(generator_default_variables[\"RULE_INPUT_ROOT\"], root)\n        path = path.replace(generator_default_variables[\"RULE_INPUT_DIRNAME\"], dirname)\n        path = path.replace(generator_default_variables[\"RULE_INPUT_PATH\"], source)\n        path = path.replace(generator_default_variables[\"RULE_INPUT_EXT\"], ext)\n        path = path.replace(generator_default_variables[\"RULE_INPUT_NAME\"], name)\n        return path\n\n    def GypPathToNinja(self, path, env=None):\n        \"\"\"Translate a gyp path to a ninja path, optionally expanding environment\n        variable references in |path| with |env|.\n\n        See the above discourse on path conversions.\"\"\"\n        if env:\n            if self.flavor == \"mac\":\n                path = gyp.xcode_emulation.ExpandEnvVars(path, env)\n            elif self.flavor == \"win\":\n                path = gyp.msvs_emulation.ExpandMacros(path, env)\n        if path.startswith(\"$!\"):\n            expanded = self.ExpandSpecial(path)\n            if self.flavor == \"win\":\n                expanded = os.path.normpath(expanded)\n            return expanded\n        if \"$|\" in path:\n            path = self.ExpandSpecial(path)\n        assert \"$\" not in path, path\n        return os.path.normpath(os.path.join(self.build_to_base, path))\n\n    def GypPathToUniqueOutput(self, path, qualified=True):\n        \"\"\"Translate a gyp path to a ninja path for writing output.\n\n        If qualified is True, qualify the resulting filename with the name\n        of the target.  This is necessary when e.g. compiling the same\n        path twice for two separate output targets.\n\n        See the above discourse on path conversions.\"\"\"\n\n        path = self.ExpandSpecial(path)\n        assert not path.startswith(\"$\"), path\n\n        # Translate the path following this scheme:\n        #   Input: foo/bar.gyp, target targ, references baz/out.o\n        #   Output: obj/foo/baz/targ.out.o (if qualified)\n        #           obj/foo/baz/out.o (otherwise)\n        #     (and obj.host instead of obj for cross-compiles)\n        #\n        # Why this scheme and not some other one?\n        # 1) for a given input, you can compute all derived outputs by matching\n        #    its path, even if the input is brought via a gyp file with '..'.\n        # 2) simple files like libraries and stamps have a simple filename.\n\n        obj = \"obj\"\n        if self.toolset != \"target\":\n            obj += \".\" + self.toolset\n\n        path_dir, path_basename = os.path.split(path)\n        assert not os.path.isabs(path_dir), (\n            \"'%s' can not be absolute path (see crbug.com/462153).\" % path_dir\n        )\n\n        if qualified:\n            path_basename = self.name + \".\" + path_basename\n        return os.path.normpath(\n            os.path.join(obj, self.base_dir, path_dir, path_basename)\n        )\n\n    def WriteCollapsedDependencies(self, name, targets, order_only=None):\n        \"\"\"Given a list of targets, return a path for a single file\n        representing the result of building all the targets or None.\n\n        Uses a stamp file if necessary.\"\"\"\n\n        assert targets == [item for item in targets if item], targets\n        if len(targets) == 0:\n            assert not order_only\n            return None\n        if len(targets) > 1 or order_only:\n            stamp = self.GypPathToUniqueOutput(name + \".stamp\")\n            targets = self.ninja.build(stamp, \"stamp\", targets, order_only=order_only)\n            self.ninja.newline()\n        return targets[0]\n\n    def _SubninjaNameForArch(self, arch):\n        output_file_base = os.path.splitext(self.output_file_name)[0]\n        return f\"{output_file_base}.{arch}.ninja\"\n\n    def WriteSpec(self, spec, config_name, generator_flags):\n        \"\"\"The main entry point for NinjaWriter: write the build rules for a spec.\n\n        Returns a Target object, which represents the output paths for this spec.\n        Returns None if there are no outputs (e.g. a settings-only 'none' type\n        target).\"\"\"\n\n        self.config_name = config_name\n        self.name = spec[\"target_name\"]\n        self.toolset = spec[\"toolset\"]\n        config = spec[\"configurations\"][config_name]\n        self.target = Target(spec[\"type\"])\n        self.is_standalone_static_library = bool(\n            spec.get(\"standalone_static_library\", 0)\n        )\n\n        self.target_rpath = generator_flags.get(\"target_rpath\", r\"\\$$ORIGIN/lib/\")\n\n        self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec)\n        self.xcode_settings = self.msvs_settings = None\n        if self.flavor == \"mac\":\n            self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec)\n            mac_toolchain_dir = generator_flags.get(\"mac_toolchain_dir\", None)\n            if mac_toolchain_dir:\n                self.xcode_settings.mac_toolchain_dir = mac_toolchain_dir\n\n        if self.flavor == \"win\":\n            self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, generator_flags)\n            arch = self.msvs_settings.GetArch(config_name)\n            self.ninja.variable(\"arch\", self.win_env[arch])\n            self.ninja.variable(\"cc\", \"$cl_\" + arch)\n            self.ninja.variable(\"cxx\", \"$cl_\" + arch)\n            self.ninja.variable(\"cc_host\", \"$cl_\" + arch)\n            self.ninja.variable(\"cxx_host\", \"$cl_\" + arch)\n            self.ninja.variable(\"asm\", \"$ml_\" + arch)\n\n        if self.flavor == \"mac\":\n            self.archs = self.xcode_settings.GetActiveArchs(config_name)\n            if len(self.archs) > 1:\n                self.arch_subninjas = {\n                    arch: ninja_syntax.Writer(\n                        OpenOutput(\n                            os.path.join(\n                                self.toplevel_build, self._SubninjaNameForArch(arch)\n                            ),\n                            \"w\",\n                        )\n                    )\n                    for arch in self.archs\n                }\n\n        # Compute predepends for all rules.\n        # actions_depends is the dependencies this target depends on before running\n        # any of its action/rule/copy steps.\n        # compile_depends is the dependencies this target depends on before running\n        # any of its compile steps.\n        actions_depends = []\n        compile_depends = []\n        # TODO(evan): it is rather confusing which things are lists and which\n        # are strings.  Fix these.\n        if \"dependencies\" in spec:\n            for dep in spec[\"dependencies\"]:\n                if dep in self.target_outputs:\n                    target = self.target_outputs[dep]\n                    actions_depends.append(target.PreActionInput(self.flavor))\n                    compile_depends.append(target.PreCompileInput())\n                    if target.uses_cpp:\n                        self.target.uses_cpp = True\n            actions_depends = [item for item in actions_depends if item]\n            compile_depends = [item for item in compile_depends if item]\n            actions_depends = self.WriteCollapsedDependencies(\n                \"actions_depends\", actions_depends\n            )\n            compile_depends = self.WriteCollapsedDependencies(\n                \"compile_depends\", compile_depends\n            )\n            self.target.preaction_stamp = actions_depends\n            self.target.precompile_stamp = compile_depends\n\n        # Write out actions, rules, and copies.  These must happen before we\n        # compile any sources, so compute a list of predependencies for sources\n        # while we do it.\n        extra_sources = []\n        mac_bundle_depends = []\n        self.target.actions_stamp = self.WriteActionsRulesCopies(\n            spec, extra_sources, actions_depends, mac_bundle_depends\n        )\n\n        # If we have actions/rules/copies, we depend directly on those, but\n        # otherwise we depend on dependent target's actions/rules/copies etc.\n        # We never need to explicitly depend on previous target's link steps,\n        # because no compile ever depends on them.\n        compile_depends_stamp = self.target.actions_stamp or compile_depends\n\n        # Write out the compilation steps, if any.\n        link_deps = []\n        try:\n            sources = extra_sources + spec.get(\"sources\", [])\n        except TypeError:\n            print(\"extra_sources: \", str(extra_sources))\n            print('spec.get(\"sources\"): ', str(spec.get(\"sources\")))\n            raise\n        if sources:\n            if self.flavor == \"mac\" and len(self.archs) > 1:\n                # Write subninja file containing compile and link commands scoped to\n                # a single arch if a fat binary is being built.\n                for arch in self.archs:\n                    self.ninja.subninja(self._SubninjaNameForArch(arch))\n\n            pch = None\n            if self.flavor == \"win\":\n                gyp.msvs_emulation.VerifyMissingSources(\n                    sources, self.abs_build_dir, generator_flags, self.GypPathToNinja\n                )\n                pch = gyp.msvs_emulation.PrecompiledHeader(\n                    self.msvs_settings,\n                    config_name,\n                    self.GypPathToNinja,\n                    self.GypPathToUniqueOutput,\n                    self.obj_ext,\n                )\n            else:\n                pch = gyp.xcode_emulation.MacPrefixHeader(\n                    self.xcode_settings,\n                    self.GypPathToNinja,\n                    lambda path, lang: self.GypPathToUniqueOutput(path + \"-\" + lang),\n                )\n            link_deps = self.WriteSources(\n                self.ninja,\n                config_name,\n                config,\n                sources,\n                compile_depends_stamp,\n                pch,\n                spec,\n            )\n            # Some actions/rules output 'sources' that are already object files.\n            obj_outputs = [f for f in sources if f.endswith(self.obj_ext)]\n            if obj_outputs:\n                if self.flavor != \"mac\" or len(self.archs) == 1:\n                    link_deps += [self.GypPathToNinja(o) for o in obj_outputs]\n                else:\n                    print(\n                        \"Warning: Actions/rules writing object files don't work with \"\n                        \"multiarch targets, dropping. (target %s)\" % spec[\"target_name\"]\n                    )\n        elif self.flavor == \"mac\" and len(self.archs) > 1:\n            link_deps = collections.defaultdict(list)\n\n        compile_deps = self.target.actions_stamp or actions_depends\n        if self.flavor == \"win\" and self.target.type == \"static_library\":\n            self.target.component_objs = link_deps\n            self.target.compile_deps = compile_deps\n\n        # Write out a link step, if needed.\n        output = None\n        is_empty_bundle = not link_deps and not mac_bundle_depends\n        if link_deps or self.target.actions_stamp or actions_depends:\n            output = self.WriteTarget(\n                spec, config_name, config, link_deps, compile_deps\n            )\n            if self.is_mac_bundle:\n                mac_bundle_depends.append(output)\n\n        # Bundle all of the above together, if needed.\n        if self.is_mac_bundle:\n            output = self.WriteMacBundle(spec, mac_bundle_depends, is_empty_bundle)\n\n        if not output:\n            return None\n\n        assert self.target.FinalOutput(), output\n        return self.target\n\n    def _WinIdlRule(self, source, prebuild, outputs):\n        \"\"\"Handle the implicit VS .idl rule for one source file. Fills |outputs|\n        with files that are generated.\"\"\"\n        outdir, output, vars, flags = self.msvs_settings.GetIdlBuildData(\n            source, self.config_name\n        )\n        outdir = self.GypPathToNinja(outdir)\n\n        def fix_path(path, rel=None):\n            path = os.path.join(outdir, path)\n            dirname, basename = os.path.split(source)\n            root, ext = os.path.splitext(basename)\n            path = self.ExpandRuleVariables(path, root, dirname, source, ext, basename)\n            if rel:\n                path = os.path.relpath(path, rel)\n            return path\n\n        vars = [(name, fix_path(value, outdir)) for name, value in vars]\n        output = [fix_path(p) for p in output]\n        vars.append((\"outdir\", outdir))\n        vars.append((\"idlflags\", flags))\n        input = self.GypPathToNinja(source)\n        self.ninja.build(output, \"idl\", input, variables=vars, order_only=prebuild)\n        outputs.extend(output)\n\n    def WriteWinIdlFiles(self, spec, prebuild):\n        \"\"\"Writes rules to match MSVS's implicit idl handling.\"\"\"\n        assert self.flavor == \"win\"\n        if self.msvs_settings.HasExplicitIdlRulesOrActions(spec):\n            return []\n        outputs = []\n        for source in filter(lambda x: x.endswith(\".idl\"), spec[\"sources\"]):\n            self._WinIdlRule(source, prebuild, outputs)\n        return outputs\n\n    def WriteActionsRulesCopies(\n        self, spec, extra_sources, prebuild, mac_bundle_depends\n    ):\n        \"\"\"Write out the Actions, Rules, and Copies steps.  Return a path\n        representing the outputs of these steps.\"\"\"\n        outputs = []\n        if self.is_mac_bundle:\n            mac_bundle_resources = spec.get(\"mac_bundle_resources\", [])[:]\n        else:\n            mac_bundle_resources = []\n        extra_mac_bundle_resources = []\n\n        if \"actions\" in spec:\n            outputs += self.WriteActions(\n                spec[\"actions\"], extra_sources, prebuild, extra_mac_bundle_resources\n            )\n        if \"rules\" in spec:\n            outputs += self.WriteRules(\n                spec[\"rules\"],\n                extra_sources,\n                prebuild,\n                mac_bundle_resources,\n                extra_mac_bundle_resources,\n            )\n        if \"copies\" in spec:\n            outputs += self.WriteCopies(spec[\"copies\"], prebuild, mac_bundle_depends)\n\n        if \"sources\" in spec and self.flavor == \"win\":\n            outputs += self.WriteWinIdlFiles(spec, prebuild)\n\n        if self.xcode_settings and self.xcode_settings.IsIosFramework():\n            self.WriteiOSFrameworkHeaders(spec, outputs, prebuild)\n\n        stamp = self.WriteCollapsedDependencies(\"actions_rules_copies\", outputs)\n\n        if self.is_mac_bundle:\n            xcassets = self.WriteMacBundleResources(\n                extra_mac_bundle_resources + mac_bundle_resources, mac_bundle_depends\n            )\n            partial_info_plist = self.WriteMacXCassets(xcassets, mac_bundle_depends)\n            self.WriteMacInfoPlist(partial_info_plist, mac_bundle_depends)\n\n        return stamp\n\n    def GenerateDescription(self, verb, message, fallback):\n        \"\"\"Generate and return a description of a build step.\n\n        |verb| is the short summary, e.g. ACTION or RULE.\n        |message| is a hand-written description, or None if not available.\n        |fallback| is the gyp-level name of the step, usable as a fallback.\n        \"\"\"\n        if self.toolset != \"target\":\n            verb += \"(%s)\" % self.toolset\n        if message:\n            return f\"{verb} {self.ExpandSpecial(message)}\"\n        else:\n            return f\"{verb} {self.name}: {fallback}\"\n\n    def WriteActions(\n        self, actions, extra_sources, prebuild, extra_mac_bundle_resources\n    ):\n        # Actions cd into the base directory.\n        env = self.GetToolchainEnv()\n        all_outputs = []\n        for action in actions:\n            # First write out a rule for the action.\n            name = \"{}_{}\".format(action[\"action_name\"], self.hash_for_rules)\n            description = self.GenerateDescription(\n                \"ACTION\", action.get(\"message\", None), name\n            )\n            win_shell_flags = (\n                self.msvs_settings.GetRuleShellFlags(action)\n                if self.flavor == \"win\"\n                else None\n            )\n            args = action[\"action\"]\n            depfile = action.get(\"depfile\", None)\n            if depfile:\n                depfile = self.ExpandSpecial(depfile, self.base_to_build)\n            pool = \"console\" if int(action.get(\"ninja_use_console\", 0)) else None\n            rule_name, _ = self.WriteNewNinjaRule(\n                name, args, description, win_shell_flags, env, pool, depfile=depfile\n            )\n\n            inputs = [self.GypPathToNinja(i, env) for i in action[\"inputs\"]]\n            if int(action.get(\"process_outputs_as_sources\", False)):\n                extra_sources += action[\"outputs\"]\n            if int(action.get(\"process_outputs_as_mac_bundle_resources\", False)):\n                extra_mac_bundle_resources += action[\"outputs\"]\n            outputs = [self.GypPathToNinja(o, env) for o in action[\"outputs\"]]\n\n            # Then write out an edge using the rule.\n            self.ninja.build(outputs, rule_name, inputs, order_only=prebuild)\n            all_outputs += outputs\n\n            self.ninja.newline()\n\n        return all_outputs\n\n    def WriteRules(\n        self,\n        rules,\n        extra_sources,\n        prebuild,\n        mac_bundle_resources,\n        extra_mac_bundle_resources,\n    ):\n        env = self.GetToolchainEnv()\n        all_outputs = []\n        for rule in rules:\n            # Skip a rule with no action and no inputs.\n            if \"action\" not in rule and not rule.get(\"rule_sources\", []):\n                continue\n\n            # First write out a rule for the rule action.\n            name = \"{}_{}\".format(rule[\"rule_name\"], self.hash_for_rules)\n\n            args = rule[\"action\"]\n            description = self.GenerateDescription(\n                \"RULE\",\n                rule.get(\"message\", None),\n                (\"%s \" + generator_default_variables[\"RULE_INPUT_PATH\"]) % name,\n            )\n            win_shell_flags = (\n                self.msvs_settings.GetRuleShellFlags(rule)\n                if self.flavor == \"win\"\n                else None\n            )\n            pool = \"console\" if int(rule.get(\"ninja_use_console\", 0)) else None\n            rule_name, args = self.WriteNewNinjaRule(\n                name, args, description, win_shell_flags, env, pool\n            )\n\n            # TODO: if the command references the outputs directly, we should\n            # simplify it to just use $out.\n\n            # Rules can potentially make use of some special variables which\n            # must vary per source file.\n            # Compute the list of variables we'll need to provide.\n            special_locals = (\"source\", \"root\", \"dirname\", \"ext\", \"name\")\n            needed_variables = {\"source\"}\n            for argument in args:\n                for var in special_locals:\n                    if \"${%s}\" % var in argument:\n                        needed_variables.add(var)\n            needed_variables = sorted(needed_variables)\n\n            def cygwin_munge(path):\n                # pylint: disable=cell-var-from-loop\n                if win_shell_flags and win_shell_flags.cygwin:\n                    return path.replace(\"\\\\\", \"/\")\n                return path\n\n            inputs = [self.GypPathToNinja(i, env) for i in rule.get(\"inputs\", [])]\n\n            # If there are n source files matching the rule, and m additional rule\n            # inputs, then adding 'inputs' to each build edge written below will\n            # write m * n inputs. Collapsing reduces this to m + n.\n            sources = rule.get(\"rule_sources\", [])\n            num_inputs = len(inputs)\n            if prebuild:\n                num_inputs += 1\n            if num_inputs > 2 and len(sources) > 2:\n                inputs = [\n                    self.WriteCollapsedDependencies(\n                        rule[\"rule_name\"], inputs, order_only=prebuild\n                    )\n                ]\n                prebuild = []\n\n            # For each source file, write an edge that generates all the outputs.\n            for source in sources:\n                source = os.path.normpath(source)\n                dirname, basename = os.path.split(source)\n                root, ext = os.path.splitext(basename)\n\n                # Gather the list of inputs and outputs, expanding $vars if possible.\n                outputs = [\n                    self.ExpandRuleVariables(o, root, dirname, source, ext, basename)\n                    for o in rule[\"outputs\"]\n                ]\n\n                if int(rule.get(\"process_outputs_as_sources\", False)):\n                    extra_sources += outputs\n\n                was_mac_bundle_resource = source in mac_bundle_resources\n                if was_mac_bundle_resource or int(\n                    rule.get(\"process_outputs_as_mac_bundle_resources\", False)\n                ):\n                    extra_mac_bundle_resources += outputs\n                    # Note: This is n_resources * n_outputs_in_rule.\n                    # Put to-be-removed items in a set and\n                    # remove them all in a single pass\n                    # if this becomes a performance issue.\n                    if was_mac_bundle_resource:\n                        mac_bundle_resources.remove(source)\n\n                extra_bindings = []\n                for var in needed_variables:\n                    if var == \"root\":\n                        extra_bindings.append((\"root\", cygwin_munge(root)))\n                    elif var == \"dirname\":\n                        # '$dirname' is a parameter to the rule action, which means\n                        # it shouldn't be converted to a Ninja path.  But we don't\n                        # want $!PRODUCT_DIR in there either.\n                        dirname_expanded = self.ExpandSpecial(\n                            dirname, self.base_to_build\n                        )\n                        extra_bindings.append(\n                            (\"dirname\", cygwin_munge(dirname_expanded))\n                        )\n                    elif var == \"source\":\n                        # '$source' is a parameter to the rule action, which means\n                        # it shouldn't be converted to a Ninja path.  But we don't\n                        # want $!PRODUCT_DIR in there either.\n                        source_expanded = self.ExpandSpecial(source, self.base_to_build)\n                        extra_bindings.append((\"source\", cygwin_munge(source_expanded)))\n                    elif var == \"ext\":\n                        extra_bindings.append((\"ext\", ext))\n                    elif var == \"name\":\n                        extra_bindings.append((\"name\", cygwin_munge(basename)))\n                    else:\n                        assert var is None, repr(var)\n\n                outputs = [self.GypPathToNinja(o, env) for o in outputs]\n                if self.flavor == \"win\":\n                    # WriteNewNinjaRule uses unique_name to create a rsp file on win.\n                    unique_name = hashlib.sha256(outputs[0].encode(\"utf-8\")).hexdigest()\n                    extra_bindings.append((\"unique_name\", unique_name))\n\n                self.ninja.build(\n                    outputs,\n                    rule_name,\n                    self.GypPathToNinja(source),\n                    implicit=inputs,\n                    order_only=prebuild,\n                    variables=extra_bindings,\n                )\n\n                all_outputs.extend(outputs)\n\n        return all_outputs\n\n    def WriteCopies(self, copies, prebuild, mac_bundle_depends):\n        outputs = []\n        if self.xcode_settings:\n            extra_env = self.xcode_settings.GetPerTargetSettings()\n            env = self.GetToolchainEnv(additional_settings=extra_env)\n        else:\n            env = self.GetToolchainEnv()\n        for to_copy in copies:\n            for path in to_copy[\"files\"]:\n                # Normalize the path so trailing slashes don't confuse us.\n                path = os.path.normpath(path)\n                basename = os.path.split(path)[1]\n                src = self.GypPathToNinja(path, env)\n                dst = self.GypPathToNinja(\n                    os.path.join(to_copy[\"destination\"], basename), env\n                )\n                outputs += self.ninja.build(dst, \"copy\", src, order_only=prebuild)\n                if self.is_mac_bundle:\n                    # gyp has mac_bundle_resources to copy things into a bundle's\n                    # Resources folder, but there's no built-in way to copy files\n                    # to other places in the bundle.\n                    # Hence, some targets use copies for this.\n                    # Check if this file is copied into the current bundle,\n                    # and if so add it to the bundle depends so\n                    # that dependent targets get rebuilt if the copy input changes.\n                    if dst.startswith(\n                        self.xcode_settings.GetBundleContentsFolderPath()\n                    ):\n                        mac_bundle_depends.append(dst)\n\n        return outputs\n\n    def WriteiOSFrameworkHeaders(self, spec, outputs, prebuild):\n        \"\"\"Prebuild steps to generate hmap files and copy headers to destination.\"\"\"\n        framework = self.ComputeMacBundleOutput()\n        all_sources = spec[\"sources\"]\n        copy_headers = spec[\"mac_framework_headers\"]\n        output = self.GypPathToUniqueOutput(\"headers.hmap\")\n        self.xcode_settings.header_map_path = output\n        all_headers = map(\n            self.GypPathToNinja, filter(lambda x: x.endswith(\".h\"), all_sources)\n        )\n        variables = [\n            (\"framework\", framework),\n            (\"copy_headers\", map(self.GypPathToNinja, copy_headers)),\n        ]\n        outputs.extend(\n            self.ninja.build(\n                output,\n                \"compile_ios_framework_headers\",\n                all_headers,\n                variables=variables,\n                order_only=prebuild,\n            )\n        )\n\n    def WriteMacBundleResources(self, resources, bundle_depends):\n        \"\"\"Writes ninja edges for 'mac_bundle_resources'.\"\"\"\n        xcassets = []\n\n        extra_env = self.xcode_settings.GetPerTargetSettings()\n        env = self.GetSortedXcodeEnv(additional_settings=extra_env)\n        env = self.ComputeExportEnvString(env)\n        isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name)\n\n        for output, res in gyp.xcode_emulation.GetMacBundleResources(\n            generator_default_variables[\"PRODUCT_DIR\"],\n            self.xcode_settings,\n            map(self.GypPathToNinja, resources),\n        ):\n            output = self.ExpandSpecial(output)\n            if os.path.splitext(output)[-1] != \".xcassets\":\n                self.ninja.build(\n                    output,\n                    \"mac_tool\",\n                    res,\n                    variables=[\n                        (\"mactool_cmd\", \"copy-bundle-resource\"),\n                        (\"env\", env),\n                        (\"binary\", isBinary),\n                    ],\n                )\n                bundle_depends.append(output)\n            else:\n                xcassets.append(res)\n        return xcassets\n\n    def WriteMacXCassets(self, xcassets, bundle_depends):\n        \"\"\"Writes ninja edges for 'mac_bundle_resources' .xcassets files.\n\n        This add an invocation of 'actool' via the 'mac_tool.py' helper script.\n        It assumes that the assets catalogs define at least one imageset and\n        thus an Assets.car file will be generated in the application resources\n        directory. If this is not the case, then the build will probably be done\n        at each invocation of ninja.\"\"\"\n        if not xcassets:\n            return\n\n        extra_arguments = {}\n        settings_to_arg = {\n            \"XCASSETS_APP_ICON\": \"app-icon\",\n            \"XCASSETS_LAUNCH_IMAGE\": \"launch-image\",\n        }\n        settings = self.xcode_settings.xcode_settings[self.config_name]\n        for settings_key, arg_name in settings_to_arg.items():\n            value = settings.get(settings_key)\n            if value:\n                extra_arguments[arg_name] = value\n\n        partial_info_plist = None\n        if extra_arguments:\n            partial_info_plist = self.GypPathToUniqueOutput(\n                \"assetcatalog_generated_info.plist\"\n            )\n            extra_arguments[\"output-partial-info-plist\"] = partial_info_plist\n\n        outputs = []\n        outputs.append(\n            os.path.join(self.xcode_settings.GetBundleResourceFolder(), \"Assets.car\")\n        )\n        if partial_info_plist:\n            outputs.append(partial_info_plist)\n\n        keys = QuoteShellArgument(json.dumps(extra_arguments), self.flavor)\n        extra_env = self.xcode_settings.GetPerTargetSettings()\n        env = self.GetSortedXcodeEnv(additional_settings=extra_env)\n        env = self.ComputeExportEnvString(env)\n\n        bundle_depends.extend(\n            self.ninja.build(\n                outputs,\n                \"compile_xcassets\",\n                xcassets,\n                variables=[(\"env\", env), (\"keys\", keys)],\n            )\n        )\n        return partial_info_plist\n\n    def WriteMacInfoPlist(self, partial_info_plist, bundle_depends):\n        \"\"\"Write build rules for bundle Info.plist files.\"\"\"\n        info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist(\n            generator_default_variables[\"PRODUCT_DIR\"],\n            self.xcode_settings,\n            self.GypPathToNinja,\n        )\n        if not info_plist:\n            return\n        out = self.ExpandSpecial(out)\n        if defines:\n            # Create an intermediate file to store preprocessed results.\n            intermediate_plist = self.GypPathToUniqueOutput(\n                os.path.basename(info_plist)\n            )\n            defines = \" \".join([Define(d, self.flavor) for d in defines])\n            info_plist = self.ninja.build(\n                intermediate_plist,\n                \"preprocess_infoplist\",\n                info_plist,\n                variables=[(\"defines\", defines)],\n            )\n\n        env = self.GetSortedXcodeEnv(additional_settings=extra_env)\n        env = self.ComputeExportEnvString(env)\n\n        if partial_info_plist:\n            intermediate_plist = self.GypPathToUniqueOutput(\"merged_info.plist\")\n            info_plist = self.ninja.build(\n                intermediate_plist, \"merge_infoplist\", [partial_info_plist, info_plist]\n            )\n\n        keys = self.xcode_settings.GetExtraPlistItems(self.config_name)\n        keys = QuoteShellArgument(json.dumps(keys), self.flavor)\n        isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name)\n        self.ninja.build(\n            out,\n            \"copy_infoplist\",\n            info_plist,\n            variables=[(\"env\", env), (\"keys\", keys), (\"binary\", isBinary)],\n        )\n        bundle_depends.append(out)\n\n    def WriteSources(\n        self,\n        ninja_file,\n        config_name,\n        config,\n        sources,\n        predepends,\n        precompiled_header,\n        spec,\n    ):\n        \"\"\"Write build rules to compile all of |sources|.\"\"\"\n        if self.toolset == \"host\":\n            self.ninja.variable(\"ar\", \"$ar_host\")\n            self.ninja.variable(\"cc\", \"$cc_host\")\n            self.ninja.variable(\"cxx\", \"$cxx_host\")\n            self.ninja.variable(\"ld\", \"$ld_host\")\n            self.ninja.variable(\"ldxx\", \"$ldxx_host\")\n            self.ninja.variable(\"nm\", \"$nm_host\")\n            self.ninja.variable(\"readelf\", \"$readelf_host\")\n\n        if self.flavor != \"mac\" or len(self.archs) == 1:\n            return self.WriteSourcesForArch(\n                self.ninja,\n                config_name,\n                config,\n                sources,\n                predepends,\n                precompiled_header,\n                spec,\n            )\n        else:\n            return {\n                arch: self.WriteSourcesForArch(\n                    self.arch_subninjas[arch],\n                    config_name,\n                    config,\n                    sources,\n                    predepends,\n                    precompiled_header,\n                    spec,\n                    arch=arch,\n                )\n                for arch in self.archs\n            }\n\n    def WriteSourcesForArch(\n        self,\n        ninja_file,\n        config_name,\n        config,\n        sources,\n        predepends,\n        precompiled_header,\n        spec,\n        arch=None,\n    ):\n        \"\"\"Write build rules to compile all of |sources|.\"\"\"\n\n        extra_defines = []\n        if self.flavor == \"mac\":\n            cflags = self.xcode_settings.GetCflags(config_name, arch=arch)\n            cflags_c = self.xcode_settings.GetCflagsC(config_name)\n            cflags_cc = self.xcode_settings.GetCflagsCC(config_name)\n            cflags_objc = [\"$cflags_c\"] + self.xcode_settings.GetCflagsObjC(config_name)\n            cflags_objcc = [\"$cflags_cc\"] + self.xcode_settings.GetCflagsObjCC(\n                config_name\n            )\n        elif self.flavor == \"win\":\n            asmflags = self.msvs_settings.GetAsmflags(config_name)\n            cflags = self.msvs_settings.GetCflags(config_name)\n            cflags_c = self.msvs_settings.GetCflagsC(config_name)\n            cflags_cc = self.msvs_settings.GetCflagsCC(config_name)\n            extra_defines = self.msvs_settings.GetComputedDefines(config_name)\n            # See comment at cc_command for why there's two .pdb files.\n            pdbpath_c = pdbpath_cc = self.msvs_settings.GetCompilerPdbName(\n                config_name, self.ExpandSpecial\n            )\n            if not pdbpath_c:\n                obj = \"obj\"\n                if self.toolset != \"target\":\n                    obj += \".\" + self.toolset\n                pdbpath = os.path.normpath(os.path.join(obj, self.base_dir, self.name))\n                pdbpath_c = pdbpath + \".c.pdb\"\n                pdbpath_cc = pdbpath + \".cc.pdb\"\n            self.WriteVariableList(ninja_file, \"pdbname_c\", [pdbpath_c])\n            self.WriteVariableList(ninja_file, \"pdbname_cc\", [pdbpath_cc])\n            self.WriteVariableList(ninja_file, \"pchprefix\", [self.name])\n        else:\n            cflags = config.get(\"cflags\", [])\n            cflags_c = config.get(\"cflags_c\", [])\n            cflags_cc = config.get(\"cflags_cc\", [])\n\n        # Respect environment variables related to build, but target-specific\n        # flags can still override them.\n        if self.toolset == \"target\":\n            cflags_c = (\n                os.environ.get(\"CPPFLAGS\", \"\").split()\n                + os.environ.get(\"CFLAGS\", \"\").split()\n                + cflags_c\n            )\n            cflags_cc = (\n                os.environ.get(\"CPPFLAGS\", \"\").split()\n                + os.environ.get(\"CXXFLAGS\", \"\").split()\n                + cflags_cc\n            )\n        elif self.toolset == \"host\":\n            cflags_c = (\n                os.environ.get(\"CPPFLAGS_host\", \"\").split()\n                + os.environ.get(\"CFLAGS_host\", \"\").split()\n                + cflags_c\n            )\n            cflags_cc = (\n                os.environ.get(\"CPPFLAGS_host\", \"\").split()\n                + os.environ.get(\"CXXFLAGS_host\", \"\").split()\n                + cflags_cc\n            )\n\n        defines = config.get(\"defines\", []) + extra_defines\n        self.WriteVariableList(\n            ninja_file, \"defines\", [Define(d, self.flavor) for d in defines]\n        )\n        if self.flavor == \"win\":\n            self.WriteVariableList(\n                ninja_file, \"asmflags\", map(self.ExpandSpecial, asmflags)\n            )\n            self.WriteVariableList(\n                ninja_file,\n                \"rcflags\",\n                [\n                    QuoteShellArgument(self.ExpandSpecial(f), self.flavor)\n                    for f in self.msvs_settings.GetRcflags(\n                        config_name, self.GypPathToNinja\n                    )\n                ],\n            )\n\n        include_dirs = config.get(\"include_dirs\", [])\n\n        env = self.GetToolchainEnv()\n        if self.flavor == \"win\":\n            include_dirs = self.msvs_settings.AdjustIncludeDirs(\n                include_dirs, config_name\n            )\n        self.WriteVariableList(\n            ninja_file,\n            \"includes\",\n            [\n                QuoteShellArgument(\"-I\" + self.GypPathToNinja(i, env), self.flavor)\n                for i in include_dirs\n            ],\n        )\n\n        if self.flavor == \"win\":\n            midl_include_dirs = config.get(\"midl_include_dirs\", [])\n            midl_include_dirs = self.msvs_settings.AdjustMidlIncludeDirs(\n                midl_include_dirs, config_name\n            )\n            self.WriteVariableList(\n                ninja_file,\n                \"midl_includes\",\n                [\n                    QuoteShellArgument(\"-I\" + self.GypPathToNinja(i, env), self.flavor)\n                    for i in midl_include_dirs\n                ],\n            )\n\n        pch_commands = precompiled_header.GetPchBuildCommands(arch)\n        if self.flavor == \"mac\":\n            # Most targets use no precompiled headers, so only write these if needed.\n            for ext, var in [\n                (\"c\", \"cflags_pch_c\"),\n                (\"cc\", \"cflags_pch_cc\"),\n                (\"m\", \"cflags_pch_objc\"),\n                (\"mm\", \"cflags_pch_objcc\"),\n            ]:\n                include = precompiled_header.GetInclude(ext, arch)\n                if include:\n                    ninja_file.variable(var, include)\n\n        arflags = config.get(\"arflags\", [])\n\n        self.WriteVariableList(ninja_file, \"cflags\", map(self.ExpandSpecial, cflags))\n        self.WriteVariableList(\n            ninja_file, \"cflags_c\", map(self.ExpandSpecial, cflags_c)\n        )\n        self.WriteVariableList(\n            ninja_file, \"cflags_cc\", map(self.ExpandSpecial, cflags_cc)\n        )\n        if self.flavor == \"mac\":\n            self.WriteVariableList(\n                ninja_file, \"cflags_objc\", map(self.ExpandSpecial, cflags_objc)\n            )\n            self.WriteVariableList(\n                ninja_file, \"cflags_objcc\", map(self.ExpandSpecial, cflags_objcc)\n            )\n        self.WriteVariableList(ninja_file, \"arflags\", map(self.ExpandSpecial, arflags))\n        ninja_file.newline()\n        outputs = []\n        has_rc_source = False\n        for source in sources:\n            filename, ext = os.path.splitext(source)\n            ext = ext[1:]\n            obj_ext = self.obj_ext\n            if ext in (\"cc\", \"cpp\", \"cxx\"):\n                command = \"cxx\"\n                self.target.uses_cpp = True\n            elif ext == \"c\" or (ext == \"S\" and self.flavor != \"win\"):\n                command = \"cc\"\n            elif ext == \"s\" and self.flavor != \"win\":  # Doesn't generate .o.d files.\n                command = \"cc_s\"\n            elif (\n                self.flavor == \"win\"\n                and ext in (\"asm\", \"S\")\n                and not self.msvs_settings.HasExplicitAsmRules(spec)\n            ):\n                command = \"asm\"\n                # Add the _asm suffix as msvs is capable of handling .cc and\n                # .asm files of the same name without collision.\n                obj_ext = \"_asm.obj\"\n            elif self.flavor == \"mac\" and ext == \"m\":\n                command = \"objc\"\n            elif self.flavor == \"mac\" and ext == \"mm\":\n                command = \"objcxx\"\n                self.target.uses_cpp = True\n            elif self.flavor == \"win\" and ext == \"rc\":\n                command = \"rc\"\n                obj_ext = \".res\"\n                has_rc_source = True\n            else:\n                # Ignore unhandled extensions.\n                continue\n            input = self.GypPathToNinja(source)\n            output = self.GypPathToUniqueOutput(filename + obj_ext)\n            if arch is not None:\n                output = AddArch(output, arch)\n            implicit = precompiled_header.GetObjDependencies([input], [output], arch)\n            variables = []\n            if self.flavor == \"win\":\n                variables, output, implicit = precompiled_header.GetFlagsModifications(\n                    input,\n                    output,\n                    implicit,\n                    command,\n                    cflags_c,\n                    cflags_cc,\n                    self.ExpandSpecial,\n                )\n            ninja_file.build(\n                output,\n                command,\n                input,\n                implicit=[gch for _, _, gch in implicit],\n                order_only=predepends,\n                variables=variables,\n            )\n            outputs.append(output)\n\n        if has_rc_source:\n            resource_include_dirs = config.get(\"resource_include_dirs\", include_dirs)\n            self.WriteVariableList(\n                ninja_file,\n                \"resource_includes\",\n                [\n                    QuoteShellArgument(\"-I\" + self.GypPathToNinja(i, env), self.flavor)\n                    for i in resource_include_dirs\n                ],\n            )\n\n        self.WritePchTargets(ninja_file, pch_commands)\n\n        ninja_file.newline()\n        return outputs\n\n    def WritePchTargets(self, ninja_file, pch_commands):\n        \"\"\"Writes ninja rules to compile prefix headers.\"\"\"\n        if not pch_commands:\n            return\n\n        for gch, lang_flag, lang, input in pch_commands:\n            var_name = {\n                \"c\": \"cflags_pch_c\",\n                \"cc\": \"cflags_pch_cc\",\n                \"m\": \"cflags_pch_objc\",\n                \"mm\": \"cflags_pch_objcc\",\n            }[lang]\n\n            map = {\n                \"c\": \"cc\",\n                \"cc\": \"cxx\",\n                \"m\": \"objc\",\n                \"mm\": \"objcxx\",\n            }\n            cmd = map.get(lang)\n            ninja_file.build(gch, cmd, input, variables=[(var_name, lang_flag)])\n\n    def WriteLink(self, spec, config_name, config, link_deps, compile_deps):\n        \"\"\"Write out a link step. Fills out target.binary.\"\"\"\n        if self.flavor != \"mac\" or len(self.archs) == 1:\n            return self.WriteLinkForArch(\n                self.ninja, spec, config_name, config, link_deps, compile_deps\n            )\n        else:\n            output = self.ComputeOutput(spec)\n            inputs = [\n                self.WriteLinkForArch(\n                    self.arch_subninjas[arch],\n                    spec,\n                    config_name,\n                    config,\n                    link_deps[arch],\n                    compile_deps,\n                    arch=arch,\n                )\n                for arch in self.archs\n            ]\n            extra_bindings = []\n            build_output = output\n            if not self.is_mac_bundle:\n                self.AppendPostbuildVariable(extra_bindings, spec, output, output)\n\n            # TODO(yyanagisawa): more work needed to fix:\n            # https://code.google.com/p/gyp/issues/detail?id=411\n            if (\n                spec[\"type\"] in (\"shared_library\", \"loadable_module\")\n                and not self.is_mac_bundle\n            ):\n                extra_bindings.append((\"lib\", output))\n                self.ninja.build(\n                    [output, output + \".TOC\"],\n                    \"solipo\",\n                    inputs,\n                    variables=extra_bindings,\n                )\n            else:\n                self.ninja.build(build_output, \"lipo\", inputs, variables=extra_bindings)\n            return output\n\n    def WriteLinkForArch(\n        self, ninja_file, spec, config_name, config, link_deps, compile_deps, arch=None\n    ):\n        \"\"\"Write out a link step. Fills out target.binary.\"\"\"\n        command = {\n            \"executable\": \"link\",\n            \"loadable_module\": \"solink_module\",\n            \"shared_library\": \"solink\",\n        }[spec[\"type\"]]\n        command_suffix = \"\"\n\n        implicit_deps = set()\n        solibs = set()\n        order_deps = set()\n\n        if compile_deps:\n            # Normally, the compiles of the target already depend on compile_deps,\n            # but a shared_library target might have no sources and only link together\n            # a few static_library deps, so the link step also needs to depend\n            # on compile_deps to make sure actions in the shared_library target\n            # get run before the link.\n            order_deps.add(compile_deps)\n\n        if \"dependencies\" in spec:\n            # Two kinds of dependencies:\n            # - Linkable dependencies (like a .a or a .so): add them to the link line.\n            # - Non-linkable dependencies (like a rule that generates a file\n            #   and writes a stamp file): add them to implicit_deps\n            extra_link_deps = set()\n            for dep in spec[\"dependencies\"]:\n                target = self.target_outputs.get(dep)\n                if not target:\n                    continue\n                linkable = target.Linkable()\n                if linkable:\n                    new_deps = []\n                    if (\n                        self.flavor == \"win\"\n                        and target.component_objs\n                        and self.msvs_settings.IsUseLibraryDependencyInputs(config_name)\n                    ):\n                        new_deps = target.component_objs\n                        if target.compile_deps:\n                            order_deps.add(target.compile_deps)\n                    elif self.flavor == \"win\" and target.import_lib:\n                        new_deps = [target.import_lib]\n                    elif target.UsesToc(self.flavor):\n                        solibs.add(target.binary)\n                        implicit_deps.add(target.binary + \".TOC\")\n                    else:\n                        new_deps = [target.binary]\n                    for new_dep in new_deps:\n                        if new_dep not in extra_link_deps:\n                            extra_link_deps.add(new_dep)\n                            link_deps.append(new_dep)\n\n                final_output = target.FinalOutput()\n                if not linkable or final_output != target.binary:\n                    implicit_deps.add(final_output)\n\n        extra_bindings = []\n        if self.target.uses_cpp and self.flavor != \"win\":\n            extra_bindings.append((\"ld\", \"$ldxx\"))\n\n        output = self.ComputeOutput(spec, arch)\n        if arch is None and not self.is_mac_bundle:\n            self.AppendPostbuildVariable(extra_bindings, spec, output, output)\n\n        is_executable = spec[\"type\"] == \"executable\"\n        # The ldflags config key is not used on mac or win. On those platforms\n        # linker flags are set via xcode_settings and msvs_settings, respectively.\n        if self.toolset == \"target\":\n            env_ldflags = os.environ.get(\"LDFLAGS\", \"\").split()\n        elif self.toolset == \"host\":\n            env_ldflags = os.environ.get(\"LDFLAGS_host\", \"\").split()\n\n        if self.flavor == \"mac\":\n            ldflags = self.xcode_settings.GetLdflags(\n                config_name,\n                self.ExpandSpecial(generator_default_variables[\"PRODUCT_DIR\"]),\n                self.GypPathToNinja,\n                arch,\n            )\n            ldflags = env_ldflags + ldflags\n        elif self.flavor == \"win\":\n            manifest_base_name = self.GypPathToUniqueOutput(\n                self.ComputeOutputFileName(spec)\n            )\n            (\n                ldflags,\n                intermediate_manifest,\n                manifest_files,\n            ) = self.msvs_settings.GetLdflags(\n                config_name,\n                self.GypPathToNinja,\n                self.ExpandSpecial,\n                manifest_base_name,\n                output,\n                is_executable,\n                self.toplevel_build,\n            )\n            ldflags = env_ldflags + ldflags\n            self.WriteVariableList(ninja_file, \"manifests\", manifest_files)\n            implicit_deps = implicit_deps.union(manifest_files)\n            if intermediate_manifest:\n                self.WriteVariableList(\n                    ninja_file, \"intermediatemanifest\", [intermediate_manifest]\n                )\n            command_suffix = _GetWinLinkRuleNameSuffix(\n                self.msvs_settings.IsEmbedManifest(config_name)\n            )\n            def_file = self.msvs_settings.GetDefFile(self.GypPathToNinja)\n            if def_file:\n                implicit_deps.add(def_file)\n        else:\n            # Respect environment variables related to build, but target-specific\n            # flags can still override them.\n            ldflags = env_ldflags + config.get(\"ldflags\", [])\n            if is_executable and solibs:\n                rpath = \"lib/\"\n                if self.toolset != \"target\":\n                    rpath += self.toolset\n                    ldflags.append(r\"-Wl,-rpath=\\$$ORIGIN/%s\" % rpath)\n                else:\n                    ldflags.append(\"-Wl,-rpath=%s\" % self.target_rpath)\n                ldflags.append(\"-Wl,-rpath-link=%s\" % rpath)\n        self.WriteVariableList(ninja_file, \"ldflags\", map(self.ExpandSpecial, ldflags))\n\n        library_dirs = config.get(\"library_dirs\", [])\n        if self.flavor == \"win\":\n            library_dirs = [\n                self.msvs_settings.ConvertVSMacros(library_dir, config_name)\n                for library_dir in library_dirs\n            ]\n            library_dirs = [\n                \"/LIBPATH:\"\n                + QuoteShellArgument(self.GypPathToNinja(library_dir), self.flavor)\n                for library_dir in library_dirs\n            ]\n        else:\n            library_dirs = [\n                QuoteShellArgument(\"-L\" + self.GypPathToNinja(library_dir), self.flavor)\n                for library_dir in library_dirs\n            ]\n\n        libraries = gyp.common.uniquer(\n            map(self.ExpandSpecial, spec.get(\"libraries\", []))\n        )\n        if self.flavor == \"mac\":\n            libraries = self.xcode_settings.AdjustLibraries(libraries, config_name)\n        elif self.flavor == \"win\":\n            libraries = self.msvs_settings.AdjustLibraries(libraries)\n\n        self.WriteVariableList(ninja_file, \"libs\", library_dirs + libraries)\n\n        linked_binary = output\n\n        if command in (\"solink\", \"solink_module\"):\n            extra_bindings.append((\"soname\", os.path.split(output)[1]))\n            extra_bindings.append((\"lib\", gyp.common.EncodePOSIXShellArgument(output)))\n            if self.flavor != \"win\":\n                link_file_list = output\n                if self.is_mac_bundle:\n                    # 'Dependency Framework.framework/Versions/A/Dependency Framework'\n                    # -> 'Dependency Framework.framework.rsp'\n                    link_file_list = self.xcode_settings.GetWrapperName()\n                if arch:\n                    link_file_list += \".\" + arch\n                link_file_list += \".rsp\"\n                # If an rspfile contains spaces, ninja surrounds the filename with\n                # quotes around it and then passes it to open(), creating a file with\n                # quotes in its name (and when looking for the rsp file, the name\n                # makes it through bash which strips the quotes) :-/\n                link_file_list = link_file_list.replace(\" \", \"_\")\n                extra_bindings.append(\n                    (\n                        \"link_file_list\",\n                        gyp.common.EncodePOSIXShellArgument(link_file_list),\n                    )\n                )\n            if self.flavor == \"win\":\n                extra_bindings.append((\"binary\", output))\n                if (\n                    \"/NOENTRY\" not in ldflags\n                    and not self.msvs_settings.GetNoImportLibrary(config_name)\n                ):\n                    self.target.import_lib = output + \".lib\"\n                    extra_bindings.append(\n                        (\"implibflag\", \"/IMPLIB:%s\" % self.target.import_lib)\n                    )\n                    pdbname = self.msvs_settings.GetPDBName(\n                        config_name, self.ExpandSpecial, output + \".pdb\"\n                    )\n                    output = [output, self.target.import_lib]\n                    if pdbname:\n                        output.append(pdbname)\n            elif not self.is_mac_bundle:\n                output = [output, output + \".TOC\"]\n            else:\n                command = command + \"_notoc\"\n        elif self.flavor == \"win\":\n            extra_bindings.append((\"binary\", output))\n            pdbname = self.msvs_settings.GetPDBName(\n                config_name, self.ExpandSpecial, output + \".pdb\"\n            )\n            if pdbname:\n                output = [output, pdbname]\n\n        if solibs:\n            extra_bindings.append(\n                (\"solibs\", gyp.common.EncodePOSIXShellList(sorted(solibs)))\n            )\n\n        ninja_file.build(\n            output,\n            command + command_suffix,\n            link_deps,\n            implicit=sorted(implicit_deps),\n            order_only=list(order_deps),\n            variables=extra_bindings,\n        )\n        return linked_binary\n\n    def WriteTarget(self, spec, config_name, config, link_deps, compile_deps):\n        extra_link_deps = any(\n            self.target_outputs.get(dep).Linkable()\n            for dep in spec.get(\"dependencies\", [])\n            if dep in self.target_outputs\n        )\n        if spec[\"type\"] == \"none\" or (not link_deps and not extra_link_deps):\n            # TODO(evan): don't call this function for 'none' target types, as\n            # it doesn't do anything, and we fake out a 'binary' with a stamp file.\n            self.target.binary = compile_deps\n            self.target.type = \"none\"\n        elif spec[\"type\"] == \"static_library\":\n            self.target.binary = self.ComputeOutput(spec)\n            if (\n                self.flavor not in (\"ios\", \"mac\", \"netbsd\", \"openbsd\", \"win\")\n                and not self.is_standalone_static_library\n            ):\n                self.ninja.build(\n                    self.target.binary, \"alink_thin\", link_deps, order_only=compile_deps\n                )\n            else:\n                variables = []\n                if self.xcode_settings:\n                    libtool_flags = self.xcode_settings.GetLibtoolflags(config_name)\n                    if libtool_flags:\n                        variables.append((\"libtool_flags\", libtool_flags))\n                if self.msvs_settings:\n                    libflags = self.msvs_settings.GetLibFlags(\n                        config_name, self.GypPathToNinja\n                    )\n                    variables.append((\"libflags\", libflags))\n\n                if self.flavor != \"mac\" or len(self.archs) == 1:\n                    self.AppendPostbuildVariable(\n                        variables, spec, self.target.binary, self.target.binary\n                    )\n                    self.ninja.build(\n                        self.target.binary,\n                        \"alink\",\n                        link_deps,\n                        order_only=compile_deps,\n                        variables=variables,\n                    )\n                else:\n                    inputs = []\n                    for arch in self.archs:\n                        output = self.ComputeOutput(spec, arch)\n                        self.arch_subninjas[arch].build(\n                            output,\n                            \"alink\",\n                            link_deps[arch],\n                            order_only=compile_deps,\n                            variables=variables,\n                        )\n                        inputs.append(output)\n                    # TODO: It's not clear if\n                    # libtool_flags should be passed to the alink\n                    # call that combines single-arch .a files into a fat .a file.\n                    self.AppendPostbuildVariable(\n                        variables, spec, self.target.binary, self.target.binary\n                    )\n                    self.ninja.build(\n                        self.target.binary,\n                        \"alink\",\n                        inputs,\n                        # FIXME: test proving order_only=compile_deps isn't\n                        # needed.\n                        variables=variables,\n                    )\n        else:\n            self.target.binary = self.WriteLink(\n                spec, config_name, config, link_deps, compile_deps\n            )\n        return self.target.binary\n\n    def WriteMacBundle(self, spec, mac_bundle_depends, is_empty):\n        assert self.is_mac_bundle\n        package_framework = spec[\"type\"] in (\"shared_library\", \"loadable_module\")\n        output = self.ComputeMacBundleOutput()\n        if is_empty:\n            output += \".stamp\"\n        variables = []\n        self.AppendPostbuildVariable(\n            variables,\n            spec,\n            output,\n            self.target.binary,\n            is_command_start=not package_framework,\n        )\n        if package_framework and not is_empty:\n            if spec[\"type\"] == \"shared_library\" and self.xcode_settings.isIOS:\n                self.ninja.build(\n                    output,\n                    \"package_ios_framework\",\n                    mac_bundle_depends,\n                    variables=variables,\n                )\n            else:\n                variables.append((\"version\", self.xcode_settings.GetFrameworkVersion()))\n                self.ninja.build(\n                    output, \"package_framework\", mac_bundle_depends, variables=variables\n                )\n        else:\n            self.ninja.build(output, \"stamp\", mac_bundle_depends, variables=variables)\n        self.target.bundle = output\n        return output\n\n    def GetToolchainEnv(self, additional_settings=None):\n        \"\"\"Returns the variables toolchain would set for build steps.\"\"\"\n        env = self.GetSortedXcodeEnv(additional_settings=additional_settings)\n        if self.flavor == \"win\":\n            env = self.GetMsvsToolchainEnv(additional_settings=additional_settings)\n        return env\n\n    def GetMsvsToolchainEnv(self, additional_settings=None):\n        \"\"\"Returns the variables Visual Studio would set for build steps.\"\"\"\n        return self.msvs_settings.GetVSMacroEnv(\n            \"$!PRODUCT_DIR\", config=self.config_name\n        )\n\n    def GetSortedXcodeEnv(self, additional_settings=None):\n        \"\"\"Returns the variables Xcode would set for build steps.\"\"\"\n        assert self.abs_build_dir\n        abs_build_dir = self.abs_build_dir\n        return gyp.xcode_emulation.GetSortedXcodeEnv(\n            self.xcode_settings,\n            abs_build_dir,\n            os.path.join(abs_build_dir, self.build_to_base),\n            self.config_name,\n            additional_settings,\n        )\n\n    def GetSortedXcodePostbuildEnv(self):\n        \"\"\"Returns the variables Xcode would set for postbuild steps.\"\"\"\n        postbuild_settings = {}\n        # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack.\n        # TODO(thakis): It would be nice to have some general mechanism instead.\n        strip_save_file = self.xcode_settings.GetPerTargetSetting(\n            \"CHROMIUM_STRIP_SAVE_FILE\"\n        )\n        if strip_save_file:\n            postbuild_settings[\"CHROMIUM_STRIP_SAVE_FILE\"] = strip_save_file\n        return self.GetSortedXcodeEnv(additional_settings=postbuild_settings)\n\n    def AppendPostbuildVariable(\n        self, variables, spec, output, binary, is_command_start=False\n    ):\n        \"\"\"Adds a 'postbuild' variable if there is a postbuild for |output|.\"\"\"\n        postbuild = self.GetPostbuildCommand(spec, output, binary, is_command_start)\n        if postbuild:\n            variables.append((\"postbuilds\", postbuild))\n\n    def GetPostbuildCommand(self, spec, output, output_binary, is_command_start):\n        \"\"\"Returns a shell command that runs all the postbuilds, and removes\n        |output| if any of them fails. If |is_command_start| is False, then the\n        returned string will start with ' && '.\"\"\"\n        if not self.xcode_settings or spec[\"type\"] == \"none\" or not output:\n            return \"\"\n        output = QuoteShellArgument(output, self.flavor)\n        postbuilds = gyp.xcode_emulation.GetSpecPostbuildCommands(spec, quiet=True)\n        if output_binary is not None:\n            postbuilds = self.xcode_settings.AddImplicitPostbuilds(\n                self.config_name,\n                os.path.normpath(os.path.join(self.base_to_build, output)),\n                QuoteShellArgument(\n                    os.path.normpath(os.path.join(self.base_to_build, output_binary)),\n                    self.flavor,\n                ),\n                postbuilds,\n                quiet=True,\n            )\n\n        if not postbuilds:\n            return \"\"\n        # Postbuilds expect to be run in the gyp file's directory, so insert an\n        # implicit postbuild to cd to there.\n        postbuilds.insert(\n            0, gyp.common.EncodePOSIXShellList([\"cd\", self.build_to_base])\n        )\n        env = self.ComputeExportEnvString(self.GetSortedXcodePostbuildEnv())\n        # G will be non-null if any postbuild fails. Run all postbuilds in a\n        # subshell.\n        commands = (\n            env\n            + \" (\"\n            + \" && \".join([ninja_syntax.escape(command) for command in postbuilds])\n        )\n        command_string = (\n            commands + \"); G=$$?; \"\n            # Remove the final output if any postbuild failed.\n            \"((exit $$G) || rm -rf %s) \" % output + \"&& exit $$G)\"\n        )\n        if is_command_start:\n            return \"(\" + command_string + \" && \"\n        else:\n            return \"$ && (\" + command_string\n\n    def ComputeExportEnvString(self, env):\n        \"\"\"Given an environment, returns a string looking like\n            'export FOO=foo; export BAR=\"${FOO} bar;'\n        that exports |env| to the shell.\"\"\"\n        export_str = []\n        for k, v in env:\n            export_str.append(\n                \"export %s=%s;\"\n                % (k, ninja_syntax.escape(gyp.common.EncodePOSIXShellArgument(v)))\n            )\n        return \" \".join(export_str)\n\n    def ComputeMacBundleOutput(self):\n        \"\"\"Return the 'output' (full output path) to a bundle output directory.\"\"\"\n        assert self.is_mac_bundle\n        path = generator_default_variables[\"PRODUCT_DIR\"]\n        return self.ExpandSpecial(\n            os.path.join(path, self.xcode_settings.GetWrapperName())\n        )\n\n    def ComputeOutputFileName(self, spec, type=None):\n        \"\"\"Compute the filename of the final output for the current target.\"\"\"\n        if not type:\n            type = spec[\"type\"]\n\n        default_variables = copy.copy(generator_default_variables)\n        CalculateVariables(default_variables, {\"flavor\": self.flavor})\n\n        # Compute filename prefix: the product prefix, or a default for\n        # the product type.\n        DEFAULT_PREFIX = {\n            \"loadable_module\": default_variables[\"SHARED_LIB_PREFIX\"],\n            \"shared_library\": default_variables[\"SHARED_LIB_PREFIX\"],\n            \"static_library\": default_variables[\"STATIC_LIB_PREFIX\"],\n            \"executable\": default_variables[\"EXECUTABLE_PREFIX\"],\n        }\n        prefix = spec.get(\"product_prefix\", DEFAULT_PREFIX.get(type, \"\"))\n\n        # Compute filename extension: the product extension, or a default\n        # for the product type.\n        DEFAULT_EXTENSION = {\n            \"loadable_module\": default_variables[\"SHARED_LIB_SUFFIX\"],\n            \"shared_library\": default_variables[\"SHARED_LIB_SUFFIX\"],\n            \"static_library\": default_variables[\"STATIC_LIB_SUFFIX\"],\n            \"executable\": default_variables[\"EXECUTABLE_SUFFIX\"],\n        }\n        extension = spec.get(\"product_extension\")\n        extension = \".\" + extension if extension else DEFAULT_EXTENSION.get(type, \"\")\n\n        if \"product_name\" in spec:\n            # If we were given an explicit name, use that.\n            target = spec[\"product_name\"]\n        else:\n            # Otherwise, derive a name from the target name.\n            target = spec[\"target_name\"]\n            if prefix == \"lib\":\n                # Snip out an extra 'lib' from libs if appropriate.\n                target = StripPrefix(target, \"lib\")\n\n        if type in (\n            \"static_library\",\n            \"loadable_module\",\n            \"shared_library\",\n            \"executable\",\n        ):\n            return f\"{prefix}{target}{extension}\"\n        elif type == \"none\":\n            return \"%s.stamp\" % target\n        else:\n            raise Exception(\"Unhandled output type %s\" % type)\n\n    def ComputeOutput(self, spec, arch=None):\n        \"\"\"Compute the path for the final output of the spec.\"\"\"\n        type = spec[\"type\"]\n\n        if self.flavor == \"win\":\n            override = self.msvs_settings.GetOutputName(\n                self.config_name, self.ExpandSpecial\n            )\n            if override:\n                return override\n\n        if (\n            arch is None\n            and self.flavor == \"mac\"\n            and type\n            in (\"static_library\", \"executable\", \"shared_library\", \"loadable_module\")\n        ):\n            filename = self.xcode_settings.GetExecutablePath()\n        else:\n            filename = self.ComputeOutputFileName(spec, type)\n\n        if arch is None and \"product_dir\" in spec:\n            path = os.path.join(spec[\"product_dir\"], filename)\n            return self.ExpandSpecial(path)\n\n        # Some products go into the output root, libraries go into shared library\n        # dir, and everything else goes into the normal place.\n        type_in_output_root = [\"executable\", \"loadable_module\"]\n        if self.flavor == \"mac\" and self.toolset == \"target\":\n            type_in_output_root += [\"shared_library\", \"static_library\"]\n        elif self.flavor == \"win\" and self.toolset == \"target\":\n            type_in_output_root += [\"shared_library\"]\n\n        if arch is not None:\n            # Make sure partial executables don't end up in a bundle or the regular\n            # output directory.\n            archdir = \"arch\"\n            if self.toolset != \"target\":\n                archdir = os.path.join(\"arch\", \"%s\" % self.toolset)\n            return os.path.join(archdir, AddArch(filename, arch))\n        elif type in type_in_output_root or self.is_standalone_static_library:\n            return filename\n        elif type == \"shared_library\":\n            libdir = \"lib\"\n            if self.toolset != \"target\":\n                libdir = os.path.join(\"lib\", \"%s\" % self.toolset)\n            return os.path.join(libdir, filename)\n        else:\n            return self.GypPathToUniqueOutput(filename, qualified=False)\n\n    def WriteVariableList(self, ninja_file, var, values):\n        assert not isinstance(values, str)\n        if values is None:\n            values = []\n        ninja_file.variable(var, \" \".join(values))\n\n    def WriteNewNinjaRule(\n        self, name, args, description, win_shell_flags, env, pool, depfile=None\n    ):\n        \"\"\"Write out a new ninja \"rule\" statement for a given command.\n\n        Returns the name of the new rule, and a copy of |args| with variables\n        expanded.\"\"\"\n\n        if self.flavor == \"win\":\n            args = [\n                self.msvs_settings.ConvertVSMacros(\n                    arg, self.base_to_build, config=self.config_name\n                )\n                for arg in args\n            ]\n            description = self.msvs_settings.ConvertVSMacros(\n                description, config=self.config_name\n            )\n        elif self.flavor == \"mac\":\n            # |env| is an empty list on non-mac.\n            args = [gyp.xcode_emulation.ExpandEnvVars(arg, env) for arg in args]\n            description = gyp.xcode_emulation.ExpandEnvVars(description, env)\n\n        # TODO: we shouldn't need to qualify names; we do it because\n        # currently the ninja rule namespace is global, but it really\n        # should be scoped to the subninja.\n        rule_name = self.name\n        if self.toolset == \"target\":\n            rule_name += \".\" + self.toolset\n        rule_name += \".\" + name\n        rule_name = re.sub(\"[^a-zA-Z0-9_]\", \"_\", rule_name)\n\n        # Remove variable references, but not if they refer to the magic rule\n        # variables.  This is not quite right, as it also protects these for\n        # actions, not just for rules where they are valid. Good enough.\n        protect = [\"${root}\", \"${dirname}\", \"${source}\", \"${ext}\", \"${name}\"]\n        protect = \"(?!\" + \"|\".join(map(re.escape, protect)) + \")\"\n        description = re.sub(protect + r\"\\$\", \"_\", description)\n\n        # gyp dictates that commands are run from the base directory.\n        # cd into the directory before running, and adjust paths in\n        # the arguments to point to the proper locations.\n        rspfile = None\n        rspfile_content = None\n        args = [self.ExpandSpecial(arg, self.base_to_build) for arg in args]\n        if self.flavor == \"win\":\n            rspfile = rule_name + \".$unique_name.rsp\"\n            # The cygwin case handles this inside the bash sub-shell.\n            run_in = \"\" if win_shell_flags.cygwin else \" \" + self.build_to_base\n            if win_shell_flags.cygwin:\n                rspfile_content = self.msvs_settings.BuildCygwinBashCommandLine(\n                    args, self.build_to_base\n                )\n            else:\n                rspfile_content = gyp.msvs_emulation.EncodeRspFileList(\n                    args, win_shell_flags.quote\n                )\n            command = (\n                \"%s gyp-win-tool action-wrapper $arch \" % sys.executable\n                + rspfile\n                + run_in\n            )\n        else:\n            env = self.ComputeExportEnvString(env)\n            command = gyp.common.EncodePOSIXShellList(args)\n            command = \"cd %s; \" % self.build_to_base + env + command\n\n        # GYP rules/actions express being no-ops by not touching their outputs.\n        # Avoid executing downstream dependencies in this case by specifying\n        # restat=1 to ninja.\n        self.ninja.rule(\n            rule_name,\n            command,\n            description,\n            depfile=depfile,\n            restat=True,\n            pool=pool,\n            rspfile=rspfile,\n            rspfile_content=rspfile_content,\n        )\n        self.ninja.newline()\n\n        return rule_name, args\n\n\ndef CalculateVariables(default_variables, params):\n    \"\"\"Calculate additional variables for use in the build (called by gyp).\"\"\"\n    global generator_additional_non_configuration_keys\n    global generator_additional_path_sections\n    flavor = gyp.common.GetFlavor(params)\n    if flavor == \"mac\":\n        default_variables.setdefault(\"OS\", \"mac\")\n        default_variables.setdefault(\"SHARED_LIB_SUFFIX\", \".dylib\")\n        default_variables.setdefault(\n            \"SHARED_LIB_DIR\", generator_default_variables[\"PRODUCT_DIR\"]\n        )\n        default_variables.setdefault(\n            \"LIB_DIR\", generator_default_variables[\"PRODUCT_DIR\"]\n        )\n\n        # Copy additional generator configuration data from Xcode, which is shared\n        # by the Mac Ninja generator.\n        import gyp.generator.xcode as xcode_generator  # noqa: PLC0415\n\n        generator_additional_non_configuration_keys = getattr(\n            xcode_generator, \"generator_additional_non_configuration_keys\", []\n        )\n        generator_additional_path_sections = getattr(\n            xcode_generator, \"generator_additional_path_sections\", []\n        )\n        global generator_extra_sources_for_rules\n        generator_extra_sources_for_rules = getattr(\n            xcode_generator, \"generator_extra_sources_for_rules\", []\n        )\n    elif flavor == \"win\":\n        exts = gyp.MSVSUtil.TARGET_TYPE_EXT\n        default_variables.setdefault(\"OS\", \"win\")\n        default_variables[\"EXECUTABLE_SUFFIX\"] = \".\" + exts[\"executable\"]\n        default_variables[\"STATIC_LIB_PREFIX\"] = \"\"\n        default_variables[\"STATIC_LIB_SUFFIX\"] = \".\" + exts[\"static_library\"]\n        default_variables[\"SHARED_LIB_PREFIX\"] = \"\"\n        default_variables[\"SHARED_LIB_SUFFIX\"] = \".\" + exts[\"shared_library\"]\n\n        # Copy additional generator configuration data from VS, which is shared\n        # by the Windows Ninja generator.\n        import gyp.generator.msvs as msvs_generator  # noqa: PLC0415\n\n        generator_additional_non_configuration_keys = getattr(\n            msvs_generator, \"generator_additional_non_configuration_keys\", []\n        )\n        generator_additional_path_sections = getattr(\n            msvs_generator, \"generator_additional_path_sections\", []\n        )\n\n        gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)\n    else:\n        operating_system = flavor\n        if flavor == \"android\":\n            operating_system = \"linux\"  # Keep this legacy behavior for now.\n        default_variables.setdefault(\"OS\", operating_system)\n        default_variables.setdefault(\"SHARED_LIB_SUFFIX\", \".so\")\n        default_variables.setdefault(\n            \"SHARED_LIB_DIR\", os.path.join(\"$!PRODUCT_DIR\", \"lib\")\n        )\n        default_variables.setdefault(\"LIB_DIR\", os.path.join(\"$!PRODUCT_DIR\", \"obj\"))\n\n\ndef ComputeOutputDir(params):\n    \"\"\"Returns the path from the toplevel_dir to the build output directory.\"\"\"\n    # generator_dir: relative path from pwd to where make puts build files.\n    # Makes migrating from make to ninja easier, ninja doesn't put anything here.\n    generator_dir = os.path.relpath(params[\"options\"].generator_output or \".\")\n\n    # output_dir: relative path from generator_dir to the build directory.\n    output_dir = params.get(\"generator_flags\", {}).get(\"output_dir\", \"out\")\n\n    # Relative path from source root to our output files.  e.g. \"out\"\n    return os.path.normpath(os.path.join(generator_dir, output_dir))\n\n\ndef CalculateGeneratorInputInfo(params):\n    \"\"\"Called by __init__ to initialize generator values based on params.\"\"\"\n    # E.g. \"out/gypfiles\"\n    toplevel = params[\"options\"].toplevel_dir\n    qualified_out_dir = os.path.normpath(\n        os.path.join(toplevel, ComputeOutputDir(params), \"gypfiles\")\n    )\n\n    global generator_filelist_paths\n    generator_filelist_paths = {\n        \"toplevel\": toplevel,\n        \"qualified_out_dir\": qualified_out_dir,\n    }\n\n\ndef OpenOutput(path, mode=\"w\"):\n    \"\"\"Open |path| for writing, creating directories if necessary.\"\"\"\n    gyp.common.EnsureDirExists(path)\n    return open(path, mode)\n\n\ndef CommandWithWrapper(cmd, wrappers, prog):\n    if wrapper := wrappers.get(cmd, \"\"):\n        return wrapper + \" \" + prog\n    return prog\n\n\ndef GetDefaultConcurrentLinks():\n    \"\"\"Returns a best-guess for a number of concurrent links.\"\"\"\n    if pool_size := int(os.environ.get(\"GYP_LINK_CONCURRENCY\") or 0):\n        return pool_size\n\n    if sys.platform in (\"win32\", \"cygwin\"):\n\n        class MEMORYSTATUSEX(ctypes.Structure):\n            _fields_ = [\n                (\"dwLength\", ctypes.c_ulong),\n                (\"dwMemoryLoad\", ctypes.c_ulong),\n                (\"ullTotalPhys\", ctypes.c_ulonglong),\n                (\"ullAvailPhys\", ctypes.c_ulonglong),\n                (\"ullTotalPageFile\", ctypes.c_ulonglong),\n                (\"ullAvailPageFile\", ctypes.c_ulonglong),\n                (\"ullTotalVirtual\", ctypes.c_ulonglong),\n                (\"ullAvailVirtual\", ctypes.c_ulonglong),\n                (\"sullAvailExtendedVirtual\", ctypes.c_ulonglong),\n            ]\n\n        stat = MEMORYSTATUSEX()\n        stat.dwLength = ctypes.sizeof(stat)\n        ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))\n\n        # VS 2015 uses 20% more working set than VS 2013 and can consume all RAM\n        # on a 64 GiB machine.\n        mem_limit = max(1, stat.ullTotalPhys // (5 * (2**30)))  # total / 5GiB\n        hard_cap = max(1, int(os.environ.get(\"GYP_LINK_CONCURRENCY_MAX\") or 2**32))\n        return min(mem_limit, hard_cap)\n    elif sys.platform.startswith(\"linux\"):\n        if os.path.exists(\"/proc/meminfo\"):\n            with open(\"/proc/meminfo\") as meminfo:\n                memtotal_re = re.compile(r\"^MemTotal:\\s*(\\d*)\\s*kB\")\n                for line in meminfo:\n                    match = memtotal_re.match(line)\n                    if not match:\n                        continue\n                    # Allow 8Gb per link on Linux because Gold is quite memory hungry\n                    return max(1, int(match.group(1)) // (8 * (2**20)))\n        return 1\n    elif sys.platform == \"darwin\":\n        try:\n            avail_bytes = int(subprocess.check_output([\"sysctl\", \"-n\", \"hw.memsize\"]))\n            # A static library debug build of Chromium's unit_tests takes ~2.7GB, so\n            # 4GB per ld process allows for some more bloat.\n            return max(1, avail_bytes // (4 * (2**30)))  # total / 4GB\n        except subprocess.CalledProcessError:\n            return 1\n    else:\n        # TODO(scottmg): Implement this for other platforms.\n        return 1\n\n\ndef _GetWinLinkRuleNameSuffix(embed_manifest):\n    \"\"\"Returns the suffix used to select an appropriate linking rule depending on\n    whether the manifest embedding is enabled.\"\"\"\n    return \"_embed\" if embed_manifest else \"\"\n\n\ndef _AddWinLinkRules(master_ninja, embed_manifest):\n    \"\"\"Adds link rules for Windows platform to |master_ninja|.\"\"\"\n\n    def FullLinkCommand(ldcmd, out, binary_type):\n        resource_name = {\"exe\": \"1\", \"dll\": \"2\"}[binary_type]\n        return (\n            \"%(python)s gyp-win-tool link-with-manifests $arch %(embed)s \"\n            '%(out)s \"%(ldcmd)s\" %(resname)s $mt $rc \"$intermediatemanifest\" '\n            \"$manifests\"\n            % {\n                \"python\": sys.executable,\n                \"out\": out,\n                \"ldcmd\": ldcmd,\n                \"resname\": resource_name,\n                \"embed\": embed_manifest,\n            }\n        )\n\n    rule_name_suffix = _GetWinLinkRuleNameSuffix(embed_manifest)\n    use_separate_mspdbsrv = int(os.environ.get(\"GYP_USE_SEPARATE_MSPDBSRV\", \"0\")) != 0\n    dlldesc = \"LINK%s(DLL) $binary\" % rule_name_suffix.upper()\n    dllcmd = (\n        \"%s gyp-win-tool link-wrapper $arch %s \"\n        \"$ld /nologo $implibflag /DLL /OUT:$binary \"\n        \"@$binary.rsp\" % (sys.executable, use_separate_mspdbsrv)\n    )\n    dllcmd = FullLinkCommand(dllcmd, \"$binary\", \"dll\")\n    master_ninja.rule(\n        \"solink\" + rule_name_suffix,\n        description=dlldesc,\n        command=dllcmd,\n        rspfile=\"$binary.rsp\",\n        rspfile_content=\"$libs $in_newline $ldflags\",\n        restat=True,\n        pool=\"link_pool\",\n    )\n    master_ninja.rule(\n        \"solink_module\" + rule_name_suffix,\n        description=dlldesc,\n        command=dllcmd,\n        rspfile=\"$binary.rsp\",\n        rspfile_content=\"$libs $in_newline $ldflags\",\n        restat=True,\n        pool=\"link_pool\",\n    )\n    # Note that ldflags goes at the end so that it has the option of\n    # overriding default settings earlier in the command line.\n    exe_cmd = (\n        \"%s gyp-win-tool link-wrapper $arch %s \"\n        \"$ld /nologo /OUT:$binary @$binary.rsp\"\n        % (sys.executable, use_separate_mspdbsrv)\n    )\n    exe_cmd = FullLinkCommand(exe_cmd, \"$binary\", \"exe\")\n    master_ninja.rule(\n        \"link\" + rule_name_suffix,\n        description=\"LINK%s $binary\" % rule_name_suffix.upper(),\n        command=exe_cmd,\n        rspfile=\"$binary.rsp\",\n        rspfile_content=\"$in_newline $libs $ldflags\",\n        pool=\"link_pool\",\n    )\n\n\ndef GenerateOutputForConfig(target_list, target_dicts, data, params, config_name):\n    options = params[\"options\"]\n    flavor = gyp.common.GetFlavor(params)\n    generator_flags = params.get(\"generator_flags\", {})\n    generate_compile_commands = generator_flags.get(\"compile_commands\", False)\n\n    # build_dir: relative path from source root to our output files.\n    # e.g. \"out/Debug\"\n    build_dir = os.path.normpath(os.path.join(ComputeOutputDir(params), config_name))\n\n    toplevel_build = os.path.join(options.toplevel_dir, build_dir)\n\n    master_ninja_file = OpenOutput(os.path.join(toplevel_build, \"build.ninja\"))\n    master_ninja = ninja_syntax.Writer(master_ninja_file, width=120)\n\n    # Put build-time support tools in out/{config_name}.\n    gyp.common.CopyTool(flavor, toplevel_build, generator_flags)\n\n    # Grab make settings for CC/CXX.\n    # The rules are\n    # - The priority from low to high is gcc/g++, the 'make_global_settings' in\n    #   gyp, the environment variable.\n    # - If there is no 'make_global_settings' for CC.host/CXX.host or\n    #   'CC_host'/'CXX_host' environment variable, cc_host/cxx_host should be set\n    #   to cc/cxx.\n    if flavor == \"win\":\n        ar = \"lib.exe\"\n        # cc and cxx must be set to the correct architecture by overriding with one\n        # of cl_x86 or cl_x64 below.\n        cc = \"UNSET\"\n        cxx = \"UNSET\"\n        ld = \"link.exe\"\n        ld_host = \"$ld\"\n    else:\n        ar = \"ar\"\n        cc = \"cc\"\n        cxx = \"c++\"\n        ld = \"$cc\"\n        ldxx = \"$cxx\"\n        ld_host = \"$cc_host\"\n        ldxx_host = \"$cxx_host\"\n\n    ar_host = ar\n    cc_host = None\n    cxx_host = None\n    cc_host_global_setting = None\n    cxx_host_global_setting = None\n    clang_cl = None\n    nm = \"nm\"\n    nm_host = \"nm\"\n    readelf = \"readelf\"\n    readelf_host = \"readelf\"\n\n    build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])\n    make_global_settings = data[build_file].get(\"make_global_settings\", [])\n    build_to_root = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir)\n    wrappers = {}\n    for key, value in make_global_settings:\n        if key == \"AR\":\n            ar = os.path.join(build_to_root, value)\n        if key == \"AR.host\":\n            ar_host = os.path.join(build_to_root, value)\n        if key == \"CC\":\n            cc = os.path.join(build_to_root, value)\n            if cc.endswith(\"clang-cl\"):\n                clang_cl = cc\n        if key == \"CXX\":\n            cxx = os.path.join(build_to_root, value)\n        if key == \"CC.host\":\n            cc_host = os.path.join(build_to_root, value)\n            cc_host_global_setting = value\n        if key == \"CXX.host\":\n            cxx_host = os.path.join(build_to_root, value)\n            cxx_host_global_setting = value\n        if key == \"LD\":\n            ld = os.path.join(build_to_root, value)\n        if key == \"LD.host\":\n            ld_host = os.path.join(build_to_root, value)\n        if key == \"LDXX\":\n            ldxx = os.path.join(build_to_root, value)\n        if key == \"LDXX.host\":\n            ldxx_host = os.path.join(build_to_root, value)\n        if key == \"NM\":\n            nm = os.path.join(build_to_root, value)\n        if key == \"NM.host\":\n            nm_host = os.path.join(build_to_root, value)\n        if key == \"READELF\":\n            readelf = os.path.join(build_to_root, value)\n        if key == \"READELF.host\":\n            readelf_host = os.path.join(build_to_root, value)\n        if key.endswith(\"_wrapper\"):\n            wrappers[key[: -len(\"_wrapper\")]] = os.path.join(build_to_root, value)\n\n    # Support wrappers from environment variables too.\n    for key, value in os.environ.items():\n        if key.lower().endswith(\"_wrapper\"):\n            key_prefix = key[: -len(\"_wrapper\")]\n            key_prefix = re.sub(r\"\\.HOST$\", \".host\", key_prefix)\n            wrappers[key_prefix] = os.path.join(build_to_root, value)\n\n    if mac_toolchain_dir := generator_flags.get(\"mac_toolchain_dir\", None):\n        wrappers[\"LINK\"] = \"export DEVELOPER_DIR='%s' &&\" % mac_toolchain_dir\n\n    if flavor == \"win\":\n        configs = [\n            target_dicts[qualified_target][\"configurations\"][config_name]\n            for qualified_target in target_list\n        ]\n        shared_system_includes = None\n        if not generator_flags.get(\"ninja_use_custom_environment_files\", 0):\n            shared_system_includes = gyp.msvs_emulation.ExtractSharedMSVSSystemIncludes(\n                configs, generator_flags\n            )\n        cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles(\n            toplevel_build, generator_flags, shared_system_includes, OpenOutput\n        )\n        for arch, path in sorted(cl_paths.items()):\n            if clang_cl:\n                # If we have selected clang-cl, use that instead.\n                path = clang_cl\n            command = CommandWithWrapper(\n                \"CC\", wrappers, QuoteShellArgument(path, \"win\")\n            )\n            if clang_cl:\n                # Use clang-cl to cross-compile for x86 or x86_64.\n                command += \" -m32\" if arch == \"x86\" else \" -m64\"\n            master_ninja.variable(\"cl_\" + arch, command)\n\n    cc = GetEnvironFallback([\"CC_target\", \"CC\"], cc)\n    master_ninja.variable(\"cc\", CommandWithWrapper(\"CC\", wrappers, cc))\n    cxx = GetEnvironFallback([\"CXX_target\", \"CXX\"], cxx)\n    master_ninja.variable(\"cxx\", CommandWithWrapper(\"CXX\", wrappers, cxx))\n\n    if flavor == \"win\":\n        master_ninja.variable(\"ld\", ld)\n        master_ninja.variable(\"idl\", \"midl.exe\")\n        master_ninja.variable(\"ar\", ar)\n        master_ninja.variable(\"rc\", \"rc.exe\")\n        master_ninja.variable(\"ml_x86\", \"ml.exe\")\n        master_ninja.variable(\"ml_x64\", \"ml64.exe\")\n        master_ninja.variable(\"mt\", \"mt.exe\")\n    else:\n        master_ninja.variable(\"ld\", CommandWithWrapper(\"LINK\", wrappers, ld))\n        master_ninja.variable(\"ldxx\", CommandWithWrapper(\"LINK\", wrappers, ldxx))\n        master_ninja.variable(\"ar\", GetEnvironFallback([\"AR_target\", \"AR\"], ar))\n        if flavor != \"mac\":\n            # Mac does not use readelf/nm for .TOC generation, so avoiding polluting\n            # the master ninja with extra unused variables.\n            master_ninja.variable(\"nm\", GetEnvironFallback([\"NM_target\", \"NM\"], nm))\n            master_ninja.variable(\n                \"readelf\", GetEnvironFallback([\"READELF_target\", \"READELF\"], readelf)\n            )\n\n    if generator_supports_multiple_toolsets:\n        if not cc_host:\n            cc_host = cc\n        if not cxx_host:\n            cxx_host = cxx\n\n        master_ninja.variable(\"ar_host\", GetEnvironFallback([\"AR_host\"], ar_host))\n        master_ninja.variable(\"nm_host\", GetEnvironFallback([\"NM_host\"], nm_host))\n        master_ninja.variable(\n            \"readelf_host\", GetEnvironFallback([\"READELF_host\"], readelf_host)\n        )\n        cc_host = GetEnvironFallback([\"CC_host\"], cc_host)\n        cxx_host = GetEnvironFallback([\"CXX_host\"], cxx_host)\n\n        # The environment variable could be used in 'make_global_settings', like\n        # ['CC.host', '$(CC)'] or ['CXX.host', '$(CXX)'], transform them here.\n        if \"$(CC)\" in cc_host and cc_host_global_setting:\n            cc_host = cc_host_global_setting.replace(\"$(CC)\", cc)\n        if \"$(CXX)\" in cxx_host and cxx_host_global_setting:\n            cxx_host = cxx_host_global_setting.replace(\"$(CXX)\", cxx)\n        master_ninja.variable(\n            \"cc_host\", CommandWithWrapper(\"CC.host\", wrappers, cc_host)\n        )\n        master_ninja.variable(\n            \"cxx_host\", CommandWithWrapper(\"CXX.host\", wrappers, cxx_host)\n        )\n        if flavor == \"win\":\n            master_ninja.variable(\"ld_host\", ld_host)\n        else:\n            master_ninja.variable(\n                \"ld_host\", CommandWithWrapper(\"LINK\", wrappers, ld_host)\n            )\n            master_ninja.variable(\n                \"ldxx_host\", CommandWithWrapper(\"LINK\", wrappers, ldxx_host)\n            )\n\n    master_ninja.newline()\n\n    master_ninja.pool(\"link_pool\", depth=GetDefaultConcurrentLinks())\n    master_ninja.newline()\n\n    deps = \"msvc\" if flavor == \"win\" else \"gcc\"\n\n    if flavor != \"win\":\n        master_ninja.rule(\n            \"cc\",\n            description=\"CC $out\",\n            command=(\n                \"$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c \"\n                \"$cflags_pch_c -c $in -o $out\"\n            ),\n            depfile=\"$out.d\",\n            deps=deps,\n        )\n        master_ninja.rule(\n            \"cc_s\",\n            description=\"CC $out\",\n            command=(\n                \"$cc $defines $includes $cflags $cflags_c $cflags_pch_c -c $in -o $out\"\n            ),\n        )\n        master_ninja.rule(\n            \"cxx\",\n            description=\"CXX $out\",\n            command=(\n                \"$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc \"\n                \"$cflags_pch_cc -c $in -o $out\"\n            ),\n            depfile=\"$out.d\",\n            deps=deps,\n        )\n    else:\n        # TODO(scottmg) Separate pdb names is a test to see if it works around\n        # http://crbug.com/142362. It seems there's a race between the creation of\n        # the .pdb by the precompiled header step for .cc and the compilation of\n        # .c files. This should be handled by mspdbsrv, but rarely errors out with\n        #   c1xx : fatal error C1033: cannot open program database\n        # By making the rules target separate pdb files this might be avoided.\n        cc_command = (\n            \"ninja -t msvc -e $arch \" + \"-- \"\n            \"$cc /nologo /showIncludes /FC \"\n            \"@$out.rsp /c $in /Fo$out /Fd$pdbname_c \"\n        )\n        cxx_command = (\n            \"ninja -t msvc -e $arch \" + \"-- \"\n            \"$cxx /nologo /showIncludes /FC \"\n            \"@$out.rsp /c $in /Fo$out /Fd$pdbname_cc \"\n        )\n        master_ninja.rule(\n            \"cc\",\n            description=\"CC $out\",\n            command=cc_command,\n            rspfile=\"$out.rsp\",\n            rspfile_content=\"$defines $includes $cflags $cflags_c\",\n            deps=deps,\n        )\n        master_ninja.rule(\n            \"cxx\",\n            description=\"CXX $out\",\n            command=cxx_command,\n            rspfile=\"$out.rsp\",\n            rspfile_content=\"$defines $includes $cflags $cflags_cc\",\n            deps=deps,\n        )\n        master_ninja.rule(\n            \"idl\",\n            description=\"IDL $in\",\n            command=(\n                \"%s gyp-win-tool midl-wrapper $arch $outdir \"\n                \"$tlb $h $dlldata $iid $proxy $in \"\n                \"$midl_includes $idlflags\" % sys.executable\n            ),\n        )\n        master_ninja.rule(\n            \"rc\",\n            description=\"RC $in\",\n            # Note: $in must be last otherwise rc.exe complains.\n            command=(\n                \"%s gyp-win-tool rc-wrapper \"\n                \"$arch $rc $defines $resource_includes $rcflags /fo$out $in\"\n                % sys.executable\n            ),\n        )\n        master_ninja.rule(\n            \"asm\",\n            description=\"ASM $out\",\n            command=(\n                \"%s gyp-win-tool asm-wrapper \"\n                \"$arch $asm $defines $includes $asmflags /c /Fo $out $in\"\n                % sys.executable\n            ),\n        )\n\n    if flavor not in (\"ios\", \"mac\", \"win\"):\n        master_ninja.rule(\n            \"alink\",\n            description=\"AR $out\",\n            command=\"rm -f $out && $ar rcs $arflags $out $in\",\n        )\n        master_ninja.rule(\n            \"alink_thin\",\n            description=\"AR $out\",\n            command=\"rm -f $out && $ar rcsT $arflags $out $in\",\n        )\n\n        # This allows targets that only need to depend on $lib's API to declare an\n        # order-only dependency on $lib.TOC and avoid relinking such downstream\n        # dependencies when $lib changes only in non-public ways.\n        # The resulting string leaves an uninterpolated %{suffix} which\n        # is used in the final substitution below.\n        mtime_preserving_solink_base = (\n            \"if [ ! -e $lib -o ! -e $lib.TOC ]; then \"\n            \"%(solink)s && %(extract_toc)s > $lib.TOC; else \"\n            \"%(solink)s && %(extract_toc)s > $lib.tmp && \"\n            \"if ! cmp -s $lib.tmp $lib.TOC; then mv $lib.tmp $lib.TOC ; \"\n            \"fi; fi\"\n            % {\n                \"solink\": \"$ld -shared $ldflags -o $lib -Wl,-soname=$soname %(suffix)s\",\n                \"extract_toc\": (\n                    \"{ $readelf -d $lib | grep SONAME ; \"\n                    \"$nm -gD -f p $lib | cut -f1-2 -d' '; }\"\n                ),\n            }\n        )\n\n        master_ninja.rule(\n            \"solink\",\n            description=\"SOLINK $lib\",\n            restat=True,\n            command=mtime_preserving_solink_base % {\"suffix\": \"@$link_file_list\"},\n            rspfile=\"$link_file_list\",\n            rspfile_content=(\n                \"-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive $libs\"\n            ),\n            pool=\"link_pool\",\n        )\n        master_ninja.rule(\n            \"solink_module\",\n            description=\"SOLINK(module) $lib\",\n            restat=True,\n            command=mtime_preserving_solink_base % {\"suffix\": \"@$link_file_list\"},\n            rspfile=\"$link_file_list\",\n            rspfile_content=\"-Wl,--start-group $in $solibs $libs -Wl,--end-group\",\n            pool=\"link_pool\",\n        )\n        master_ninja.rule(\n            \"link\",\n            description=\"LINK $out\",\n            command=(\n                \"$ld $ldflags -o $out \"\n                \"-Wl,--start-group $in $solibs $libs -Wl,--end-group\"\n            ),\n            pool=\"link_pool\",\n        )\n    elif flavor == \"win\":\n        master_ninja.rule(\n            \"alink\",\n            description=\"LIB $out\",\n            command=(\n                \"%s gyp-win-tool link-wrapper $arch False \"\n                \"$ar /nologo /ignore:4221 /OUT:$out @$out.rsp\" % sys.executable\n            ),\n            rspfile=\"$out.rsp\",\n            rspfile_content=\"$in_newline $libflags\",\n        )\n        _AddWinLinkRules(master_ninja, embed_manifest=True)\n        _AddWinLinkRules(master_ninja, embed_manifest=False)\n    else:\n        master_ninja.rule(\n            \"objc\",\n            description=\"OBJC $out\",\n            command=(\n                \"$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc \"\n                \"$cflags_pch_objc -c $in -o $out\"\n            ),\n            depfile=\"$out.d\",\n            deps=deps,\n        )\n        master_ninja.rule(\n            \"objcxx\",\n            description=\"OBJCXX $out\",\n            command=(\n                \"$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_objcc \"\n                \"$cflags_pch_objcc -c $in -o $out\"\n            ),\n            depfile=\"$out.d\",\n            deps=deps,\n        )\n        master_ninja.rule(\n            \"alink\",\n            description=\"LIBTOOL-STATIC $out, POSTBUILDS\",\n            command=\"rm -f $out && \"\n            \"%s gyp-mac-tool filter-libtool libtool $libtool_flags \"\n            \"-static -o $out $in\"\n            \"$postbuilds\" % sys.executable,\n        )\n        master_ninja.rule(\n            \"lipo\",\n            description=\"LIPO $out, POSTBUILDS\",\n            command=\"rm -f $out && lipo -create $in -output $out$postbuilds\",\n        )\n        master_ninja.rule(\n            \"solipo\",\n            description=\"SOLIPO $out, POSTBUILDS\",\n            command=(\n                \"rm -f $lib $lib.TOC && lipo -create $in -output $lib$postbuilds &&\"\n                \"%(extract_toc)s > $lib.TOC\"\n                % {\n                    \"extract_toc\": \"{ otool -l $lib | grep LC_ID_DYLIB -A 5; \"\n                    \"nm -gP $lib | cut -f1-2 -d' ' | grep -v U$$; true; }\"\n                }\n            ),\n        )\n\n        # Record the public interface of $lib in $lib.TOC. See the corresponding\n        # comment in the posix section above for details.\n        solink_base = \"$ld %(type)s $ldflags -o $lib %(suffix)s\"\n        mtime_preserving_solink_base = (\n            \"if [ ! -e $lib -o ! -e $lib.TOC ] || \"\n            # Always force dependent targets to relink if this library\n            # reexports something. Handling this correctly would require\n            # recursive TOC dumping but this is rare in practice, so punt.\n            \"otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then \"\n            \"%(solink)s && %(extract_toc)s > $lib.TOC; \"\n            \"else \"\n            \"%(solink)s && %(extract_toc)s > $lib.tmp && \"\n            \"if ! cmp -s $lib.tmp $lib.TOC; then \"\n            \"mv $lib.tmp $lib.TOC ; \"\n            \"fi; \"\n            \"fi\"\n            % {\n                \"solink\": solink_base,\n                \"extract_toc\": \"{ otool -l $lib | grep LC_ID_DYLIB -A 5; \"\n                \"nm -gP $lib | cut -f1-2 -d' ' | grep -v U$$; true; }\",\n            }\n        )\n\n        solink_suffix = \"@$link_file_list$postbuilds\"\n        master_ninja.rule(\n            \"solink\",\n            description=\"SOLINK $lib, POSTBUILDS\",\n            restat=True,\n            command=mtime_preserving_solink_base\n            % {\"suffix\": solink_suffix, \"type\": \"-shared\"},\n            rspfile=\"$link_file_list\",\n            rspfile_content=\"$in $solibs $libs\",\n            pool=\"link_pool\",\n        )\n        master_ninja.rule(\n            \"solink_notoc\",\n            description=\"SOLINK $lib, POSTBUILDS\",\n            restat=True,\n            command=solink_base % {\"suffix\": solink_suffix, \"type\": \"-shared\"},\n            rspfile=\"$link_file_list\",\n            rspfile_content=\"$in $solibs $libs\",\n            pool=\"link_pool\",\n        )\n\n        master_ninja.rule(\n            \"solink_module\",\n            description=\"SOLINK(module) $lib, POSTBUILDS\",\n            restat=True,\n            command=mtime_preserving_solink_base\n            % {\"suffix\": solink_suffix, \"type\": \"-bundle\"},\n            rspfile=\"$link_file_list\",\n            rspfile_content=\"$in $solibs $libs\",\n            pool=\"link_pool\",\n        )\n        master_ninja.rule(\n            \"solink_module_notoc\",\n            description=\"SOLINK(module) $lib, POSTBUILDS\",\n            restat=True,\n            command=solink_base % {\"suffix\": solink_suffix, \"type\": \"-bundle\"},\n            rspfile=\"$link_file_list\",\n            rspfile_content=\"$in $solibs $libs\",\n            pool=\"link_pool\",\n        )\n\n        master_ninja.rule(\n            \"link\",\n            description=\"LINK $out, POSTBUILDS\",\n            command=(\"$ld $ldflags -o $out $in $solibs $libs$postbuilds\"),\n            pool=\"link_pool\",\n        )\n        master_ninja.rule(\n            \"preprocess_infoplist\",\n            description=\"PREPROCESS INFOPLIST $out\",\n            command=(\n                \"$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && \"\n                \"plutil -convert xml1 $out $out\"\n            ),\n        )\n        master_ninja.rule(\n            \"copy_infoplist\",\n            description=\"COPY INFOPLIST $in\",\n            command=\"$env %s gyp-mac-tool copy-info-plist $in $out $binary $keys\"\n            % sys.executable,\n        )\n        master_ninja.rule(\n            \"merge_infoplist\",\n            description=\"MERGE INFOPLISTS $in\",\n            command=\"$env %s gyp-mac-tool merge-info-plist $out $in\" % sys.executable,\n        )\n        master_ninja.rule(\n            \"compile_xcassets\",\n            description=\"COMPILE XCASSETS $in\",\n            command=\"$env %s gyp-mac-tool compile-xcassets $keys $in\" % sys.executable,\n        )\n        master_ninja.rule(\n            \"compile_ios_framework_headers\",\n            description=\"COMPILE HEADER MAPS AND COPY FRAMEWORK HEADERS $in\",\n            command=\"$env %(python)s gyp-mac-tool compile-ios-framework-header-map \"\n            \"$out $framework $in && $env %(python)s gyp-mac-tool \"\n            \"copy-ios-framework-headers $framework $copy_headers\"\n            % {\"python\": sys.executable},\n        )\n        master_ninja.rule(\n            \"mac_tool\",\n            description=\"MACTOOL $mactool_cmd $in\",\n            command=\"$env %s gyp-mac-tool $mactool_cmd $in $out $binary\"\n            % sys.executable,\n        )\n        master_ninja.rule(\n            \"package_framework\",\n            description=\"PACKAGE FRAMEWORK $out, POSTBUILDS\",\n            command=\"%s gyp-mac-tool package-framework $out $version$postbuilds \"\n            \"&& touch $out\" % sys.executable,\n        )\n        master_ninja.rule(\n            \"package_ios_framework\",\n            description=\"PACKAGE IOS FRAMEWORK $out, POSTBUILDS\",\n            command=\"%s gyp-mac-tool package-ios-framework $out $postbuilds \"\n            \"&& touch $out\" % sys.executable,\n        )\n    if flavor == \"win\":\n        master_ninja.rule(\n            \"stamp\",\n            description=\"STAMP $out\",\n            command=\"%s gyp-win-tool stamp $out\" % sys.executable,\n        )\n    else:\n        master_ninja.rule(\n            \"stamp\", description=\"STAMP $out\", command=\"${postbuilds}touch $out\"\n        )\n    if flavor == \"win\":\n        master_ninja.rule(\n            \"copy\",\n            description=\"COPY $in $out\",\n            command=\"%s gyp-win-tool recursive-mirror $in $out\" % sys.executable,\n        )\n    elif flavor == \"zos\":\n        master_ninja.rule(\n            \"copy\",\n            description=\"COPY $in $out\",\n            command=\"rm -rf $out && cp -fRP $in $out\",\n        )\n    else:\n        master_ninja.rule(\n            \"copy\",\n            description=\"COPY $in $out\",\n            command=\"ln -f $in $out 2>/dev/null || (rm -rf $out && cp -af $in $out)\",\n        )\n    master_ninja.newline()\n\n    all_targets = set()\n    for build_file in params[\"build_files\"]:\n        for target in gyp.common.AllTargets(\n            target_list, target_dicts, os.path.normpath(build_file)\n        ):\n            all_targets.add(target)\n    all_outputs = set()\n\n    # target_outputs is a map from qualified target name to a Target object.\n    target_outputs = {}\n    # target_short_names is a map from target short name to a list of Target\n    # objects.\n    target_short_names = {}\n\n    # short name of targets that were skipped because they didn't contain anything\n    # interesting.\n    # NOTE: there may be overlap between this an non_empty_target_names.\n    empty_target_names = set()\n\n    # Set of non-empty short target names.\n    # NOTE: there may be overlap between this an empty_target_names.\n    non_empty_target_names = set()\n\n    for qualified_target in target_list:\n        # qualified_target is like: third_party/icu/icu.gyp:icui18n#target\n        build_file, name, toolset = gyp.common.ParseQualifiedTarget(qualified_target)\n\n        this_make_global_settings = data[build_file].get(\"make_global_settings\", [])\n        assert make_global_settings == this_make_global_settings, (\n            \"make_global_settings needs to be the same for all targets. \"\n            f\"{this_make_global_settings} vs. {make_global_settings}\"\n        )\n\n        spec = target_dicts[qualified_target]\n        if flavor == \"mac\":\n            gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec)\n\n        # If build_file is a symlink, we must not follow it because there's a chance\n        # it could point to a path above toplevel_dir, and we cannot correctly deal\n        # with that case at the moment.\n        build_file = gyp.common.RelativePath(build_file, options.toplevel_dir, False)\n\n        qualified_target_for_hash = gyp.common.QualifiedTarget(\n            build_file, name, toolset\n        )\n        qualified_target_for_hash = qualified_target_for_hash.encode(\"utf-8\")\n        hash_for_rules = hashlib.sha256(qualified_target_for_hash).hexdigest()\n\n        base_path = os.path.dirname(build_file)\n        obj = \"obj\"\n        if toolset != \"target\":\n            obj += \".\" + toolset\n        output_file = os.path.join(obj, base_path, name + \".ninja\")\n\n        ninja_output = StringIO()\n        writer = NinjaWriter(\n            hash_for_rules,\n            target_outputs,\n            base_path,\n            build_dir,\n            ninja_output,\n            toplevel_build,\n            output_file,\n            flavor,\n            toplevel_dir=options.toplevel_dir,\n        )\n\n        target = writer.WriteSpec(spec, config_name, generator_flags)\n\n        if ninja_output.tell() > 0:\n            # Only create files for ninja files that actually have contents.\n            with OpenOutput(os.path.join(toplevel_build, output_file)) as ninja_file:\n                ninja_file.write(ninja_output.getvalue())\n            ninja_output.close()\n            master_ninja.subninja(output_file)\n\n        if target:\n            if name != target.FinalOutput() and spec[\"toolset\"] == \"target\":\n                target_short_names.setdefault(name, []).append(target)\n            target_outputs[qualified_target] = target\n            if qualified_target in all_targets:\n                all_outputs.add(target.FinalOutput())\n            non_empty_target_names.add(name)\n        else:\n            empty_target_names.add(name)\n\n    if target_short_names:\n        # Write a short name to build this target.  This benefits both the\n        # \"build chrome\" case as well as the gyp tests, which expect to be\n        # able to run actions and build libraries by their short name.\n        master_ninja.newline()\n        master_ninja.comment(\"Short names for targets.\")\n        for short_name in sorted(target_short_names):\n            master_ninja.build(\n                short_name,\n                \"phony\",\n                [x.FinalOutput() for x in target_short_names[short_name]],\n            )\n\n    # Write phony targets for any empty targets that weren't written yet. As\n    # short names are  not necessarily unique only do this for short names that\n    # haven't already been output for another target.\n    empty_target_names = empty_target_names - non_empty_target_names\n    if empty_target_names:\n        master_ninja.newline()\n        master_ninja.comment(\"Empty targets (output for completeness).\")\n        for name in sorted(empty_target_names):\n            master_ninja.build(name, \"phony\")\n\n    if all_outputs:\n        master_ninja.newline()\n        master_ninja.build(\"all\", \"phony\", sorted(all_outputs))\n        master_ninja.default(generator_flags.get(\"default_target\", \"all\"))\n\n    master_ninja_file.close()\n\n    if generate_compile_commands:\n        compile_db = GenerateCompileDBWithNinja(toplevel_build)\n        compile_db_file = OpenOutput(\n            os.path.join(toplevel_build, \"compile_commands.json\")\n        )\n        compile_db_file.write(json.dumps(compile_db, indent=2))\n        compile_db_file.close()\n\n\ndef GenerateCompileDBWithNinja(path, targets=[\"all\"]):\n    \"\"\"Generates a compile database using ninja.\n\n    Args:\n        path: The build directory to generate a compile database for.\n        targets: Additional targets to pass to ninja.\n\n    Returns:\n        List of the contents of the compile database.\n    \"\"\"\n    ninja_path = shutil.which(\"ninja\")\n    if ninja_path is None:\n        raise Exception(\"ninja not found in PATH\")\n    json_compile_db = subprocess.check_output(\n        [ninja_path, \"-C\", path]\n        + targets\n        + [\"-t\", \"compdb\", \"cc\", \"cxx\", \"objc\", \"objcxx\"]\n    )\n    return json.loads(json_compile_db)\n\n\ndef PerformBuild(data, configurations, params):\n    options = params[\"options\"]\n    for config in configurations:\n        builddir = os.path.join(options.toplevel_dir, \"out\", config)\n        arguments = [\"ninja\", \"-C\", builddir]\n        print(f\"Building [{config}]: {arguments}\")\n        subprocess.check_call(arguments)\n\n\ndef CallGenerateOutputForConfig(arglist):\n    # Ignore the interrupt signal so that the parent process catches it and\n    # kills all multiprocessing children.\n    signal.signal(signal.SIGINT, signal.SIG_IGN)\n\n    (target_list, target_dicts, data, params, config_name) = arglist\n    GenerateOutputForConfig(target_list, target_dicts, data, params, config_name)\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    # Update target_dicts for iOS device builds.\n    target_dicts = gyp.xcode_emulation.CloneConfigurationForDeviceAndEmulator(\n        target_dicts\n    )\n\n    user_config = params.get(\"generator_flags\", {}).get(\"config\", None)\n    if gyp.common.GetFlavor(params) == \"win\":\n        target_list, target_dicts = MSVSUtil.ShardTargets(target_list, target_dicts)\n        target_list, target_dicts = MSVSUtil.InsertLargePdbShims(\n            target_list, target_dicts, generator_default_variables\n        )\n\n    if user_config:\n        GenerateOutputForConfig(target_list, target_dicts, data, params, user_config)\n    else:\n        config_names = target_dicts[target_list[0]][\"configurations\"]\n        if params[\"parallel\"]:\n            try:\n                pool = multiprocessing.Pool(len(config_names))\n                arglists = []\n                for config_name in config_names:\n                    arglists.append(\n                        (target_list, target_dicts, data, params, config_name)\n                    )\n                pool.map(CallGenerateOutputForConfig, arglists)\n            except KeyboardInterrupt as e:\n                pool.terminate()\n                raise e\n        else:\n            for config_name in config_names:\n                GenerateOutputForConfig(\n                    target_list, target_dicts, data, params, config_name\n                )\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/ninja_test.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Unit tests for the ninja.py file.\"\"\"\n\nimport sys\nimport unittest\nfrom pathlib import Path\n\nfrom gyp.generator import ninja\n\n\nclass TestPrefixesAndSuffixes(unittest.TestCase):\n    def test_BinaryNamesWindows(self):\n        # These cannot run on non-Windows as they require a VS installation to\n        # correctly handle variable expansion.\n        if sys.platform.startswith(\"win\"):\n            writer = ninja.NinjaWriter(\n                \"foo\", \"wee\", \".\", \".\", \"build.ninja\", \".\", \"build.ninja\", \"win\"\n            )\n            spec = {\"target_name\": \"wee\"}\n            self.assertTrue(\n                writer.ComputeOutputFileName(spec, \"executable\").endswith(\".exe\")\n            )\n            self.assertTrue(\n                writer.ComputeOutputFileName(spec, \"shared_library\").endswith(\".dll\")\n            )\n            self.assertTrue(\n                writer.ComputeOutputFileName(spec, \"static_library\").endswith(\".lib\")\n            )\n\n    def test_BinaryNamesLinux(self):\n        writer = ninja.NinjaWriter(\n            \"foo\", \"wee\", \".\", \".\", \"build.ninja\", \".\", \"build.ninja\", \"linux\"\n        )\n        spec = {\"target_name\": \"wee\"}\n        self.assertTrue(\".\" not in writer.ComputeOutputFileName(spec, \"executable\"))\n        self.assertTrue(\n            writer.ComputeOutputFileName(spec, \"shared_library\").startswith(\"lib\")\n        )\n        self.assertTrue(\n            writer.ComputeOutputFileName(spec, \"static_library\").startswith(\"lib\")\n        )\n        self.assertTrue(\n            writer.ComputeOutputFileName(spec, \"shared_library\").endswith(\".so\")\n        )\n        self.assertTrue(\n            writer.ComputeOutputFileName(spec, \"static_library\").endswith(\".a\")\n        )\n\n    def test_GenerateCompileDBWithNinja(self):\n        build_dir = (\n            Path(__file__).resolve().parent.parent.parent.parent / \"data\" / \"ninja\"\n        )\n        compile_db = ninja.GenerateCompileDBWithNinja(build_dir)\n        assert len(compile_db) == 1\n        assert compile_db[0][\"directory\"] == str(build_dir)\n        assert compile_db[0][\"command\"] == \"cc my.in my.out\"\n        assert compile_db[0][\"file\"] == \"my.in\"\n        assert compile_db[0][\"output\"] == \"my.out\"\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/xcode.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\nimport errno\nimport filecmp\nimport os\nimport posixpath\nimport re\nimport shutil\nimport subprocess\nimport sys\nimport tempfile\n\nimport gyp.common\nimport gyp.xcode_ninja\nimport gyp.xcodeproj_file\n\n# Project files generated by this module will use _intermediate_var as a\n# custom Xcode setting whose value is a DerivedSources-like directory that's\n# project-specific and configuration-specific.  The normal choice,\n# DERIVED_FILE_DIR, is target-specific, which is thought to be too restrictive\n# as it is likely that multiple targets within a single project file will want\n# to access the same set of generated files.  The other option,\n# PROJECT_DERIVED_FILE_DIR, is unsuitable because while it is project-specific,\n# it is not configuration-specific.  INTERMEDIATE_DIR is defined as\n# $(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION).\n_intermediate_var = \"INTERMEDIATE_DIR\"\n\n# SHARED_INTERMEDIATE_DIR is the same, except that it is shared among all\n# targets that share the same BUILT_PRODUCTS_DIR.\n_shared_intermediate_var = \"SHARED_INTERMEDIATE_DIR\"\n\n_library_search_paths_var = \"LIBRARY_SEARCH_PATHS\"\n\ngenerator_default_variables = {\n    \"EXECUTABLE_PREFIX\": \"\",\n    \"EXECUTABLE_SUFFIX\": \"\",\n    \"STATIC_LIB_PREFIX\": \"lib\",\n    \"SHARED_LIB_PREFIX\": \"lib\",\n    \"STATIC_LIB_SUFFIX\": \".a\",\n    \"SHARED_LIB_SUFFIX\": \".dylib\",\n    # INTERMEDIATE_DIR is a place for targets to build up intermediate products.\n    # It is specific to each build environment.  It is only guaranteed to exist\n    # and be constant within the context of a project, corresponding to a single\n    # input file.  Some build environments may allow their intermediate directory\n    # to be shared on a wider scale, but this is not guaranteed.\n    \"INTERMEDIATE_DIR\": \"$(%s)\" % _intermediate_var,\n    \"OS\": \"mac\",\n    \"PRODUCT_DIR\": \"$(BUILT_PRODUCTS_DIR)\",\n    \"LIB_DIR\": \"$(BUILT_PRODUCTS_DIR)\",\n    \"RULE_INPUT_ROOT\": \"$(INPUT_FILE_BASE)\",\n    \"RULE_INPUT_EXT\": \"$(INPUT_FILE_SUFFIX)\",\n    \"RULE_INPUT_NAME\": \"$(INPUT_FILE_NAME)\",\n    \"RULE_INPUT_PATH\": \"$(INPUT_FILE_PATH)\",\n    \"RULE_INPUT_DIRNAME\": \"$(INPUT_FILE_DIRNAME)\",\n    \"SHARED_INTERMEDIATE_DIR\": \"$(%s)\" % _shared_intermediate_var,\n    \"CONFIGURATION_NAME\": \"$(CONFIGURATION)\",\n}\n\n# The Xcode-specific sections that hold paths.\ngenerator_additional_path_sections = [\n    \"mac_bundle_resources\",\n    \"mac_framework_headers\",\n    \"mac_framework_private_headers\",\n    # 'mac_framework_dirs', input already handles _dirs endings.\n]\n\n# The Xcode-specific keys that exist on targets and aren't moved down to\n# configurations.\ngenerator_additional_non_configuration_keys = [\n    \"ios_app_extension\",\n    \"ios_watch_app\",\n    \"ios_watchkit_extension\",\n    \"mac_bundle\",\n    \"mac_bundle_resources\",\n    \"mac_framework_headers\",\n    \"mac_framework_private_headers\",\n    \"mac_xctest_bundle\",\n    \"mac_xcuitest_bundle\",\n    \"xcode_create_dependents_test_runner\",\n]\n\n# We want to let any rules apply to files that are resources also.\ngenerator_extra_sources_for_rules = [\n    \"mac_bundle_resources\",\n    \"mac_framework_headers\",\n    \"mac_framework_private_headers\",\n]\n\ngenerator_filelist_paths = None\n\n# Xcode's standard set of library directories, which don't need to be duplicated\n# in LIBRARY_SEARCH_PATHS. This list is not exhaustive, but that's okay.\nxcode_standard_library_dirs = frozenset(\n    [\"$(SDKROOT)/usr/lib\", \"$(SDKROOT)/usr/local/lib\"]\n)\n\n\ndef CreateXCConfigurationList(configuration_names):\n    xccl = gyp.xcodeproj_file.XCConfigurationList({\"buildConfigurations\": []})\n    if len(configuration_names) == 0:\n        configuration_names = [\"Default\"]\n    for configuration_name in configuration_names:\n        xcbc = gyp.xcodeproj_file.XCBuildConfiguration({\"name\": configuration_name})\n        xccl.AppendProperty(\"buildConfigurations\", xcbc)\n    xccl.SetProperty(\"defaultConfigurationName\", configuration_names[0])\n    return xccl\n\n\nclass XcodeProject:\n    def __init__(self, gyp_path, path, build_file_dict):\n        self.gyp_path = gyp_path\n        self.path = path\n        self.project = gyp.xcodeproj_file.PBXProject(path=path)\n        projectDirPath = gyp.common.RelativePath(\n            os.path.dirname(os.path.abspath(self.gyp_path)),\n            os.path.dirname(path) or \".\",\n        )\n        self.project.SetProperty(\"projectDirPath\", projectDirPath)\n        self.project_file = gyp.xcodeproj_file.XCProjectFile(\n            {\"rootObject\": self.project}\n        )\n        self.build_file_dict = build_file_dict\n\n        # TODO(mark): add destructor that cleans up self.path if created_dir is\n        # True and things didn't complete successfully.  Or do something even\n        # better with \"try\"?\n        self.created_dir = False\n        try:\n            os.makedirs(self.path)\n            self.created_dir = True\n        except OSError as e:\n            if e.errno != errno.EEXIST:\n                raise\n\n    def Finalize1(self, xcode_targets, serialize_all_tests):\n        # Collect a list of all of the build configuration names used by the\n        # various targets in the file.  It is very heavily advised to keep each\n        # target in an entire project (even across multiple project files) using\n        # the same set of configuration names.\n        configurations = []\n        for xct in self.project.GetProperty(\"targets\"):\n            xccl = xct.GetProperty(\"buildConfigurationList\")\n            xcbcs = xccl.GetProperty(\"buildConfigurations\")\n            for xcbc in xcbcs:\n                name = xcbc.GetProperty(\"name\")\n                if name not in configurations:\n                    configurations.append(name)\n\n        # Replace the XCConfigurationList attached to the PBXProject object with\n        # a new one specifying all of the configuration names used by the various\n        # targets.\n        try:\n            xccl = CreateXCConfigurationList(configurations)\n            self.project.SetProperty(\"buildConfigurationList\", xccl)\n        except Exception:\n            sys.stderr.write(\"Problem with gyp file %s\\n\" % self.gyp_path)\n            raise\n\n        # The need for this setting is explained above where _intermediate_var is\n        # defined.  The comments below about wanting to avoid project-wide build\n        # settings apply here too, but this needs to be set on a project-wide basis\n        # so that files relative to the _intermediate_var setting can be displayed\n        # properly in the Xcode UI.\n        #\n        # Note that for configuration-relative files such as anything relative to\n        # _intermediate_var, for the purposes of UI tree view display, Xcode will\n        # only resolve the configuration name once, when the project file is\n        # opened.  If the active build configuration is changed, the project file\n        # must be closed and reopened if it is desired for the tree view to update.\n        # This is filed as Apple radar 6588391.\n        xccl.SetBuildSetting(\n            _intermediate_var, \"$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)\"\n        )\n        xccl.SetBuildSetting(\n            _shared_intermediate_var, \"$(SYMROOT)/DerivedSources/$(CONFIGURATION)\"\n        )\n\n        # Set user-specified project-wide build settings and config files.  This\n        # is intended to be used very sparingly.  Really, almost everything should\n        # go into target-specific build settings sections.  The project-wide\n        # settings are only intended to be used in cases where Xcode attempts to\n        # resolve variable references in a project context as opposed to a target\n        # context, such as when resolving sourceTree references while building up\n        # the tree tree view for UI display.\n        # Any values set globally are applied to all configurations, then any\n        # per-configuration values are applied.\n        for xck, xcv in self.build_file_dict.get(\"xcode_settings\", {}).items():\n            xccl.SetBuildSetting(xck, xcv)\n        if \"xcode_config_file\" in self.build_file_dict:\n            config_ref = self.project.AddOrGetFileInRootGroup(\n                self.build_file_dict[\"xcode_config_file\"]\n            )\n            xccl.SetBaseConfiguration(config_ref)\n        build_file_configurations = self.build_file_dict.get(\"configurations\", {})\n        if build_file_configurations:\n            for config_name in configurations:\n                build_file_configuration_named = build_file_configurations.get(\n                    config_name, {}\n                )\n                if build_file_configuration_named:\n                    xcc = xccl.ConfigurationNamed(config_name)\n                    for xck, xcv in build_file_configuration_named.get(\n                        \"xcode_settings\", {}\n                    ).items():\n                        xcc.SetBuildSetting(xck, xcv)\n                    if \"xcode_config_file\" in build_file_configuration_named:\n                        config_ref = self.project.AddOrGetFileInRootGroup(\n                            build_file_configurations[config_name][\"xcode_config_file\"]\n                        )\n                        xcc.SetBaseConfiguration(config_ref)\n\n        # Sort the targets based on how they appeared in the input.\n        # TODO(mark): Like a lot of other things here, this assumes internal\n        # knowledge of PBXProject - in this case, of its \"targets\" property.\n\n        # ordinary_targets are ordinary targets that are already in the project\n        # file. run_test_targets are the targets that run unittests and should be\n        # used for the Run All Tests target.  support_targets are the action/rule\n        # targets used by GYP file targets, just kept for the assert check.\n        ordinary_targets = []\n        run_test_targets = []\n        support_targets = []\n\n        # targets is full list of targets in the project.\n        targets = []\n\n        # does the it define it's own \"all\"?\n        has_custom_all = False\n\n        # targets_for_all is the list of ordinary_targets that should be listed\n        # in this project's \"All\" target.  It includes each non_runtest_target\n        # that does not have suppress_wildcard set.\n        targets_for_all = []\n\n        for target in self.build_file_dict[\"targets\"]:\n            target_name = target[\"target_name\"]\n            toolset = target[\"toolset\"]\n            qualified_target = gyp.common.QualifiedTarget(\n                self.gyp_path, target_name, toolset\n            )\n            xcode_target = xcode_targets[qualified_target]\n            # Make sure that the target being added to the sorted list is already in\n            # the unsorted list.\n            assert xcode_target in self.project._properties[\"targets\"]\n            targets.append(xcode_target)\n            ordinary_targets.append(xcode_target)\n            if xcode_target.support_target:\n                support_targets.append(xcode_target.support_target)\n                targets.append(xcode_target.support_target)\n\n            if not int(target.get(\"suppress_wildcard\", False)):\n                targets_for_all.append(xcode_target)\n\n            if target_name.lower() == \"all\":\n                has_custom_all = True\n\n            # If this target has a 'run_as' attribute, add its target to the\n            # targets, and add it to the test targets.\n            if target.get(\"run_as\"):\n                # Make a target to run something.  It should have one\n                # dependency, the parent xcode target.\n                xccl = CreateXCConfigurationList(configurations)\n                run_target = gyp.xcodeproj_file.PBXAggregateTarget(\n                    {\n                        \"name\": \"Run \" + target_name,\n                        \"productName\": xcode_target.GetProperty(\"productName\"),\n                        \"buildConfigurationList\": xccl,\n                    },\n                    parent=self.project,\n                )\n                run_target.AddDependency(xcode_target)\n\n                command = target[\"run_as\"]\n                script = \"\"\n                if command.get(\"working_directory\"):\n                    script = (\n                        script\n                        + 'cd \"%s\"\\n'\n                        % gyp.xcodeproj_file.ConvertVariablesToShellSyntax(\n                            command.get(\"working_directory\")\n                        )\n                    )\n\n                if command.get(\"environment\"):\n                    script = (\n                        script\n                        + \"\\n\".join(\n                            [\n                                'export %s=\"%s\"'\n                                % (\n                                    key,\n                                    gyp.xcodeproj_file.ConvertVariablesToShellSyntax(\n                                        val\n                                    ),\n                                )\n                                for (key, val) in command.get(\"environment\").items()\n                            ]\n                        )\n                        + \"\\n\"\n                    )\n\n                # Some test end up using sockets, files on disk, etc. and can get\n                # confused if more then one test runs at a time.  The generator\n                # flag 'xcode_serialize_all_test_runs' controls the forcing of all\n                # tests serially.  It defaults to True.  To get serial runs this\n                # little bit of python does the same as the linux flock utility to\n                # make sure only one runs at a time.\n                command_prefix = \"\"\n                if serialize_all_tests:\n                    command_prefix = \"\"\"python -c \"import fcntl, subprocess, sys\nfile = open('$TMPDIR/GYP_serialize_test_runs', 'a')\nfcntl.flock(file.fileno(), fcntl.LOCK_EX)\nsys.exit(subprocess.call(sys.argv[1:]))\" \"\"\"\n\n                # If we were unable to exec for some reason, we want to exit\n                # with an error, and fixup variable references to be shell\n                # syntax instead of xcode syntax.\n                script = (\n                    script\n                    + \"exec \"\n                    + command_prefix\n                    + \"%s\\nexit 1\\n\"\n                    % gyp.xcodeproj_file.ConvertVariablesToShellSyntax(\n                        gyp.common.EncodePOSIXShellList(command.get(\"action\"))\n                    )\n                )\n\n                ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase(\n                    {\"shellScript\": script, \"showEnvVarsInLog\": 0}\n                )\n                run_target.AppendProperty(\"buildPhases\", ssbp)\n\n                # Add the run target to the project file.\n                targets.append(run_target)\n                run_test_targets.append(run_target)\n                xcode_target.test_runner = run_target\n\n        # Make sure that the list of targets being replaced is the same length as\n        # the one replacing it, but allow for the added test runner targets.\n        assert len(self.project._properties[\"targets\"]) == len(ordinary_targets) + len(\n            support_targets\n        )\n\n        self.project._properties[\"targets\"] = targets\n\n        # Get rid of unnecessary levels of depth in groups like the Source group.\n        self.project.RootGroupsTakeOverOnlyChildren(True)\n\n        # Sort the groups nicely.  Do this after sorting the targets, because the\n        # Products group is sorted based on the order of the targets.\n        self.project.SortGroups()\n\n        # Create an \"All\" target if there's more than one target in this project\n        # file and the project didn't define its own \"All\" target.  Put a generated\n        # \"All\" target first so that people opening up the project for the first\n        # time will build everything by default.\n        if len(targets_for_all) > 1 and not has_custom_all:\n            xccl = CreateXCConfigurationList(configurations)\n            all_target = gyp.xcodeproj_file.PBXAggregateTarget(\n                {\"buildConfigurationList\": xccl, \"name\": \"All\"}, parent=self.project\n            )\n\n            for target in targets_for_all:\n                all_target.AddDependency(target)\n\n            # TODO(mark): This is evil because it relies on internal knowledge of\n            # PBXProject._properties.  It's important to get the \"All\" target first,\n            # though.\n            self.project._properties[\"targets\"].insert(0, all_target)\n\n        # The same, but for run_test_targets.\n        if len(run_test_targets) > 1:\n            xccl = CreateXCConfigurationList(configurations)\n            run_all_tests_target = gyp.xcodeproj_file.PBXAggregateTarget(\n                {\"buildConfigurationList\": xccl, \"name\": \"Run All Tests\"},\n                parent=self.project,\n            )\n            for run_test_target in run_test_targets:\n                run_all_tests_target.AddDependency(run_test_target)\n\n            # Insert after the \"All\" target, which must exist if there is more than\n            # one run_test_target.\n            self.project._properties[\"targets\"].insert(1, run_all_tests_target)\n\n    def Finalize2(self, xcode_targets, xcode_target_to_target_dict):\n        # Finalize2 needs to happen in a separate step because the process of\n        # updating references to other projects depends on the ordering of targets\n        # within remote project files.  Finalize1 is responsible for sorting duty,\n        # and once all project files are sorted, Finalize2 can come in and update\n        # these references.\n\n        # To support making a \"test runner\" target that will run all the tests\n        # that are direct dependents of any given target, we look for\n        # xcode_create_dependents_test_runner being set on an Aggregate target,\n        # and generate a second target that will run the tests runners found under\n        # the marked target.\n        for bf_tgt in self.build_file_dict[\"targets\"]:\n            if int(bf_tgt.get(\"xcode_create_dependents_test_runner\", 0)):\n                tgt_name = bf_tgt[\"target_name\"]\n                toolset = bf_tgt[\"toolset\"]\n                qualified_target = gyp.common.QualifiedTarget(\n                    self.gyp_path, tgt_name, toolset\n                )\n                xcode_target = xcode_targets[qualified_target]\n                if isinstance(xcode_target, gyp.xcodeproj_file.PBXAggregateTarget):\n                    # Collect all the run test targets.\n                    all_run_tests = []\n                    pbxtds = xcode_target.GetProperty(\"dependencies\")\n                    for pbxtd in pbxtds:\n                        pbxcip = pbxtd.GetProperty(\"targetProxy\")\n                        dependency_xct = pbxcip.GetProperty(\"remoteGlobalIDString\")\n                        if hasattr(dependency_xct, \"test_runner\"):\n                            all_run_tests.append(dependency_xct.test_runner)\n\n                    # Directly depend on all the runners as they depend on the target\n                    # that builds them.\n                    if len(all_run_tests) > 0:\n                        run_all_target = gyp.xcodeproj_file.PBXAggregateTarget(\n                            {\n                                \"name\": \"Run %s Tests\" % tgt_name,\n                                \"productName\": tgt_name,\n                            },\n                            parent=self.project,\n                        )\n                        for run_test_target in all_run_tests:\n                            run_all_target.AddDependency(run_test_target)\n\n                        # Insert the test runner after the related target.\n                        idx = self.project._properties[\"targets\"].index(xcode_target)\n                        self.project._properties[\"targets\"].insert(\n                            idx + 1, run_all_target\n                        )\n\n        # Update all references to other projects, to make sure that the lists of\n        # remote products are complete.  Otherwise, Xcode will fill them in when\n        # it opens the project file, which will result in unnecessary diffs.\n        # TODO(mark): This is evil because it relies on internal knowledge of\n        # PBXProject._other_pbxprojects.\n        for other_pbxproject in self.project._other_pbxprojects:\n            self.project.AddOrGetProjectReference(other_pbxproject)\n\n        self.project.SortRemoteProductReferences()\n\n        # Give everything an ID.\n        self.project_file.ComputeIDs()\n\n        # Make sure that no two objects in the project file have the same ID.  If\n        # multiple objects wind up with the same ID, upon loading the file, Xcode\n        # will only recognize one object (the last one in the file?) and the\n        # results are unpredictable.\n        self.project_file.EnsureNoIDCollisions()\n\n    def Write(self):\n        # Write the project file to a temporary location first.  Xcode watches for\n        # changes to the project file and presents a UI sheet offering to reload\n        # the project when it does change.  However, in some cases, especially when\n        # multiple projects are open or when Xcode is busy, things don't work so\n        # seamlessly.  Sometimes, Xcode is able to detect that a project file has\n        # changed but can't unload it because something else is referencing it.\n        # To mitigate this problem, and to avoid even having Xcode present the UI\n        # sheet when an open project is rewritten for inconsequential changes, the\n        # project file is written to a temporary file in the xcodeproj directory\n        # first.  The new temporary file is then compared to the existing project\n        # file, if any.  If they differ, the new file replaces the old; otherwise,\n        # the new project file is simply deleted.  Xcode properly detects a file\n        # being renamed over an open project file as a change and so it remains\n        # able to present the \"project file changed\" sheet under this system.\n        # Writing to a temporary file first also avoids the possible problem of\n        # Xcode rereading an incomplete project file.\n        (output_fd, new_pbxproj_path) = tempfile.mkstemp(\n            suffix=\".tmp\", prefix=\"project.pbxproj.gyp.\", dir=self.path\n        )\n\n        try:\n            output_file = os.fdopen(output_fd, \"w\")\n\n            self.project_file.Print(output_file)\n            output_file.close()\n\n            pbxproj_path = os.path.join(self.path, \"project.pbxproj\")\n\n            same = False\n            try:\n                same = filecmp.cmp(pbxproj_path, new_pbxproj_path, False)\n            except OSError as e:\n                if e.errno != errno.ENOENT:\n                    raise\n\n            if same:\n                # The new file is identical to the old one, just get rid of the new\n                # one.\n                os.unlink(new_pbxproj_path)\n            else:\n                # The new file is different from the old one, or there is no old one.\n                # Rename the new file to the permanent name.\n                #\n                # tempfile.mkstemp uses an overly restrictive mode, resulting in a\n                # file that can only be read by the owner, regardless of the umask.\n                # There's no reason to not respect the umask here, which means that\n                # an extra hoop is required to fetch it and reset the new file's mode.\n                #\n                # No way to get the umask without setting a new one?  Set a safe one\n                # and then set it back to the old value.\n                umask = os.umask(0o77)\n                os.umask(umask)\n\n                os.chmod(new_pbxproj_path, 0o666 & ~umask)\n                os.rename(new_pbxproj_path, pbxproj_path)\n\n        except Exception:\n            # Don't leave turds behind.  In fact, if this code was responsible for\n            # creating the xcodeproj directory, get rid of that too.\n            os.unlink(new_pbxproj_path)\n            if self.created_dir:\n                shutil.rmtree(self.path, True)\n            raise\n\n\ndef AddSourceToTarget(source, type, pbxp, xct):\n    # TODO(mark): Perhaps source_extensions and library_extensions can be made a\n    # little bit fancier.\n    source_extensions = [\"c\", \"cc\", \"cpp\", \"cxx\", \"m\", \"mm\", \"s\", \"swift\"]\n\n    # .o is conceptually more of a \"source\" than a \"library,\" but Xcode thinks\n    # of \"sources\" as things to compile and \"libraries\" (or \"frameworks\") as\n    # things to link with. Adding an object file to an Xcode target's frameworks\n    # phase works properly.\n    library_extensions = [\"a\", \"dylib\", \"framework\", \"o\"]\n\n    basename = posixpath.basename(source)\n    (_root, ext) = posixpath.splitext(basename)\n    if ext:\n        ext = ext[1:].lower()\n\n    if ext in source_extensions and type != \"none\":\n        xct.SourcesPhase().AddFile(source)\n    elif ext in library_extensions and type != \"none\":\n        xct.FrameworksPhase().AddFile(source)\n    else:\n        # Files that aren't added to a sources or frameworks build phase can still\n        # go into the project file, just not as part of a build phase.\n        pbxp.AddOrGetFileInRootGroup(source)\n\n\ndef AddResourceToTarget(resource, pbxp, xct):\n    # TODO(mark): Combine with AddSourceToTarget above?  Or just inline this call\n    # where it's used.\n    xct.ResourcesPhase().AddFile(resource)\n\n\ndef AddHeaderToTarget(header, pbxp, xct, is_public):\n    # TODO(mark): Combine with AddSourceToTarget above?  Or just inline this call\n    # where it's used.\n    settings = \"{ATTRIBUTES = (%s, ); }\" % (\"Private\", \"Public\")[is_public]\n    xct.HeadersPhase().AddFile(header, settings)\n\n\n_xcode_variable_re = re.compile(r\"(\\$\\((.*?)\\))\")\n\n\ndef ExpandXcodeVariables(string, expansions):\n    \"\"\"Expands Xcode-style $(VARIABLES) in string per the expansions dict.\n\n    In some rare cases, it is appropriate to expand Xcode variables when a\n    project file is generated.  For any substring $(VAR) in string, if VAR is a\n    key in the expansions dict, $(VAR) will be replaced with expansions[VAR].\n    Any $(VAR) substring in string for which VAR is not a key in the expansions\n    dict will remain in the returned string.\n    \"\"\"\n\n    matches = _xcode_variable_re.findall(string)\n    if matches is None:\n        return string\n\n    matches.reverse()\n    for match in matches:\n        (to_replace, variable) = match\n        if variable not in expansions:\n            continue\n\n        replacement = expansions[variable]\n        string = re.sub(re.escape(to_replace), replacement, string)\n\n    return string\n\n\n_xcode_define_re = re.compile(r\"([\\\\\\\"\\' ])\")\n\n\ndef EscapeXcodeDefine(s):\n    \"\"\"We must escape the defines that we give to XCode so that it knows not to\n    split on spaces and to respect backslash and quote literals. However, we\n    must not quote the define, or Xcode will incorrectly interpret variables\n    especially $(inherited).\"\"\"\n    return re.sub(_xcode_define_re, r\"\\\\\\1\", s)\n\n\ndef PerformBuild(data, configurations, params):\n    options = params[\"options\"]\n\n    for build_file, build_file_dict in data.items():\n        (build_file_root, build_file_ext) = os.path.splitext(build_file)\n        if build_file_ext != \".gyp\":\n            continue\n        xcodeproj_path = build_file_root + options.suffix + \".xcodeproj\"\n        if options.generator_output:\n            xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path)\n\n    for config in configurations:\n        arguments = [\"xcodebuild\", \"-project\", xcodeproj_path]\n        arguments += [\"-configuration\", config]\n        print(f\"Building [{config}]: {arguments}\")\n        subprocess.check_call(arguments)\n\n\ndef CalculateGeneratorInputInfo(params):\n    toplevel = params[\"options\"].toplevel_dir\n    if params.get(\"flavor\") == \"ninja\":\n        generator_dir = os.path.relpath(params[\"options\"].generator_output or \".\")\n        output_dir = params.get(\"generator_flags\", {}).get(\"output_dir\", \"out\")\n        output_dir = os.path.normpath(os.path.join(generator_dir, output_dir))\n        qualified_out_dir = os.path.normpath(\n            os.path.join(toplevel, output_dir, \"gypfiles-xcode-ninja\")\n        )\n    else:\n        output_dir = os.path.normpath(os.path.join(toplevel, \"xcodebuild\"))\n        qualified_out_dir = os.path.normpath(\n            os.path.join(toplevel, output_dir, \"gypfiles\")\n        )\n\n    global generator_filelist_paths\n    generator_filelist_paths = {\n        \"toplevel\": toplevel,\n        \"qualified_out_dir\": qualified_out_dir,\n    }\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    # Optionally configure each spec to use ninja as the external builder.\n    ninja_wrapper = params.get(\"flavor\") == \"ninja\"\n    if ninja_wrapper:\n        (target_list, target_dicts, data) = gyp.xcode_ninja.CreateWrapper(\n            target_list, target_dicts, data, params\n        )\n\n    options = params[\"options\"]\n    generator_flags = params.get(\"generator_flags\", {})\n    parallel_builds = generator_flags.get(\"xcode_parallel_builds\", True)\n    serialize_all_tests = generator_flags.get(\"xcode_serialize_all_test_runs\", True)\n    upgrade_check_project_version = generator_flags.get(\n        \"xcode_upgrade_check_project_version\", None\n    )\n\n    # Format upgrade_check_project_version with leading zeros as needed.\n    if upgrade_check_project_version:\n        upgrade_check_project_version = str(upgrade_check_project_version)\n        while len(upgrade_check_project_version) < 4:\n            upgrade_check_project_version = \"0\" + upgrade_check_project_version\n\n    skip_excluded_files = not generator_flags.get(\"xcode_list_excluded_files\", True)\n    xcode_projects = {}\n    for build_file, build_file_dict in data.items():\n        (build_file_root, build_file_ext) = os.path.splitext(build_file)\n        if build_file_ext != \".gyp\":\n            continue\n        xcodeproj_path = build_file_root + options.suffix + \".xcodeproj\"\n        if options.generator_output:\n            xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path)\n        xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict)\n        xcode_projects[build_file] = xcp\n        pbxp = xcp.project\n\n        # Set project-level attributes from multiple options\n        project_attributes = {}\n        if parallel_builds:\n            project_attributes[\"BuildIndependentTargetsInParallel\"] = \"YES\"\n        if upgrade_check_project_version:\n            project_attributes[\"LastUpgradeCheck\"] = upgrade_check_project_version\n            project_attributes[\"LastTestingUpgradeCheck\"] = (\n                upgrade_check_project_version\n            )\n            project_attributes[\"LastSwiftUpdateCheck\"] = upgrade_check_project_version\n        pbxp.SetProperty(\"attributes\", project_attributes)\n\n        # Add gyp/gypi files to project\n        if not generator_flags.get(\"standalone\"):\n            main_group = pbxp.GetProperty(\"mainGroup\")\n            build_group = gyp.xcodeproj_file.PBXGroup({\"name\": \"Build\"})\n            main_group.AppendChild(build_group)\n            for included_file in build_file_dict[\"included_files\"]:\n                build_group.AddOrGetFileByPath(included_file, False)\n\n    xcode_targets = {}\n    xcode_target_to_target_dict = {}\n    for qualified_target in target_list:\n        [build_file, target_name, _toolset] = gyp.common.ParseQualifiedTarget(\n            qualified_target\n        )\n\n        spec = target_dicts[qualified_target]\n        if spec[\"toolset\"] != \"target\":\n            raise Exception(\n                \"Multiple toolsets not supported in xcode build (target %s)\"\n                % qualified_target\n            )\n        configuration_names = [spec[\"default_configuration\"]]\n        for configuration_name in sorted(spec[\"configurations\"].keys()):\n            if configuration_name not in configuration_names:\n                configuration_names.append(configuration_name)\n        xcp = xcode_projects[build_file]\n        pbxp = xcp.project\n\n        # Set up the configurations for the target according to the list of names\n        # supplied.\n        xccl = CreateXCConfigurationList(configuration_names)\n\n        # Create an XCTarget subclass object for the target. The type with\n        # \"+bundle\" appended will be used if the target has \"mac_bundle\" set.\n        # loadable_modules not in a mac_bundle are mapped to\n        # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets\n        # to create a single-file mh_bundle.\n        _types = {\n            \"executable\": \"com.apple.product-type.tool\",\n            \"loadable_module\": \"com.googlecode.gyp.xcode.bundle\",\n            \"shared_library\": \"com.apple.product-type.library.dynamic\",\n            \"static_library\": \"com.apple.product-type.library.static\",\n            \"mac_kernel_extension\": \"com.apple.product-type.kernel-extension\",\n            \"executable+bundle\": \"com.apple.product-type.application\",\n            \"loadable_module+bundle\": \"com.apple.product-type.bundle\",\n            \"loadable_module+xctest\": \"com.apple.product-type.bundle.unit-test\",\n            \"loadable_module+xcuitest\": \"com.apple.product-type.bundle.ui-testing\",\n            \"shared_library+bundle\": \"com.apple.product-type.framework\",\n            \"executable+extension+bundle\": \"com.apple.product-type.app-extension\",\n            \"executable+watch+extension+bundle\": \"com.apple.product-type.watchkit-extension\",  # noqa: E501\n            \"executable+watch+bundle\": \"com.apple.product-type.application.watchapp\",\n            \"mac_kernel_extension+bundle\": \"com.apple.product-type.kernel-extension\",\n        }\n\n        target_properties = {\n            \"buildConfigurationList\": xccl,\n            \"name\": target_name,\n        }\n\n        type = spec[\"type\"]\n        is_xctest = int(spec.get(\"mac_xctest_bundle\", 0))\n        is_xcuitest = int(spec.get(\"mac_xcuitest_bundle\", 0))\n        is_bundle = int(spec.get(\"mac_bundle\", 0)) or is_xctest\n        is_app_extension = int(spec.get(\"ios_app_extension\", 0))\n        is_watchkit_extension = int(spec.get(\"ios_watchkit_extension\", 0))\n        is_watch_app = int(spec.get(\"ios_watch_app\", 0))\n        if type != \"none\":\n            type_bundle_key = type\n            if is_xcuitest:\n                type_bundle_key += \"+xcuitest\"\n                assert type == \"loadable_module\", (\n                    \"mac_xcuitest_bundle targets must have type loadable_module \"\n                    \"(target %s)\" % target_name\n                )\n            elif is_xctest:\n                type_bundle_key += \"+xctest\"\n                assert type == \"loadable_module\", (\n                    \"mac_xctest_bundle targets must have type loadable_module \"\n                    \"(target %s)\" % target_name\n                )\n            elif is_app_extension:\n                assert is_bundle, (\n                    \"ios_app_extension flag requires mac_bundle \"\n                    \"(target %s)\" % target_name\n                )\n                type_bundle_key += \"+extension+bundle\"\n            elif is_watchkit_extension:\n                assert is_bundle, (\n                    \"ios_watchkit_extension flag requires mac_bundle \"\n                    \"(target %s)\" % target_name\n                )\n                type_bundle_key += \"+watch+extension+bundle\"\n            elif is_watch_app:\n                assert is_bundle, (\n                    \"ios_watch_app flag requires mac_bundle (target %s)\" % target_name\n                )\n                type_bundle_key += \"+watch+bundle\"\n            elif is_bundle:\n                type_bundle_key += \"+bundle\"\n\n            xctarget_type = gyp.xcodeproj_file.PBXNativeTarget\n            try:\n                target_properties[\"productType\"] = _types[type_bundle_key]\n            except KeyError as e:\n                gyp.common.ExceptionAppend(\n                    e,\n                    \"-- unknown product type while writing target %s\" % target_name,\n                )\n                raise\n        else:\n            xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget\n            assert not is_bundle, (\n                'mac_bundle targets cannot have type none (target \"%s\")' % target_name\n            )\n            assert not is_xcuitest, (\n                'mac_xcuitest_bundle targets cannot have type none (target \"%s\")'\n                % target_name\n            )\n            assert not is_xctest, (\n                'mac_xctest_bundle targets cannot have type none (target \"%s\")'\n                % target_name\n            )\n\n        target_product_name = spec.get(\"product_name\")\n        if target_product_name is not None:\n            target_properties[\"productName\"] = target_product_name\n\n        xct = xctarget_type(\n            target_properties,\n            parent=pbxp,\n            force_outdir=spec.get(\"product_dir\"),\n            force_prefix=spec.get(\"product_prefix\"),\n            force_extension=spec.get(\"product_extension\"),\n        )\n        pbxp.AppendProperty(\"targets\", xct)\n        xcode_targets[qualified_target] = xct\n        xcode_target_to_target_dict[xct] = spec\n\n        spec_actions = spec.get(\"actions\", [])\n        spec_rules = spec.get(\"rules\", [])\n\n        # Xcode has some \"issues\" with checking dependencies for the \"Compile\n        # sources\" step with any source files/headers generated by actions/rules.\n        # To work around this, if a target is building anything directly (not\n        # type \"none\"), then a second target is used to run the GYP actions/rules\n        # and is made a dependency of this target.  This way the work is done\n        # before the dependency checks for what should be recompiled.\n        support_xct = None\n        # The Xcode \"issues\" don't affect xcode-ninja builds, since the dependency\n        # logic all happens in ninja.  Don't bother creating the extra targets in\n        # that case.\n        if type != \"none\" and (spec_actions or spec_rules) and not ninja_wrapper:\n            support_xccl = CreateXCConfigurationList(configuration_names)\n            support_target_suffix = generator_flags.get(\n                \"support_target_suffix\", \" Support\"\n            )\n            support_target_properties = {\n                \"buildConfigurationList\": support_xccl,\n                \"name\": target_name + support_target_suffix,\n            }\n            if target_product_name:\n                support_target_properties[\"productName\"] = (\n                    target_product_name + \" Support\"\n                )\n            support_xct = gyp.xcodeproj_file.PBXAggregateTarget(\n                support_target_properties, parent=pbxp\n            )\n            pbxp.AppendProperty(\"targets\", support_xct)\n            xct.AddDependency(support_xct)\n        # Hang the support target off the main target so it can be tested/found\n        # by the generator during Finalize.\n        xct.support_target = support_xct\n\n        prebuild_index = 0\n\n        # Add custom shell script phases for \"actions\" sections.\n        for action in spec_actions:\n            # There's no need to write anything into the script to ensure that the\n            # output directories already exist, because Xcode will look at the\n            # declared outputs and automatically ensure that they exist for us.\n\n            # Do we have a message to print when this action runs?\n            message = action.get(\"message\")\n            if message:\n                message = \"echo note: \" + gyp.common.EncodePOSIXShellArgument(message)\n            else:\n                message = \"\"\n\n            # Turn the list into a string that can be passed to a shell.\n            action_string = gyp.common.EncodePOSIXShellList(action[\"action\"])\n\n            # Convert Xcode-type variable references to sh-compatible environment\n            # variable references.\n            message_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax(message)\n            action_string_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax(\n                action_string\n            )\n\n            script = \"\"\n            # Include the optional message\n            if message_sh:\n                script += message_sh + \"\\n\"\n            # Be sure the script runs in exec, and that if exec fails, the script\n            # exits signalling an error.\n            script += \"exec \" + action_string_sh + \"\\nexit 1\\n\"\n            ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase(\n                {\n                    \"inputPaths\": action[\"inputs\"],\n                    \"name\": 'Action \"' + action[\"action_name\"] + '\"',\n                    \"outputPaths\": action[\"outputs\"],\n                    \"shellScript\": script,\n                    \"showEnvVarsInLog\": 0,\n                }\n            )\n\n            if support_xct:\n                support_xct.AppendProperty(\"buildPhases\", ssbp)\n            else:\n                # TODO(mark): this assumes too much knowledge of the internals of\n                # xcodeproj_file; some of these smarts should move into xcodeproj_file\n                # itself.\n                xct._properties[\"buildPhases\"].insert(prebuild_index, ssbp)\n                prebuild_index = prebuild_index + 1\n\n            # TODO(mark): Should verify that at most one of these is specified.\n            if int(action.get(\"process_outputs_as_sources\", False)):\n                for output in action[\"outputs\"]:\n                    AddSourceToTarget(output, type, pbxp, xct)\n\n            if int(action.get(\"process_outputs_as_mac_bundle_resources\", False)):\n                for output in action[\"outputs\"]:\n                    AddResourceToTarget(output, pbxp, xct)\n\n        # tgt_mac_bundle_resources holds the list of bundle resources so\n        # the rule processing can check against it.\n        if is_bundle:\n            tgt_mac_bundle_resources = spec.get(\"mac_bundle_resources\", [])\n        else:\n            tgt_mac_bundle_resources = []\n\n        # Add custom shell script phases driving \"make\" for \"rules\" sections.\n        #\n        # Xcode's built-in rule support is almost powerful enough to use directly,\n        # but there are a few significant deficiencies that render them unusable.\n        # There are workarounds for some of its inadequacies, but in aggregate,\n        # the workarounds added complexity to the generator, and some workarounds\n        # actually require input files to be crafted more carefully than I'd like.\n        # Consequently, until Xcode rules are made more capable, \"rules\" input\n        # sections will be handled in Xcode output by shell script build phases\n        # performed prior to the compilation phase.\n        #\n        # The following problems with Xcode rules were found.  The numbers are\n        # Apple radar IDs.  I hope that these shortcomings are addressed, I really\n        # liked having the rules handled directly in Xcode during the period that\n        # I was prototyping this.\n        #\n        # 6588600 Xcode compiles custom script rule outputs too soon, compilation\n        #         fails.  This occurs when rule outputs from distinct inputs are\n        #         interdependent.  The only workaround is to put rules and their\n        #         inputs in a separate target from the one that compiles the rule\n        #         outputs.  This requires input file cooperation and it means that\n        #         process_outputs_as_sources is unusable.\n        # 6584932 Need to declare that custom rule outputs should be excluded from\n        #         compilation.  A possible workaround is to lie to Xcode about a\n        #         rule's output, giving it a dummy file it doesn't know how to\n        #         compile.  The rule action script would need to touch the dummy.\n        # 6584839 I need a way to declare additional inputs to a custom rule.\n        #         A possible workaround is a shell script phase prior to\n        #         compilation that touches a rule's primary input files if any\n        #         would-be additional inputs are newer than the output.  Modifying\n        #         the source tree - even just modification times - feels dirty.\n        # 6564240 Xcode \"custom script\" build rules always dump all environment\n        #         variables.  This is a low-priority problem and is not a\n        #         show-stopper.\n        rules_by_ext = {}\n        for rule in spec_rules:\n            rules_by_ext[rule[\"extension\"]] = rule\n\n            # First, some definitions:\n            #\n            # A \"rule source\" is a file that was listed in a target's \"sources\"\n            # list and will have a rule applied to it on the basis of matching the\n            # rule's \"extensions\" attribute.  Rule sources are direct inputs to\n            # rules.\n            #\n            # Rule definitions may specify additional inputs in their \"inputs\"\n            # attribute.  These additional inputs are used for dependency tracking\n            # purposes.\n            #\n            # A \"concrete output\" is a rule output with input-dependent variables\n            # resolved.  For example, given a rule with:\n            #   'extension': 'ext', 'outputs': ['$(INPUT_FILE_BASE).cc'],\n            # if the target's \"sources\" list contained \"one.ext\" and \"two.ext\",\n            # the \"concrete output\" for rule input \"two.ext\" would be \"two.cc\".  If\n            # a rule specifies multiple outputs, each input file that the rule is\n            # applied to will have the same number of concrete outputs.\n            #\n            # If any concrete outputs are outdated or missing relative to their\n            # corresponding rule_source or to any specified additional input, the\n            # rule action must be performed to generate the concrete outputs.\n\n            # concrete_outputs_by_rule_source will have an item at the same index\n            # as the rule['rule_sources'] that it corresponds to.  Each item is a\n            # list of all of the concrete outputs for the rule_source.\n            concrete_outputs_by_rule_source = []\n\n            # concrete_outputs_all is a flat list of all concrete outputs that this\n            # rule is able to produce, given the known set of input files\n            # (rule_sources) that apply to it.\n            concrete_outputs_all = []\n\n            # messages & actions are keyed by the same indices as rule['rule_sources']\n            # and concrete_outputs_by_rule_source.  They contain the message and\n            # action to perform after resolving input-dependent variables.  The\n            # message is optional, in which case None is stored for each rule source.\n            messages = []\n            actions = []\n\n            for rule_source in rule.get(\"rule_sources\", []):\n                rule_source_dirname, rule_source_basename = posixpath.split(rule_source)\n                (rule_source_root, rule_source_ext) = posixpath.splitext(\n                    rule_source_basename\n                )\n\n                # These are the same variable names that Xcode uses for its own native\n                # rule support.  Because Xcode's rule engine is not being used, they\n                # need to be expanded as they are written to the makefile.\n                rule_input_dict = {\n                    \"INPUT_FILE_BASE\": rule_source_root,\n                    \"INPUT_FILE_SUFFIX\": rule_source_ext,\n                    \"INPUT_FILE_NAME\": rule_source_basename,\n                    \"INPUT_FILE_PATH\": rule_source,\n                    \"INPUT_FILE_DIRNAME\": rule_source_dirname,\n                }\n\n                concrete_outputs_for_this_rule_source = []\n                for output in rule.get(\"outputs\", []):\n                    # Fortunately, Xcode and make both use $(VAR) format for their\n                    # variables, so the expansion is the only transformation necessary.\n                    # Any remaining $(VAR)-type variables in the string can be given\n                    # directly to make, which will pick up the correct settings from\n                    # what Xcode puts into the environment.\n                    concrete_output = ExpandXcodeVariables(output, rule_input_dict)\n                    concrete_outputs_for_this_rule_source.append(concrete_output)\n\n                    # Add all concrete outputs to the project.\n                    pbxp.AddOrGetFileInRootGroup(concrete_output)\n\n                concrete_outputs_by_rule_source.append(\n                    concrete_outputs_for_this_rule_source\n                )\n                concrete_outputs_all.extend(concrete_outputs_for_this_rule_source)\n\n                # TODO(mark): Should verify that at most one of these is specified.\n                if int(rule.get(\"process_outputs_as_sources\", False)):\n                    for output in concrete_outputs_for_this_rule_source:\n                        AddSourceToTarget(output, type, pbxp, xct)\n\n                # If the file came from the mac_bundle_resources list or if the rule\n                # is marked to process outputs as bundle resource, do so.\n                was_mac_bundle_resource = rule_source in tgt_mac_bundle_resources\n                if was_mac_bundle_resource or int(\n                    rule.get(\"process_outputs_as_mac_bundle_resources\", False)\n                ):\n                    for output in concrete_outputs_for_this_rule_source:\n                        AddResourceToTarget(output, pbxp, xct)\n\n                # Do we have a message to print when this rule runs?\n                message = rule.get(\"message\")\n                if message:\n                    message = gyp.common.EncodePOSIXShellArgument(message)\n                    message = ExpandXcodeVariables(message, rule_input_dict)\n                messages.append(message)\n\n                # Turn the list into a string that can be passed to a shell.\n                action_string = gyp.common.EncodePOSIXShellList(rule[\"action\"])\n\n                action = ExpandXcodeVariables(action_string, rule_input_dict)\n                actions.append(action)\n\n            if len(concrete_outputs_all) > 0:\n                # TODO(mark): There's a possibility for collision here.  Consider\n                # target \"t\" rule \"A_r\" and target \"t_A\" rule \"r\".\n                makefile_name = \"%s.make\" % re.sub(\n                    \"[^a-zA-Z0-9_]\", \"_\", \"{}_{}\".format(target_name, rule[\"rule_name\"])\n                )\n                makefile_path = os.path.join(\n                    xcode_projects[build_file].path, makefile_name\n                )\n                # TODO(mark): try/close?  Write to a temporary file and swap it only\n                # if it's got changes?\n                makefile = open(makefile_path, \"w\")\n\n                # make will build the first target in the makefile by default.  By\n                # convention, it's called \"all\".  List all (or at least one)\n                # concrete output for each rule source as a prerequisite of the \"all\"\n                # target.\n                makefile.write(\"all: \\\\\\n\")\n                for concrete_output_index, concrete_output_by_rule_source in enumerate(\n                    concrete_outputs_by_rule_source\n                ):\n                    # Only list the first (index [0]) concrete output of each input\n                    # in the \"all\" target.  Otherwise, a parallel make (-j > 1) would\n                    # attempt to process each input multiple times simultaneously.\n                    # Otherwise, \"all\" could just contain the entire list of\n                    # concrete_outputs_all.\n                    concrete_output = concrete_output_by_rule_source[0]\n                    if (\n                        concrete_output_index\n                        == len(concrete_outputs_by_rule_source) - 1\n                    ):\n                        eol = \"\"\n                    else:\n                        eol = \" \\\\\"\n                    makefile.write(f\"    {concrete_output}{eol}\\n\")\n\n                for rule_source, concrete_outputs, message, action in zip(\n                    rule[\"rule_sources\"],\n                    concrete_outputs_by_rule_source,\n                    messages,\n                    actions,\n                ):\n                    makefile.write(\"\\n\")\n\n                    # Add a rule that declares it can build each concrete output of a\n                    # rule source.  Collect the names of the directories that are\n                    # required.\n                    concrete_output_dirs = []\n                    for concrete_output_index, concrete_output in enumerate(\n                        concrete_outputs\n                    ):\n                        bol = \"\" if concrete_output_index == 0 else \"    \"\n                        makefile.write(f\"{bol}{concrete_output} \\\\\\n\")\n\n                        concrete_output_dir = posixpath.dirname(concrete_output)\n                        if (\n                            concrete_output_dir\n                            and concrete_output_dir not in concrete_output_dirs\n                        ):\n                            concrete_output_dirs.append(concrete_output_dir)\n\n                    makefile.write(\"    : \\\\\\n\")\n\n                    # The prerequisites for this rule are the rule source itself and\n                    # the set of additional rule inputs, if any.\n                    prerequisites = [rule_source]\n                    prerequisites.extend(rule.get(\"inputs\", []))\n                    for prerequisite_index, prerequisite in enumerate(prerequisites):\n                        if prerequisite_index == len(prerequisites) - 1:\n                            eol = \"\"\n                        else:\n                            eol = \" \\\\\"\n                        makefile.write(f\"    {prerequisite}{eol}\\n\")\n\n                    # Make sure that output directories exist before executing the rule\n                    # action.\n                    if len(concrete_output_dirs) > 0:\n                        makefile.write(\n                            '\\t@mkdir -p \"%s\"\\n' % '\" \"'.join(concrete_output_dirs)\n                        )\n\n                    # The rule message and action have already had\n                    # the necessary variable substitutions performed.\n                    if message:\n                        # Mark it with note: so Xcode picks it up in build output.\n                        makefile.write(\"\\t@echo note: %s\\n\" % message)\n                    makefile.write(\"\\t%s\\n\" % action)\n\n                makefile.close()\n\n                # It might be nice to ensure that needed output directories exist\n                # here rather than in each target in the Makefile, but that wouldn't\n                # work if there ever was a concrete output that had an input-dependent\n                # variable anywhere other than in the leaf position.\n\n                # Don't declare any inputPaths or outputPaths.  If they're present,\n                # Xcode will provide a slight optimization by only running the script\n                # phase if any output is missing or outdated relative to any input.\n                # Unfortunately, it will also assume that all outputs are touched by\n                # the script, and if the outputs serve as files in a compilation\n                # phase, they will be unconditionally rebuilt.  Since make might not\n                # rebuild everything that could be declared here as an output, this\n                # extra compilation activity is unnecessary.  With inputPaths and\n                # outputPaths not supplied, make will always be called, but it knows\n                # enough to not do anything when everything is up-to-date.\n\n                # To help speed things up, pass -j COUNT to make so it does some work\n                # in parallel.  Don't use ncpus because Xcode will build ncpus targets\n                # in parallel and if each target happens to have a rules step, there\n                # would be ncpus^2 things going.  With a machine that has 2 quad-core\n                # Xeons, a build can quickly run out of processes based on\n                # scheduling/other tasks, and randomly failing builds are no good.\n                script = (\n                    \"\"\"JOB_COUNT=\"$(/usr/sbin/sysctl -n hw.ncpu)\"\nif [ \"${JOB_COUNT}\" -gt 4 ]; then\n  JOB_COUNT=4\nfi\nexec xcrun make -f \"${PROJECT_FILE_PATH}/%s\" -j \"${JOB_COUNT}\"\nexit 1\n\"\"\"\n                    % makefile_name\n                )\n                ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase(\n                    {\n                        \"name\": 'Rule \"' + rule[\"rule_name\"] + '\"',\n                        \"shellScript\": script,\n                        \"showEnvVarsInLog\": 0,\n                    }\n                )\n\n                if support_xct:\n                    support_xct.AppendProperty(\"buildPhases\", ssbp)\n                else:\n                    # TODO(mark): this assumes too much knowledge of the internals of\n                    # xcodeproj_file; some of these smarts should move\n                    # into xcodeproj_file itself.\n                    xct._properties[\"buildPhases\"].insert(prebuild_index, ssbp)\n                    prebuild_index = prebuild_index + 1\n\n            # Extra rule inputs also go into the project file.  Concrete outputs were\n            # already added when they were computed.\n            groups = [\"inputs\", \"inputs_excluded\"]\n            if skip_excluded_files:\n                groups = [x for x in groups if not x.endswith(\"_excluded\")]\n            for group in groups:\n                for item in rule.get(group, []):\n                    pbxp.AddOrGetFileInRootGroup(item)\n\n        # Add \"sources\".\n        for source in spec.get(\"sources\", []):\n            (_source_root, source_extension) = posixpath.splitext(source)\n            if source_extension[1:] not in rules_by_ext:\n                # AddSourceToTarget will add the file to a root group if it's not\n                # already there.\n                AddSourceToTarget(source, type, pbxp, xct)\n            else:\n                pbxp.AddOrGetFileInRootGroup(source)\n\n        # Add \"mac_bundle_resources\" and \"mac_framework_private_headers\" if\n        # it's a bundle of any type.\n        if is_bundle:\n            for resource in tgt_mac_bundle_resources:\n                (_resource_root, resource_extension) = posixpath.splitext(resource)\n                if resource_extension[1:] not in rules_by_ext:\n                    AddResourceToTarget(resource, pbxp, xct)\n                else:\n                    pbxp.AddOrGetFileInRootGroup(resource)\n\n            for header in spec.get(\"mac_framework_private_headers\", []):\n                AddHeaderToTarget(header, pbxp, xct, False)\n\n        # Add \"mac_framework_headers\". These can be valid for both frameworks\n        # and static libraries.\n        if is_bundle or type == \"static_library\":\n            for header in spec.get(\"mac_framework_headers\", []):\n                AddHeaderToTarget(header, pbxp, xct, True)\n\n        # Add \"copies\".\n        pbxcp_dict = {}\n        for copy_group in spec.get(\"copies\", []):\n            dest = copy_group[\"destination\"]\n            if dest[0] not in (\"/\", \"$\"):\n                # Relative paths are relative to $(SRCROOT).\n                dest = \"$(SRCROOT)/\" + dest\n\n            code_sign = int(copy_group.get(\"xcode_code_sign\", 0))\n            settings = (None, \"{ATTRIBUTES = (CodeSignOnCopy, ); }\")[code_sign]\n\n            # Coalesce multiple \"copies\" sections in the same target with the same\n            # \"destination\" property into the same PBXCopyFilesBuildPhase, otherwise\n            # they'll wind up with ID collisions.\n            pbxcp = pbxcp_dict.get(dest, None)\n            if pbxcp is None:\n                pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase(\n                    {\"name\": \"Copy to \" + copy_group[\"destination\"]}, parent=xct\n                )\n                pbxcp.SetDestination(dest)\n\n                # TODO(mark): The usual comment about this knowing too much about\n                # gyp.xcodeproj_file internals applies.\n                xct._properties[\"buildPhases\"].insert(prebuild_index, pbxcp)\n\n                pbxcp_dict[dest] = pbxcp\n\n            for file in copy_group[\"files\"]:\n                pbxcp.AddFile(file, settings)\n\n        # Excluded files can also go into the project file.\n        if not skip_excluded_files:\n            for key in [\n                \"sources\",\n                \"mac_bundle_resources\",\n                \"mac_framework_headers\",\n                \"mac_framework_private_headers\",\n            ]:\n                excluded_key = key + \"_excluded\"\n                for item in spec.get(excluded_key, []):\n                    pbxp.AddOrGetFileInRootGroup(item)\n\n        # So can \"inputs\" and \"outputs\" sections of \"actions\" groups.\n        groups = [\"inputs\", \"inputs_excluded\", \"outputs\", \"outputs_excluded\"]\n        if skip_excluded_files:\n            groups = [x for x in groups if not x.endswith(\"_excluded\")]\n        for action in spec.get(\"actions\", []):\n            for group in groups:\n                for item in action.get(group, []):\n                    # Exclude anything in BUILT_PRODUCTS_DIR.  They're products, not\n                    # sources.\n                    if not item.startswith(\"$(BUILT_PRODUCTS_DIR)/\"):\n                        pbxp.AddOrGetFileInRootGroup(item)\n\n        for postbuild in spec.get(\"postbuilds\", []):\n            action_string_sh = gyp.common.EncodePOSIXShellList(postbuild[\"action\"])\n            script = \"exec \" + action_string_sh + \"\\nexit 1\\n\"\n\n            # Make the postbuild step depend on the output of ld or ar from this\n            # target. Apparently putting the script step after the link step isn't\n            # sufficient to ensure proper ordering in all cases. With an input\n            # declared but no outputs, the script step should run every time, as\n            # desired.\n            ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase(\n                {\n                    \"inputPaths\": [\"$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)\"],\n                    \"name\": 'Postbuild \"' + postbuild[\"postbuild_name\"] + '\"',\n                    \"shellScript\": script,\n                    \"showEnvVarsInLog\": 0,\n                }\n            )\n            xct.AppendProperty(\"buildPhases\", ssbp)\n\n        # Add dependencies before libraries, because adding a dependency may imply\n        # adding a library.  It's preferable to keep dependencies listed first\n        # during a link phase so that they can override symbols that would\n        # otherwise be provided by libraries, which will usually include system\n        # libraries.  On some systems, ld is finicky and even requires the\n        # libraries to be ordered in such a way that unresolved symbols in\n        # earlier-listed libraries may only be resolved by later-listed libraries.\n        # The Mac linker doesn't work that way, but other platforms do, and so\n        # their linker invocations need to be constructed in this way.  There's\n        # no compelling reason for Xcode's linker invocations to differ.\n\n        if \"dependencies\" in spec:\n            for dependency in spec[\"dependencies\"]:\n                xct.AddDependency(xcode_targets[dependency])\n                # The support project also gets the dependencies (in case they are\n                # needed for the actions/rules to work).\n                if support_xct:\n                    support_xct.AddDependency(xcode_targets[dependency])\n\n        if \"libraries\" in spec:\n            for library in spec[\"libraries\"]:\n                xct.FrameworksPhase().AddFile(library)\n                # Add the library's directory to LIBRARY_SEARCH_PATHS if necessary.\n                # I wish Xcode handled this automatically.\n                library_dir = posixpath.dirname(library)\n                if library_dir not in xcode_standard_library_dirs and (\n                    not xct.HasBuildSetting(_library_search_paths_var)\n                    or library_dir not in xct.GetBuildSetting(_library_search_paths_var)\n                ):\n                    xct.AppendBuildSetting(_library_search_paths_var, library_dir)\n\n        for configuration_name in configuration_names:\n            configuration = spec[\"configurations\"][configuration_name]\n            xcbc = xct.ConfigurationNamed(configuration_name)\n            for include_dir in configuration.get(\"mac_framework_dirs\", []):\n                xcbc.AppendBuildSetting(\"FRAMEWORK_SEARCH_PATHS\", include_dir)\n            for include_dir in configuration.get(\"include_dirs\", []):\n                xcbc.AppendBuildSetting(\"HEADER_SEARCH_PATHS\", include_dir)\n            for library_dir in configuration.get(\"library_dirs\", []):\n                if library_dir not in xcode_standard_library_dirs and (\n                    not xcbc.HasBuildSetting(_library_search_paths_var)\n                    or library_dir\n                    not in xcbc.GetBuildSetting(_library_search_paths_var)\n                ):\n                    xcbc.AppendBuildSetting(_library_search_paths_var, library_dir)\n\n            if \"defines\" in configuration:\n                for define in configuration[\"defines\"]:\n                    set_define = EscapeXcodeDefine(define)\n                    xcbc.AppendBuildSetting(\"GCC_PREPROCESSOR_DEFINITIONS\", set_define)\n            if \"xcode_settings\" in configuration:\n                for xck, xcv in configuration[\"xcode_settings\"].items():\n                    xcbc.SetBuildSetting(xck, xcv)\n            if \"xcode_config_file\" in configuration:\n                config_ref = pbxp.AddOrGetFileInRootGroup(\n                    configuration[\"xcode_config_file\"]\n                )\n                xcbc.SetBaseConfiguration(config_ref)\n\n    build_files = []\n    for build_file, build_file_dict in data.items():\n        if build_file.endswith(\".gyp\"):\n            build_files.append(build_file)\n\n    for build_file in build_files:\n        xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests)\n\n    for build_file in build_files:\n        xcode_projects[build_file].Finalize2(xcode_targets, xcode_target_to_target_dict)\n\n    for build_file in build_files:\n        xcode_projects[build_file].Write()\n"
  },
  {
    "path": "gyp/pylib/gyp/generator/xcode_test.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2013 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Unit tests for the xcode.py file.\"\"\"\n\nimport sys\nimport unittest\n\nfrom gyp.generator import xcode\n\n\nclass TestEscapeXcodeDefine(unittest.TestCase):\n    if sys.platform == \"darwin\":\n\n        def test_InheritedRemainsUnescaped(self):\n            self.assertEqual(xcode.EscapeXcodeDefine(\"$(inherited)\"), \"$(inherited)\")\n\n        def test_Escaping(self):\n            self.assertEqual(xcode.EscapeXcodeDefine('a b\"c\\\\'), 'a\\\\ b\\\\\"c\\\\\\\\')\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
  },
  {
    "path": "gyp/pylib/gyp/input.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\nimport ast\nimport multiprocessing\nimport os.path\nimport re\nimport shlex\nimport signal\nimport subprocess\nimport sys\nimport threading\nimport traceback\n\nfrom packaging.version import Version\n\nimport gyp.common\nimport gyp.simple_copy\nfrom gyp.common import GypError, OrderedSet\n\n# A list of types that are treated as linkable.\nlinkable_types = [\n    \"executable\",\n    \"shared_library\",\n    \"loadable_module\",\n    \"mac_kernel_extension\",\n    \"windows_driver\",\n]\n\n# A list of sections that contain links to other targets.\ndependency_sections = [\"dependencies\", \"export_dependent_settings\"]\n\n# base_path_sections is a list of sections defined by GYP that contain\n# pathnames.  The generators can provide more keys, the two lists are merged\n# into path_sections, but you should call IsPathSection instead of using either\n# list directly.\nbase_path_sections = [\n    \"destination\",\n    \"files\",\n    \"include_dirs\",\n    \"inputs\",\n    \"libraries\",\n    \"outputs\",\n    \"sources\",\n]\npath_sections = set()\n\n# These per-process dictionaries are used to cache build file data when loading\n# in parallel mode.\nper_process_data = {}\nper_process_aux_data = {}\n\n\ndef IsPathSection(section):\n    # If section ends in one of the '=+?!' characters, it's applied to a section\n    # without the trailing characters.  '/' is notably absent from this list,\n    # because there's no way for a regular expression to be treated as a path.\n    while section and section[-1:] in \"=+?!\":\n        section = section[:-1]\n\n    if section in path_sections:\n        return True\n\n    # Sections matching the regexp '_(dir|file|path)s?$' are also\n    # considered PathSections. Using manual string matching since that\n    # is much faster than the regexp and this can be called hundreds of\n    # thousands of times so micro performance matters.\n    if \"_\" in section:\n        tail = section[-6:]\n        if tail[-1] == \"s\":\n            tail = tail[:-1]\n        if tail[-5:] in (\"_file\", \"_path\"):\n            return True\n        return tail[-4:] == \"_dir\"\n\n    return False\n\n\n# base_non_configuration_keys is a list of key names that belong in the target\n# itself and should not be propagated into its configurations.  It is merged\n# with a list that can come from the generator to\n# create non_configuration_keys.\nbase_non_configuration_keys = [\n    # Sections that must exist inside targets and not configurations.\n    \"actions\",\n    \"configurations\",\n    \"copies\",\n    \"default_configuration\",\n    \"dependencies\",\n    \"dependencies_original\",\n    \"libraries\",\n    \"postbuilds\",\n    \"product_dir\",\n    \"product_extension\",\n    \"product_name\",\n    \"product_prefix\",\n    \"rules\",\n    \"run_as\",\n    \"sources\",\n    \"standalone_static_library\",\n    \"suppress_wildcard\",\n    \"target_name\",\n    \"toolset\",\n    \"toolsets\",\n    \"type\",\n    # Sections that can be found inside targets or configurations, but that\n    # should not be propagated from targets into their configurations.\n    \"variables\",\n]\nnon_configuration_keys = []\n\n# Keys that do not belong inside a configuration dictionary.\ninvalid_configuration_keys = [\n    \"actions\",\n    \"all_dependent_settings\",\n    \"configurations\",\n    \"dependencies\",\n    \"direct_dependent_settings\",\n    \"libraries\",\n    \"link_settings\",\n    \"sources\",\n    \"standalone_static_library\",\n    \"target_name\",\n    \"type\",\n]\n\n# Controls whether or not the generator supports multiple toolsets.\nmultiple_toolsets = False\n\n# Paths for converting filelist paths to output paths: {\n#   toplevel,\n#   qualified_output_dir,\n# }\ngenerator_filelist_paths = None\n\n\ndef GetIncludedBuildFiles(build_file_path, aux_data, included=None):\n    \"\"\"Return a list of all build files included into build_file_path.\n\n    The returned list will contain build_file_path as well as all other files\n    that it included, either directly or indirectly.  Note that the list may\n    contain files that were included into a conditional section that evaluated\n    to false and was not merged into build_file_path's dict.\n\n    aux_data is a dict containing a key for each build file or included build\n    file.  Those keys provide access to dicts whose \"included\" keys contain\n    lists of all other files included by the build file.\n\n    included should be left at its default None value by external callers.  It\n    is used for recursion.\n\n    The returned list will not contain any duplicate entries.  Each build file\n    in the list will be relative to the current directory.\n    \"\"\"\n\n    if included is None:\n        included = []\n\n    if build_file_path in included:\n        return included\n\n    included.append(build_file_path)\n\n    for included_build_file in aux_data[build_file_path].get(\"included\", []):\n        GetIncludedBuildFiles(included_build_file, aux_data, included)\n\n    return included\n\n\ndef CheckedEval(file_contents):\n    \"\"\"Return the eval of a gyp file.\n    The gyp file is restricted to dictionaries and lists only, and\n    repeated keys are not allowed.\n    Note that this is slower than eval() is.\n    \"\"\"\n\n    syntax_tree = ast.parse(file_contents)\n    assert isinstance(syntax_tree, ast.Module)\n    c1 = syntax_tree.body\n    assert len(c1) == 1\n    c2 = c1[0]\n    assert isinstance(c2, ast.Expr)\n    return CheckNode(c2.value, [])\n\n\ndef CheckNode(node, keypath):\n    if isinstance(node, ast.Dict):\n        dict = {}\n        for key, value in zip(node.keys, node.values):\n            assert isinstance(key, ast.Str)\n            key = key.s\n            if key in dict:\n                raise GypError(\n                    \"Key '\"\n                    + key\n                    + \"' repeated at level \"\n                    + repr(len(keypath) + 1)\n                    + \" with key path '\"\n                    + \".\".join(keypath)\n                    + \"'\"\n                )\n            kp = list(keypath)  # Make a copy of the list for descending this node.\n            kp.append(key)\n            dict[key] = CheckNode(value, kp)\n        return dict\n    elif isinstance(node, ast.List):\n        children = []\n        for index, child in enumerate(node.elts):\n            kp = list(keypath)  # Copy list.\n            kp.append(repr(index))\n            children.append(CheckNode(child, kp))\n        return children\n    elif isinstance(node, ast.Str):\n        return node.s\n    else:\n        raise TypeError(\n            \"Unknown AST node at key path '\" + \".\".join(keypath) + \"': \" + repr(node)\n        )\n\n\ndef LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check):\n    if build_file_path in data:\n        return data[build_file_path]\n\n    if os.path.exists(build_file_path):\n        build_file_contents = open(build_file_path, encoding=\"utf-8\").read()\n    else:\n        raise GypError(f\"{build_file_path} not found (cwd: {os.getcwd()})\")\n\n    build_file_data = None\n    try:\n        if check:\n            build_file_data = CheckedEval(build_file_contents)\n        else:\n            build_file_data = eval(build_file_contents, {\"__builtins__\": {}}, None)\n    except SyntaxError as e:\n        e.filename = build_file_path\n        raise\n    except Exception as e:\n        gyp.common.ExceptionAppend(e, \"while reading \" + build_file_path)\n        raise\n\n    if not isinstance(build_file_data, dict):\n        raise GypError(\"%s does not evaluate to a dictionary.\" % build_file_path)\n\n    data[build_file_path] = build_file_data\n    aux_data[build_file_path] = {}\n\n    # Scan for includes and merge them in.\n    if \"skip_includes\" not in build_file_data or not build_file_data[\"skip_includes\"]:\n        try:\n            if is_target:\n                LoadBuildFileIncludesIntoDict(\n                    build_file_data, build_file_path, data, aux_data, includes, check\n                )\n            else:\n                LoadBuildFileIncludesIntoDict(\n                    build_file_data, build_file_path, data, aux_data, None, check\n                )\n        except Exception as e:\n            gyp.common.ExceptionAppend(\n                e, \"while reading includes of \" + build_file_path\n            )\n            raise\n\n    return build_file_data\n\n\ndef LoadBuildFileIncludesIntoDict(\n    subdict, subdict_path, data, aux_data, includes, check\n):\n    includes_list = []\n    if includes is not None:\n        includes_list.extend(includes)\n    if \"includes\" in subdict:\n        for include in subdict[\"includes\"]:\n            # \"include\" is specified relative to subdict_path, so compute the real\n            # path to include by appending the provided \"include\" to the directory\n            # in which subdict_path resides.\n            relative_include = os.path.normpath(\n                os.path.join(os.path.dirname(subdict_path), include)\n            )\n            includes_list.append(relative_include)\n        # Unhook the includes list, it's no longer needed.\n        del subdict[\"includes\"]\n\n    # Merge in the included files.\n    for include in includes_list:\n        if \"included\" not in aux_data[subdict_path]:\n            aux_data[subdict_path][\"included\"] = []\n        aux_data[subdict_path][\"included\"].append(include)\n\n        gyp.DebugOutput(gyp.DEBUG_INCLUDES, \"Loading Included File: '%s'\", include)\n\n        MergeDicts(\n            subdict,\n            LoadOneBuildFile(include, data, aux_data, None, False, check),\n            subdict_path,\n            include,\n        )\n\n    # Recurse into subdictionaries.\n    for k, v in subdict.items():\n        if isinstance(v, dict):\n            LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data, None, check)\n        elif isinstance(v, list):\n            LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data, check)\n\n\n# This recurses into lists so that it can look for dicts.\ndef LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data, check):\n    for item in sublist:\n        if isinstance(item, dict):\n            LoadBuildFileIncludesIntoDict(\n                item, sublist_path, data, aux_data, None, check\n            )\n        elif isinstance(item, list):\n            LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data, check)\n\n\n# Processes toolsets in all the targets. This recurses into condition entries\n# since they can contain toolsets as well.\ndef ProcessToolsetsInDict(data):\n    if \"targets\" in data:\n        target_list = data[\"targets\"]\n        new_target_list = []\n        for target in target_list:\n            # If this target already has an explicit 'toolset', and no 'toolsets'\n            # list, don't modify it further.\n            if \"toolset\" in target and \"toolsets\" not in target:\n                new_target_list.append(target)\n                continue\n            if multiple_toolsets:\n                toolsets = target.get(\"toolsets\", [\"target\"])\n            else:\n                toolsets = [\"target\"]\n            # Make sure this 'toolsets' definition is only processed once.\n            if \"toolsets\" in target:\n                del target[\"toolsets\"]\n            if len(toolsets) > 0:\n                # Optimization: only do copies if more than one toolset is specified.\n                for build in toolsets[1:]:\n                    new_target = gyp.simple_copy.deepcopy(target)\n                    new_target[\"toolset\"] = build\n                    new_target_list.append(new_target)\n                target[\"toolset\"] = toolsets[0]\n                new_target_list.append(target)\n        data[\"targets\"] = new_target_list\n    if \"conditions\" in data:\n        for condition in data[\"conditions\"]:\n            if isinstance(condition, list):\n                for condition_dict in condition[1:]:\n                    if isinstance(condition_dict, dict):\n                        ProcessToolsetsInDict(condition_dict)\n\n\n# TODO(mark): I don't love this name.  It just means that it's going to load\n# a build file that contains targets and is expected to provide a targets dict\n# that contains the targets...\ndef LoadTargetBuildFile(\n    build_file_path,\n    data,\n    aux_data,\n    variables,\n    includes,\n    depth,\n    check,\n    load_dependencies,\n):\n    # If depth is set, predefine the DEPTH variable to be a relative path from\n    # this build file's directory to the directory identified by depth.\n    if depth:\n        # TODO(dglazkov) The backslash/forward-slash replacement at the end is a\n        # temporary measure. This should really be addressed by keeping all paths\n        # in POSIX until actual project generation.\n        d = gyp.common.RelativePath(depth, os.path.dirname(build_file_path))\n        if d == \"\":\n            variables[\"DEPTH\"] = \".\"\n        else:\n            variables[\"DEPTH\"] = d.replace(\"\\\\\", \"/\")\n\n    # The 'target_build_files' key is only set when loading target build files in\n    # the non-parallel code path, where LoadTargetBuildFile is called\n    # recursively.  In the parallel code path, we don't need to check whether the\n    # |build_file_path| has already been loaded, because the 'scheduled' set in\n    # ParallelState guarantees that we never load the same |build_file_path|\n    # twice.\n    if \"target_build_files\" in data:\n        if build_file_path in data[\"target_build_files\"]:\n            # Already loaded.\n            return False\n        data[\"target_build_files\"].add(build_file_path)\n\n    gyp.DebugOutput(\n        gyp.DEBUG_INCLUDES, \"Loading Target Build File '%s'\", build_file_path\n    )\n\n    build_file_data = LoadOneBuildFile(\n        build_file_path, data, aux_data, includes, True, check\n    )\n\n    # Store DEPTH for later use in generators.\n    build_file_data[\"_DEPTH\"] = depth\n\n    # Set up the included_files key indicating which .gyp files contributed to\n    # this target dict.\n    if \"included_files\" in build_file_data:\n        raise GypError(build_file_path + \" must not contain included_files key\")\n\n    included = GetIncludedBuildFiles(build_file_path, aux_data)\n    build_file_data[\"included_files\"] = []\n    for included_file in included:\n        # included_file is relative to the current directory, but it needs to\n        # be made relative to build_file_path's directory.\n        included_relative = gyp.common.RelativePath(\n            included_file, os.path.dirname(build_file_path)\n        )\n        build_file_data[\"included_files\"].append(included_relative)\n\n    # Do a first round of toolsets expansion so that conditions can be defined\n    # per toolset.\n    ProcessToolsetsInDict(build_file_data)\n\n    # Apply \"pre\"/\"early\" variable expansions and condition evaluations.\n    ProcessVariablesAndConditionsInDict(\n        build_file_data, PHASE_EARLY, variables, build_file_path\n    )\n\n    # Since some toolsets might have been defined conditionally, perform\n    # a second round of toolsets expansion now.\n    ProcessToolsetsInDict(build_file_data)\n\n    # Look at each project's target_defaults dict, and merge settings into\n    # targets.\n    if \"target_defaults\" in build_file_data:\n        if \"targets\" not in build_file_data:\n            raise GypError(\"Unable to find targets in build file %s\" % build_file_path)\n\n        index = 0\n        while index < len(build_file_data[\"targets\"]):\n            # This procedure needs to give the impression that target_defaults is\n            # used as defaults, and the individual targets inherit from that.\n            # The individual targets need to be merged into the defaults.  Make\n            # a deep copy of the defaults for each target, merge the target dict\n            # as found in the input file into that copy, and then hook up the\n            # copy with the target-specific data merged into it as the replacement\n            # target dict.\n            old_target_dict = build_file_data[\"targets\"][index]\n            new_target_dict = gyp.simple_copy.deepcopy(\n                build_file_data[\"target_defaults\"]\n            )\n            MergeDicts(\n                new_target_dict, old_target_dict, build_file_path, build_file_path\n            )\n            build_file_data[\"targets\"][index] = new_target_dict\n            index += 1\n\n        # No longer needed.\n        del build_file_data[\"target_defaults\"]\n\n    # Look for dependencies.  This means that dependency resolution occurs\n    # after \"pre\" conditionals and variable expansion, but before \"post\" -\n    # in other words, you can't put a \"dependencies\" section inside a \"post\"\n    # conditional within a target.\n\n    dependencies = []\n    if \"targets\" in build_file_data:\n        for target_dict in build_file_data[\"targets\"]:\n            if \"dependencies\" not in target_dict:\n                continue\n            for dependency in target_dict[\"dependencies\"]:\n                dependencies.append(\n                    gyp.common.ResolveTarget(build_file_path, dependency, None)[0]\n                )\n\n    if load_dependencies:\n        for dependency in dependencies:\n            try:\n                LoadTargetBuildFile(\n                    dependency,\n                    data,\n                    aux_data,\n                    variables,\n                    includes,\n                    depth,\n                    check,\n                    load_dependencies,\n                )\n            except Exception as e:\n                gyp.common.ExceptionAppend(\n                    e, \"while loading dependencies of %s\" % build_file_path\n                )\n                raise\n    else:\n        return (build_file_path, dependencies)\n\n\ndef CallLoadTargetBuildFile(\n    global_flags,\n    build_file_path,\n    variables,\n    includes,\n    depth,\n    check,\n    generator_input_info,\n):\n    \"\"\"Wrapper around LoadTargetBuildFile for parallel processing.\n\n    This wrapper is used when LoadTargetBuildFile is executed in\n    a worker process.\n    \"\"\"\n\n    try:\n        signal.signal(signal.SIGINT, signal.SIG_IGN)\n\n        # Apply globals so that the worker process behaves the same.\n        for key, value in global_flags.items():\n            globals()[key] = value\n\n        SetGeneratorGlobals(generator_input_info)\n        result = LoadTargetBuildFile(\n            build_file_path,\n            per_process_data,\n            per_process_aux_data,\n            variables,\n            includes,\n            depth,\n            check,\n            False,\n        )\n        if not result:\n            return result\n\n        (build_file_path, dependencies) = result\n\n        # We can safely pop the build_file_data from per_process_data because it\n        # will never be referenced by this process again, so we don't need to keep\n        # it in the cache.\n        build_file_data = per_process_data.pop(build_file_path)\n\n        # This gets serialized and sent back to the main process via a pipe.\n        # It's handled in LoadTargetBuildFileCallback.\n        return (build_file_path, build_file_data, dependencies)\n    except GypError as e:\n        sys.stderr.write(\"gyp: %s\\n\" % e)\n        return None\n    except Exception as e:\n        print(\"Exception:\", e, file=sys.stderr)\n        print(traceback.format_exc(), file=sys.stderr)\n        return None\n\n\nclass ParallelProcessingError(Exception):\n    pass\n\n\nclass ParallelState:\n    \"\"\"Class to keep track of state when processing input files in parallel.\n\n    If build files are loaded in parallel, use this to keep track of\n    state during farming out and processing parallel jobs. It's stored\n    in a global so that the callback function can have access to it.\n    \"\"\"\n\n    def __init__(self):\n        # The multiprocessing pool.\n        self.pool = None\n        # The condition variable used to protect this object and notify\n        # the main loop when there might be more data to process.\n        self.condition = None\n        # The \"data\" dict that was passed to LoadTargetBuildFileParallel\n        self.data = None\n        # The number of parallel calls outstanding; decremented when a response\n        # was received.\n        self.pending = 0\n        # The set of all build files that have been scheduled, so we don't\n        # schedule the same one twice.\n        self.scheduled = set()\n        # A list of dependency build file paths that haven't been scheduled yet.\n        self.dependencies = []\n        # Flag to indicate if there was an error in a child process.\n        self.error = False\n\n    def LoadTargetBuildFileCallback(self, result):\n        \"\"\"Handle the results of running LoadTargetBuildFile in another process.\"\"\"\n        self.condition.acquire()\n        if not result:\n            self.error = True\n            self.condition.notify()\n            self.condition.release()\n            return\n        (build_file_path0, build_file_data0, dependencies0) = result\n        self.data[build_file_path0] = build_file_data0\n        self.data[\"target_build_files\"].add(build_file_path0)\n        for new_dependency in dependencies0:\n            if new_dependency not in self.scheduled:\n                self.scheduled.add(new_dependency)\n                self.dependencies.append(new_dependency)\n        self.pending -= 1\n        self.condition.notify()\n        self.condition.release()\n\n\ndef LoadTargetBuildFilesParallel(\n    build_files, data, variables, includes, depth, check, generator_input_info\n):\n    parallel_state = ParallelState()\n    parallel_state.condition = threading.Condition()\n    # Make copies of the build_files argument that we can modify while working.\n    parallel_state.dependencies = list(build_files)\n    parallel_state.scheduled = set(build_files)\n    parallel_state.pending = 0\n    parallel_state.data = data\n\n    try:\n        parallel_state.condition.acquire()\n        while parallel_state.dependencies or parallel_state.pending:\n            if parallel_state.error:\n                break\n            if not parallel_state.dependencies:\n                parallel_state.condition.wait()\n                continue\n\n            dependency = parallel_state.dependencies.pop()\n\n            parallel_state.pending += 1\n            global_flags = {\n                \"path_sections\": globals()[\"path_sections\"],\n                \"non_configuration_keys\": globals()[\"non_configuration_keys\"],\n                \"multiple_toolsets\": globals()[\"multiple_toolsets\"],\n            }\n\n            if not parallel_state.pool:\n                parallel_state.pool = multiprocessing.Pool(multiprocessing.cpu_count())\n            parallel_state.pool.apply_async(\n                CallLoadTargetBuildFile,\n                args=(\n                    global_flags,\n                    dependency,\n                    variables,\n                    includes,\n                    depth,\n                    check,\n                    generator_input_info,\n                ),\n                callback=parallel_state.LoadTargetBuildFileCallback,\n            )\n    except KeyboardInterrupt as e:\n        parallel_state.pool.terminate()\n        raise e\n\n    parallel_state.condition.release()\n\n    parallel_state.pool.close()\n    parallel_state.pool.join()\n    parallel_state.pool = None\n\n    if parallel_state.error:\n        sys.exit(1)\n\n\n# Look for the bracket that matches the first bracket seen in a\n# string, and return the start and end as a tuple.  For example, if\n# the input is something like \"<(foo <(bar)) blah\", then it would\n# return (1, 13), indicating the entire string except for the leading\n# \"<\" and trailing \" blah\".\nLBRACKETS = set(\"{[(\")\nBRACKETS = {\"}\": \"{\", \"]\": \"[\", \")\": \"(\"}\n\n\ndef FindEnclosingBracketGroup(input_str):\n    stack = []\n    start = -1\n    for index, char in enumerate(input_str):\n        if char in LBRACKETS:\n            stack.append(char)\n            if start == -1:\n                start = index\n        elif char in BRACKETS:\n            if not stack:\n                return (-1, -1)\n            if stack.pop() != BRACKETS[char]:\n                return (-1, -1)\n            if not stack:\n                return (start, index + 1)\n    return (-1, -1)\n\n\ndef IsStrCanonicalInt(string):\n    \"\"\"Returns True if |string| is in its canonical integer form.\n\n    The canonical form is such that str(int(string)) == string.\n    \"\"\"\n    if isinstance(string, str):\n        # This function is called a lot so for maximum performance, avoid\n        # involving regexps which would otherwise make the code much\n        # shorter. Regexps would need twice the time of this function.\n        if string:\n            if string == \"0\":\n                return True\n            if string[0] == \"-\":\n                string = string[1:]\n                if not string:\n                    return False\n            if \"1\" <= string[0] <= \"9\":\n                return string.isdigit()\n\n    return False\n\n\n# This matches things like \"<(asdf)\", \"<!(cmd)\", \"<!@(cmd)\", \"<|(list)\",\n# \"<!interpreter(arguments)\", \"<([list])\", and even \"<([)\" and \"<(<())\".\n# In the last case, the inner \"<()\" is captured in match['content'].\nearly_variable_re = re.compile(\n    r\"(?P<replace>(?P<type><(?:(?:!?@?)|\\|)?)\"\n    r\"(?P<command_string>[-a-zA-Z0-9_.]+)?\"\n    r\"\\((?P<is_array>\\s*\\[?)\"\n    r\"(?P<content>.*?)(\\]?)\\))\"\n)\n\n# This matches the same as early_variable_re, but with '>' instead of '<'.\nlate_variable_re = re.compile(\n    r\"(?P<replace>(?P<type>>(?:(?:!?@?)|\\|)?)\"\n    r\"(?P<command_string>[-a-zA-Z0-9_.]+)?\"\n    r\"\\((?P<is_array>\\s*\\[?)\"\n    r\"(?P<content>.*?)(\\]?)\\))\"\n)\n\n# This matches the same as early_variable_re, but with '^' instead of '<'.\nlatelate_variable_re = re.compile(\n    r\"(?P<replace>(?P<type>[\\^](?:(?:!?@?)|\\|)?)\"\n    r\"(?P<command_string>[-a-zA-Z0-9_.]+)?\"\n    r\"\\((?P<is_array>\\s*\\[?)\"\n    r\"(?P<content>.*?)(\\]?)\\))\"\n)\n\n# Global cache of results from running commands so they don't have to be run\n# more then once.\ncached_command_results = {}\n\n\ndef FixupPlatformCommand(cmd):\n    if sys.platform == \"win32\":\n        if isinstance(cmd, list):\n            cmd = [re.sub(\"^cat \", \"type \", cmd[0])] + cmd[1:]\n        else:\n            cmd = re.sub(\"^cat \", \"type \", cmd)\n    return cmd\n\n\nPHASE_EARLY = 0\nPHASE_LATE = 1\nPHASE_LATELATE = 2\n\n\ndef ExpandVariables(input, phase, variables, build_file):\n    # Look for the pattern that gets expanded into variables\n    if phase == PHASE_EARLY:\n        variable_re = early_variable_re\n        expansion_symbol = \"<\"\n    elif phase == PHASE_LATE:\n        variable_re = late_variable_re\n        expansion_symbol = \">\"\n    elif phase == PHASE_LATELATE:\n        variable_re = latelate_variable_re\n        expansion_symbol = \"^\"\n    else:\n        assert False\n\n    input_str = str(input)\n    if IsStrCanonicalInt(input_str):\n        return int(input_str)\n\n    # Do a quick scan to determine if an expensive regex search is warranted.\n    if expansion_symbol not in input_str:\n        return input_str\n\n    # Get the entire list of matches as a list of MatchObject instances.\n    # (using findall here would return strings instead of MatchObjects).\n    matches = list(variable_re.finditer(input_str))\n    if not matches:\n        return input_str\n\n    output = input_str\n    # Reverse the list of matches so that replacements are done right-to-left.\n    # That ensures that earlier replacements won't mess up the string in a\n    # way that causes later calls to find the earlier substituted text instead\n    # of what's intended for replacement.\n    matches.reverse()\n    for match_group in matches:\n        match = match_group.groupdict()\n        gyp.DebugOutput(gyp.DEBUG_VARIABLES, \"Matches: %r\", match)\n        # match['replace'] is the substring to look for, match['type']\n        # is the character code for the replacement type (< > <! >! <| >| <@\n        # >@ <!@ >!@), match['is_array'] contains a '[' for command\n        # arrays, and match['content'] is the name of the variable (< >)\n        # or command to run (<! >!). match['command_string'] is an optional\n        # command string. Currently, only 'pymod_do_main' is supported.\n\n        # run_command is true if a ! variant is used.\n        run_command = \"!\" in match[\"type\"]\n        command_string = match[\"command_string\"]\n\n        # file_list is true if a | variant is used.\n        file_list = \"|\" in match[\"type\"]\n\n        # Capture these now so we can adjust them later.\n        replace_start = match_group.start(\"replace\")\n        replace_end = match_group.end(\"replace\")\n\n        # Find the ending paren, and re-evaluate the contained string.\n        (c_start, c_end) = FindEnclosingBracketGroup(input_str[replace_start:])\n\n        # Adjust the replacement range to match the entire command\n        # found by FindEnclosingBracketGroup (since the variable_re\n        # probably doesn't match the entire command if it contained\n        # nested variables).\n        replace_end = replace_start + c_end\n\n        # Find the \"real\" replacement, matching the appropriate closing\n        # paren, and adjust the replacement start and end.\n        replacement = input_str[replace_start:replace_end]\n\n        # Figure out what the contents of the variable parens are.\n        contents_start = replace_start + c_start + 1\n        contents_end = replace_end - 1\n        contents = input_str[contents_start:contents_end]\n\n        # Do filter substitution now for <|().\n        # Admittedly, this is different than the evaluation order in other\n        # contexts. However, since filtration has no chance to run on <|(),\n        # this seems like the only obvious way to give them access to filters.\n        if file_list:\n            processed_variables = gyp.simple_copy.deepcopy(variables)\n            ProcessListFiltersInDict(contents, processed_variables)\n            # Recurse to expand variables in the contents\n            contents = ExpandVariables(contents, phase, processed_variables, build_file)\n        else:\n            # Recurse to expand variables in the contents\n            contents = ExpandVariables(contents, phase, variables, build_file)\n\n        # Strip off leading/trailing whitespace so that variable matches are\n        # simpler below (and because they are rarely needed).\n        contents = contents.strip()\n\n        # expand_to_list is true if an @ variant is used.  In that case,\n        # the expansion should result in a list.  Note that the caller\n        # is to be expecting a list in return, and not all callers do\n        # because not all are working in list context.  Also, for list\n        # expansions, there can be no other text besides the variable\n        # expansion in the input string.\n        expand_to_list = \"@\" in match[\"type\"] and input_str == replacement\n\n        if run_command or file_list:\n            # Find the build file's directory, so commands can be run or file lists\n            # generated relative to it.\n            build_file_dir = os.path.dirname(build_file)\n            if build_file_dir == \"\" and not file_list:\n                # If build_file is just a leaf filename indicating a file in the\n                # current directory, build_file_dir might be an empty string.  Set\n                # it to None to signal to subprocess.Popen that it should run the\n                # command in the current directory.\n                build_file_dir = None\n\n        # Support <|(listfile.txt ...) which generates a file\n        # containing items from a gyp list, generated at gyp time.\n        # This works around actions/rules which have more inputs than will\n        # fit on the command line.\n        if file_list:\n            contents_list = (\n                contents if isinstance(contents, list) else contents.split(\" \")\n            )\n            replacement = contents_list[0]\n            if os.path.isabs(replacement):\n                raise GypError('| cannot handle absolute paths, got \"%s\"' % replacement)\n\n            if not generator_filelist_paths:\n                path = os.path.join(build_file_dir, replacement)\n            else:\n                if os.path.isabs(build_file_dir):\n                    toplevel = generator_filelist_paths[\"toplevel\"]\n                    rel_build_file_dir = gyp.common.RelativePath(\n                        build_file_dir, toplevel\n                    )\n                else:\n                    rel_build_file_dir = build_file_dir\n                qualified_out_dir = generator_filelist_paths[\"qualified_out_dir\"]\n                path = os.path.join(qualified_out_dir, rel_build_file_dir, replacement)\n                gyp.common.EnsureDirExists(path)\n\n            replacement = gyp.common.RelativePath(path, build_file_dir)\n            f = gyp.common.WriteOnDiff(path)\n            for i in contents_list[1:]:\n                f.write(\"%s\\n\" % i)\n            f.close()\n\n        elif run_command:\n            use_shell = True\n            if match[\"is_array\"]:\n                contents = eval(contents)\n                use_shell = False\n\n            # Check for a cached value to avoid executing commands, or generating\n            # file lists more than once. The cache key contains the command to be\n            # run as well as the directory to run it from, to account for commands\n            # that depend on their current directory.\n            # TODO(http://code.google.com/p/gyp/issues/detail?id=111): In theory,\n            # someone could author a set of GYP files where each time the command\n            # is invoked it produces different output by design. When the need\n            # arises, the syntax should be extended to support no caching off a\n            # command's output so it is run every time.\n            cache_key = (str(contents), build_file_dir)\n            cached_value = cached_command_results.get(cache_key, None)\n            if cached_value is None:\n                gyp.DebugOutput(\n                    gyp.DEBUG_VARIABLES,\n                    \"Executing command '%s' in directory '%s'\",\n                    contents,\n                    build_file_dir,\n                )\n\n                replacement = \"\"\n\n                if command_string == \"pymod_do_main\":\n                    # <!pymod_do_main(modulename param eters) loads |modulename| as a\n                    # python module and then calls that module's DoMain() function,\n                    # passing [\"param\", \"eters\"] as a single list argument. For modules\n                    # that don't load quickly, this can be faster than\n                    # <!(python modulename param eters). Do this in |build_file_dir|.\n                    oldwd = os.getcwd()  # Python doesn't like os.open('.'): no fchdir.\n                    if build_file_dir:  # build_file_dir may be None (see above).\n                        os.chdir(build_file_dir)\n                    sys.path.append(os.getcwd())\n                    try:\n                        parsed_contents = shlex.split(contents)\n                        try:\n                            py_module = __import__(parsed_contents[0])\n                        except ImportError as e:\n                            raise GypError(\n                                \"Error importing pymod_do_main\"\n                                \"module (%s): %s\" % (parsed_contents[0], e)\n                            )\n                        replacement = str(\n                            py_module.DoMain(parsed_contents[1:])\n                        ).rstrip()\n                    finally:\n                        sys.path.pop()\n                        os.chdir(oldwd)\n                    assert replacement is not None\n                elif command_string:\n                    raise GypError(\n                        \"Unknown command string '%s' in '%s'.\"\n                        % (command_string, contents)\n                    )\n                else:\n                    # Fix up command with platform specific workarounds.\n                    contents = FixupPlatformCommand(contents)\n                    try:\n                        # stderr will be printed no matter what\n                        result = subprocess.run(\n                            contents,\n                            stdout=subprocess.PIPE,\n                            shell=use_shell,\n                            cwd=build_file_dir,\n                            check=False,\n                        )\n                    except Exception as e:\n                        raise GypError(\n                            \"%s while executing command '%s' in %s\"\n                            % (e, contents, build_file)\n                        )\n\n                    if result.returncode > 0:\n                        raise GypError(\n                            \"Call to '%s' returned exit status %d while in %s.\"\n                            % (contents, result.returncode, build_file)\n                        )\n                    replacement = result.stdout.decode(\"utf-8\").rstrip()\n\n                cached_command_results[cache_key] = replacement\n            else:\n                gyp.DebugOutput(\n                    gyp.DEBUG_VARIABLES,\n                    \"Had cache value for command '%s' in directory '%s'\",\n                    contents,\n                    build_file_dir,\n                )\n                replacement = cached_value\n\n        elif contents not in variables:\n            if contents[-1] in [\"!\", \"/\"]:\n                # In order to allow cross-compiles (nacl) to happen more naturally,\n                # we will allow references to >(sources/) etc. to resolve to\n                # and empty list if undefined. This allows actions to:\n                # 'action!': [\n                #   '>@(_sources!)',\n                # ],\n                # 'action/': [\n                #   '>@(_sources/)',\n                # ],\n                replacement = []\n            else:\n                raise GypError(\"Undefined variable \" + contents + \" in \" + build_file)\n        else:\n            replacement = variables[contents]\n\n        if isinstance(replacement, bytes) and not isinstance(replacement, str):\n            replacement = replacement.decode(\"utf-8\")  # done on Python 3 only\n        if isinstance(replacement, list):\n            for item in replacement:\n                if isinstance(item, bytes) and not isinstance(item, str):\n                    item = item.decode(\"utf-8\")  # done on Python 3 only\n                if not contents[-1] == \"/\" and type(item) not in (str, int):\n                    raise GypError(\n                        \"Variable \"\n                        + contents\n                        + \" must expand to a string or list of strings; \"\n                        + \"list contains a \"\n                        + item.__class__.__name__\n                    )\n            # Run through the list and handle variable expansions in it.  Since\n            # the list is guaranteed not to contain dicts, this won't do anything\n            # with conditions sections.\n            ProcessVariablesAndConditionsInList(\n                replacement, phase, variables, build_file\n            )\n        elif type(replacement) not in (str, int):\n            raise GypError(\n                \"Variable \"\n                + contents\n                + \" must expand to a string or list of strings; \"\n                + \"found a \"\n                + replacement.__class__.__name__\n            )\n\n        if expand_to_list:\n            # Expanding in list context.  It's guaranteed that there's only one\n            # replacement to do in |input_str| and that it's this replacement.  See\n            # above.\n            if isinstance(replacement, list):\n                # If it's already a list, make a copy.\n                output = replacement[:]\n            else:\n                # Split it the same way sh would split arguments.\n                output = shlex.split(str(replacement))\n        else:\n            # Expanding in string context.\n            encoded_replacement = \"\"\n            if isinstance(replacement, list):\n                # When expanding a list into string context, turn the list items\n                # into a string in a way that will work with a subprocess call.\n                #\n                # TODO(mark): This isn't completely correct.  This should\n                # call a generator-provided function that observes the\n                # proper list-to-argument quoting rules on a specific\n                # platform instead of just calling the POSIX encoding\n                # routine.\n                encoded_replacement = gyp.common.EncodePOSIXShellList(replacement)\n            else:\n                encoded_replacement = replacement\n\n            output = (\n                output[:replace_start] + str(encoded_replacement) + output[replace_end:]\n            )\n        # Prepare for the next match iteration.\n        input_str = output\n\n    if output == input:\n        gyp.DebugOutput(\n            gyp.DEBUG_VARIABLES,\n            \"Found only identity matches on %r, avoiding infinite recursion.\",\n            output,\n        )\n    else:\n        # Look for more matches now that we've replaced some, to deal with\n        # expanding local variables (variables defined in the same\n        # variables block as this one).\n        gyp.DebugOutput(gyp.DEBUG_VARIABLES, \"Found output %r, recursing.\", output)\n        if isinstance(output, list):\n            if output and isinstance(output[0], list):\n                # Leave output alone if it's a list of lists.\n                # We don't want such lists to be stringified.\n                pass\n            else:\n                new_output = []\n                for item in output:\n                    new_output.append(\n                        ExpandVariables(item, phase, variables, build_file)\n                    )\n                output = new_output\n        else:\n            output = ExpandVariables(output, phase, variables, build_file)\n\n    # Convert all strings that are canonically-represented integers into integers.\n    if isinstance(output, list):\n        for index, outstr in enumerate(output):\n            if IsStrCanonicalInt(outstr):\n                output[index] = int(outstr)\n    elif IsStrCanonicalInt(output):\n        output = int(output)\n\n    return output\n\n\n# The same condition is often evaluated over and over again so it\n# makes sense to cache as much as possible between evaluations.\ncached_conditions_asts = {}\n\n\ndef EvalCondition(condition, conditions_key, phase, variables, build_file):\n    \"\"\"Returns the dict that should be used or None if the result was\n    that nothing should be used.\"\"\"\n    if not isinstance(condition, list):\n        raise GypError(conditions_key + \" must be a list\")\n    if len(condition) < 2:\n        # It's possible that condition[0] won't work in which case this\n        # attempt will raise its own IndexError.  That's probably fine.\n        raise GypError(\n            conditions_key\n            + \" \"\n            + condition[0]\n            + \" must be at least length 2, not \"\n            + str(len(condition))\n        )\n\n    i = 0\n    result = None\n    while i < len(condition):\n        cond_expr = condition[i]\n        true_dict = condition[i + 1]\n        if not isinstance(true_dict, dict):\n            raise GypError(\n                f\"{conditions_key} {cond_expr} must be followed by a dictionary, \"\n                f\"not {type(true_dict)}\"\n            )\n        if len(condition) > i + 2 and isinstance(condition[i + 2], dict):\n            false_dict = condition[i + 2]\n            i = i + 3\n            if i != len(condition):\n                raise GypError(\n                    f\"{conditions_key} {cond_expr} has \"\n                    f\"{len(condition) - i} unexpected trailing items\"\n                )\n        else:\n            false_dict = None\n            i = i + 2\n        if result is None:\n            result = EvalSingleCondition(\n                cond_expr, true_dict, false_dict, phase, variables, build_file\n            )\n\n    return result\n\n\ndef EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, build_file):\n    \"\"\"Returns true_dict if cond_expr evaluates to true, and false_dict\n    otherwise.\"\"\"\n    # Do expansions on the condition itself.  Since the condition can naturally\n    # contain variable references without needing to resort to GYP expansion\n    # syntax, this is of dubious value for variables, but someone might want to\n    # use a command expansion directly inside a condition.\n    cond_expr_expanded = ExpandVariables(cond_expr, phase, variables, build_file)\n    if type(cond_expr_expanded) not in (str, int):\n        raise ValueError(\n            \"Variable expansion in this context permits str and int \"\n            + \"only, found \"\n            + cond_expr_expanded.__class__.__name__\n        )\n\n    try:\n        if cond_expr_expanded in cached_conditions_asts:\n            ast_code = cached_conditions_asts[cond_expr_expanded]\n        else:\n            ast_code = compile(cond_expr_expanded, \"<string>\", \"eval\")\n            cached_conditions_asts[cond_expr_expanded] = ast_code\n        env = {\"__builtins__\": {}, \"v\": Version}\n        if eval(ast_code, env, variables):\n            return true_dict\n        return false_dict\n    except SyntaxError as e:\n        syntax_error = SyntaxError(\n            \"%s while evaluating condition '%s' in %s \"\n            \"at character %d.\" % (str(e.args[0]), e.text, build_file, e.offset),\n            e.filename,\n            e.lineno,\n            e.offset,\n            e.text,\n        )\n        raise syntax_error\n    except NameError as e:\n        gyp.common.ExceptionAppend(\n            e,\n            f\"while evaluating condition '{cond_expr_expanded}' in {build_file}\",\n        )\n        raise GypError(e)\n\n\ndef ProcessConditionsInDict(the_dict, phase, variables, build_file):\n    # Process a 'conditions' or 'target_conditions' section in the_dict,\n    # depending on phase.\n    # early -> conditions\n    # late -> target_conditions\n    # latelate -> no conditions\n    #\n    # Each item in a conditions list consists of cond_expr, a string expression\n    # evaluated as the condition, and true_dict, a dict that will be merged into\n    # the_dict if cond_expr evaluates to true.  Optionally, a third item,\n    # false_dict, may be present.  false_dict is merged into the_dict if\n    # cond_expr evaluates to false.\n    #\n    # Any dict merged into the_dict will be recursively processed for nested\n    # conditionals and other expansions, also according to phase, immediately\n    # prior to being merged.\n\n    if phase == PHASE_EARLY:\n        conditions_key = \"conditions\"\n    elif phase == PHASE_LATE:\n        conditions_key = \"target_conditions\"\n    elif phase == PHASE_LATELATE:\n        return\n    else:\n        assert False\n\n    if conditions_key not in the_dict:\n        return\n\n    conditions_list = the_dict[conditions_key]\n    # Unhook the conditions list, it's no longer needed.\n    del the_dict[conditions_key]\n\n    for condition in conditions_list:\n        merge_dict = EvalCondition(\n            condition, conditions_key, phase, variables, build_file\n        )\n\n        if merge_dict is not None:\n            # Expand variables and nested conditionals in the merge_dict before\n            # merging it.\n            ProcessVariablesAndConditionsInDict(\n                merge_dict, phase, variables, build_file\n            )\n\n            MergeDicts(the_dict, merge_dict, build_file, build_file)\n\n\ndef LoadAutomaticVariablesFromDict(variables, the_dict):\n    # Any keys with plain string values in the_dict become automatic variables.\n    # The variable name is the key name with a \"_\" character prepended.\n    for key, value in the_dict.items():\n        if type(value) in (str, int, list):\n            variables[\"_\" + key] = value\n\n\ndef LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key):\n    # Any keys in the_dict's \"variables\" dict, if it has one, becomes a\n    # variable.  The variable name is the key name in the \"variables\" dict.\n    # Variables that end with the % character are set only if they are unset in\n    # the variables dict.  the_dict_key is the name of the key that accesses\n    # the_dict in the_dict's parent dict.  If the_dict's parent is not a dict\n    # (it could be a list or it could be parentless because it is a root dict),\n    # the_dict_key will be None.\n    for key, value in the_dict.get(\"variables\", {}).items():\n        if type(value) not in (str, int, list):\n            continue\n\n        if key.endswith(\"%\"):\n            variable_name = key[:-1]\n            if variable_name in variables:\n                # If the variable is already set, don't set it.\n                continue\n            if the_dict_key == \"variables\" and variable_name in the_dict:\n                # If the variable is set without a % in the_dict, and the_dict is a\n                # variables dict (making |variables| a variables sub-dict of a\n                # variables dict), use the_dict's definition.\n                value = the_dict[variable_name]\n        else:\n            variable_name = key\n\n        variables[variable_name] = value\n\n\ndef ProcessVariablesAndConditionsInDict(\n    the_dict, phase, variables_in, build_file, the_dict_key=None\n):\n    \"\"\"Handle all variable and command expansion and conditional evaluation.\n\n    This function is the public entry point for all variable expansions and\n    conditional evaluations.  The variables_in dictionary will not be modified\n    by this function.\n    \"\"\"\n\n    # Make a copy of the variables_in dict that can be modified during the\n    # loading of automatics and the loading of the variables dict.\n    variables = variables_in.copy()\n    LoadAutomaticVariablesFromDict(variables, the_dict)\n\n    if \"variables\" in the_dict:\n        # Make sure all the local variables are added to the variables\n        # list before we process them so that you can reference one\n        # variable from another.  They will be fully expanded by recursion\n        # in ExpandVariables.\n        for key, value in the_dict[\"variables\"].items():\n            variables[key] = value\n\n        # Handle the associated variables dict first, so that any variable\n        # references within can be resolved prior to using them as variables.\n        # Pass a copy of the variables dict to avoid having it be tainted.\n        # Otherwise, it would have extra automatics added for everything that\n        # should just be an ordinary variable in this scope.\n        ProcessVariablesAndConditionsInDict(\n            the_dict[\"variables\"], phase, variables, build_file, \"variables\"\n        )\n\n    LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key)\n\n    for key, value in the_dict.items():\n        # Skip \"variables\", which was already processed if present.\n        if key != \"variables\" and isinstance(value, str):\n            expanded = ExpandVariables(value, phase, variables, build_file)\n            if type(expanded) not in (str, int):\n                raise ValueError(\n                    \"Variable expansion in this context permits str and int \"\n                    + \"only, found \"\n                    + expanded.__class__.__name__\n                    + \" for \"\n                    + key\n                )\n            the_dict[key] = expanded\n\n    # Variable expansion may have resulted in changes to automatics.  Reload.\n    # TODO(mark): Optimization: only reload if no changes were made.\n    variables = variables_in.copy()\n    LoadAutomaticVariablesFromDict(variables, the_dict)\n    LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key)\n\n    # Process conditions in this dict.  This is done after variable expansion\n    # so that conditions may take advantage of expanded variables.  For example,\n    # if the_dict contains:\n    #   {'type':       '<(library_type)',\n    #    'conditions': [['_type==\"static_library\"', { ... }]]},\n    # _type, as used in the condition, will only be set to the value of\n    # library_type if variable expansion is performed before condition\n    # processing.  However, condition processing should occur prior to recursion\n    # so that variables (both automatic and \"variables\" dict type) may be\n    # adjusted by conditions sections, merged into the_dict, and have the\n    # intended impact on contained dicts.\n    #\n    # This arrangement means that a \"conditions\" section containing a \"variables\"\n    # section will only have those variables effective in subdicts, not in\n    # the_dict.  The workaround is to put a \"conditions\" section within a\n    # \"variables\" section.  For example:\n    #   {'conditions': [['os==\"mac\"', {'variables': {'define': 'IS_MAC'}}]],\n    #    'defines':    ['<(define)'],\n    #    'my_subdict': {'defines': ['<(define)']}},\n    # will not result in \"IS_MAC\" being appended to the \"defines\" list in the\n    # current scope but would result in it being appended to the \"defines\" list\n    # within \"my_subdict\".  By comparison:\n    #   {'variables': {'conditions': [['os==\"mac\"', {'define': 'IS_MAC'}]]},\n    #    'defines':    ['<(define)'],\n    #    'my_subdict': {'defines': ['<(define)']}},\n    # will append \"IS_MAC\" to both \"defines\" lists.\n\n    # Evaluate conditions sections, allowing variable expansions within them\n    # as well as nested conditionals.  This will process a 'conditions' or\n    # 'target_conditions' section, perform appropriate merging and recursive\n    # conditional and variable processing, and then remove the conditions section\n    # from the_dict if it is present.\n    ProcessConditionsInDict(the_dict, phase, variables, build_file)\n\n    # Conditional processing may have resulted in changes to automatics or the\n    # variables dict.  Reload.\n    variables = variables_in.copy()\n    LoadAutomaticVariablesFromDict(variables, the_dict)\n    LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key)\n\n    # Recurse into child dicts, or process child lists which may result in\n    # further recursion into descendant dicts.\n    for key, value in the_dict.items():\n        # Skip \"variables\" and string values, which were already processed if\n        # present.\n        if key == \"variables\" or isinstance(value, str):\n            continue\n        if isinstance(value, dict):\n            # Pass a copy of the variables dict so that subdicts can't influence\n            # parents.\n            ProcessVariablesAndConditionsInDict(\n                value, phase, variables, build_file, key\n            )\n        elif isinstance(value, list):\n            # The list itself can't influence the variables dict, and\n            # ProcessVariablesAndConditionsInList will make copies of the variables\n            # dict if it needs to pass it to something that can influence it.  No\n            # copy is necessary here.\n            ProcessVariablesAndConditionsInList(value, phase, variables, build_file)\n        elif not isinstance(value, int):\n            raise TypeError(\"Unknown type \" + value.__class__.__name__ + \" for \" + key)\n\n\ndef ProcessVariablesAndConditionsInList(the_list, phase, variables, build_file):\n    # Iterate using an index so that new values can be assigned into the_list.\n    index = 0\n    while index < len(the_list):\n        item = the_list[index]\n        if isinstance(item, dict):\n            # Make a copy of the variables dict so that it won't influence anything\n            # outside of its own scope.\n            ProcessVariablesAndConditionsInDict(item, phase, variables, build_file)\n        elif isinstance(item, list):\n            ProcessVariablesAndConditionsInList(item, phase, variables, build_file)\n        elif isinstance(item, str):\n            expanded = ExpandVariables(item, phase, variables, build_file)\n            if type(expanded) in (str, int):\n                the_list[index] = expanded\n            elif isinstance(expanded, list):\n                the_list[index : index + 1] = expanded\n                index += len(expanded)\n\n                # index now identifies the next item to examine.  Continue right now\n                # without falling into the index increment below.\n                continue\n            else:\n                raise ValueError(\n                    \"Variable expansion in this context permits strings and \"\n                    + \"lists only, found \"\n                    + expanded.__class__.__name__\n                    + \" at \"\n                    + index\n                )\n        elif not isinstance(item, int):\n            raise TypeError(\n                \"Unknown type \" + item.__class__.__name__ + \" at index \" + index\n            )\n        index = index + 1\n\n\ndef BuildTargetsDict(data):\n    \"\"\"Builds a dict mapping fully-qualified target names to their target dicts.\n\n    |data| is a dict mapping loaded build files by pathname relative to the\n    current directory.  Values in |data| are build file contents.  For each\n    |data| value with a \"targets\" key, the value of the \"targets\" key is taken\n    as a list containing target dicts.  Each target's fully-qualified name is\n    constructed from the pathname of the build file (|data| key) and its\n    \"target_name\" property.  These fully-qualified names are used as the keys\n    in the returned dict.  These keys provide access to the target dicts,\n    the dicts in the \"targets\" lists.\n    \"\"\"\n\n    targets = {}\n    for build_file in data[\"target_build_files\"]:\n        for target in data[build_file].get(\"targets\", []):\n            target_name = gyp.common.QualifiedTarget(\n                build_file, target[\"target_name\"], target[\"toolset\"]\n            )\n            if target_name in targets:\n                raise GypError(\"Duplicate target definitions for \" + target_name)\n            targets[target_name] = target\n\n    return targets\n\n\ndef QualifyDependencies(targets):\n    \"\"\"Make dependency links fully-qualified relative to the current directory.\n\n    |targets| is a dict mapping fully-qualified target names to their target\n    dicts.  For each target in this dict, keys known to contain dependency\n    links are examined, and any dependencies referenced will be rewritten\n    so that they are fully-qualified and relative to the current directory.\n    All rewritten dependencies are suitable for use as keys to |targets| or a\n    similar dict.\n    \"\"\"\n\n    all_dependency_sections = [\n        dep + op for dep in dependency_sections for op in (\"\", \"!\", \"/\")\n    ]\n\n    for target, target_dict in targets.items():\n        target_build_file = gyp.common.BuildFile(target)\n        toolset = target_dict[\"toolset\"]\n        for dependency_key in all_dependency_sections:\n            dependencies = target_dict.get(dependency_key, [])\n            for index, dep in enumerate(dependencies):\n                dep_file, dep_target, dep_toolset = gyp.common.ResolveTarget(\n                    target_build_file, dep, toolset\n                )\n                if not multiple_toolsets:\n                    # Ignore toolset specification in the dependency if it is specified.\n                    dep_toolset = toolset\n                dependency = gyp.common.QualifiedTarget(\n                    dep_file, dep_target, dep_toolset\n                )\n                dependencies[index] = dependency\n\n                # Make sure anything appearing in a list other than \"dependencies\" also\n                # appears in the \"dependencies\" list.\n                if (\n                    dependency_key != \"dependencies\"\n                    and dependency not in target_dict[\"dependencies\"]\n                ):\n                    raise GypError(\n                        \"Found \"\n                        + dependency\n                        + \" in \"\n                        + dependency_key\n                        + \" of \"\n                        + target\n                        + \", but not in dependencies\"\n                    )\n\n\ndef ExpandWildcardDependencies(targets, data):\n    \"\"\"Expands dependencies specified as build_file:*.\n\n    For each target in |targets|, examines sections containing links to other\n    targets.  If any such section contains a link of the form build_file:*, it\n    is taken as a wildcard link, and is expanded to list each target in\n    build_file.  The |data| dict provides access to build file dicts.\n\n    Any target that does not wish to be included by wildcard can provide an\n    optional \"suppress_wildcard\" key in its target dict.  When present and\n    true, a wildcard dependency link will not include such targets.\n\n    All dependency names, including the keys to |targets| and the values in each\n    dependency list, must be qualified when this function is called.\n    \"\"\"\n\n    for target, target_dict in targets.items():\n        target_build_file = gyp.common.BuildFile(target)\n        for dependency_key in dependency_sections:\n            dependencies = target_dict.get(dependency_key, [])\n\n            # Loop this way instead of \"for dependency in\" or \"for index in range\"\n            # because the dependencies list will be modified within the loop body.\n            index = 0\n            while index < len(dependencies):\n                (\n                    dependency_build_file,\n                    dependency_target,\n                    dependency_toolset,\n                ) = gyp.common.ParseQualifiedTarget(dependencies[index])\n                if dependency_target != \"*\" and dependency_toolset != \"*\":\n                    # Not a wildcard.  Keep it moving.\n                    index = index + 1\n                    continue\n\n                if dependency_build_file == target_build_file:\n                    # It's an error for a target to depend on all other targets in\n                    # the same file, because a target cannot depend on itself.\n                    raise GypError(\n                        \"Found wildcard in \"\n                        + dependency_key\n                        + \" of \"\n                        + target\n                        + \" referring to same build file\"\n                    )\n\n                # Take the wildcard out and adjust the index so that the next\n                # dependency in the list will be processed the next time through the\n                # loop.\n                del dependencies[index]\n                index = index - 1\n\n                # Loop through the targets in the other build file, adding them to\n                # this target's list of dependencies in place of the removed\n                # wildcard.\n                dependency_target_dicts = data[dependency_build_file][\"targets\"]\n                for dependency_target_dict in dependency_target_dicts:\n                    if int(dependency_target_dict.get(\"suppress_wildcard\", False)):\n                        continue\n                    dependency_target_name = dependency_target_dict[\"target_name\"]\n                    if dependency_target not in {\"*\", dependency_target_name}:\n                        continue\n                    dependency_target_toolset = dependency_target_dict[\"toolset\"]\n                    if dependency_toolset not in {\"*\", dependency_target_toolset}:\n                        continue\n                    dependency = gyp.common.QualifiedTarget(\n                        dependency_build_file,\n                        dependency_target_name,\n                        dependency_target_toolset,\n                    )\n                    index = index + 1\n                    dependencies.insert(index, dependency)\n\n                index = index + 1\n\n\ndef Unify(items):\n    \"\"\"Removes duplicate elements from items, keeping the first element.\"\"\"\n    seen = {}\n    return [seen.setdefault(e, e) for e in items if e not in seen]\n\n\ndef RemoveDuplicateDependencies(targets):\n    \"\"\"Makes sure every dependency appears only once in all targets's dependency\n    lists.\"\"\"\n    for target_name, target_dict in targets.items():\n        for dependency_key in dependency_sections:\n            dependencies = target_dict.get(dependency_key, [])\n            if dependencies:\n                target_dict[dependency_key] = Unify(dependencies)\n\n\ndef Filter(items, item):\n    \"\"\"Removes item from items.\"\"\"\n    res = {}\n    return [res.setdefault(e, e) for e in items if e != item]\n\n\ndef RemoveSelfDependencies(targets):\n    \"\"\"Remove self dependencies from targets that have the prune_self_dependency\n    variable set.\"\"\"\n    for target_name, target_dict in targets.items():\n        for dependency_key in dependency_sections:\n            dependencies = target_dict.get(dependency_key, [])\n            if dependencies:\n                for t in dependencies:\n                    if t == target_name and (\n                        targets[t].get(\"variables\", {}).get(\"prune_self_dependency\", 0)\n                    ):\n                        target_dict[dependency_key] = Filter(dependencies, target_name)\n\n\ndef RemoveLinkDependenciesFromNoneTargets(targets):\n    \"\"\"Remove dependencies having the 'link_dependency' attribute from the 'none'\n    targets.\"\"\"\n    for target_name, target_dict in targets.items():\n        for dependency_key in dependency_sections:\n            dependencies = target_dict.get(dependency_key, [])\n            if dependencies:\n                for t in dependencies:\n                    if target_dict.get(\"type\", None) == \"none\":\n                        if targets[t].get(\"variables\", {}).get(\"link_dependency\", 0):\n                            target_dict[dependency_key] = Filter(\n                                target_dict[dependency_key], t\n                            )\n\n\nclass DependencyGraphNode:\n    \"\"\"\n\n    Attributes:\n      ref: A reference to an object that this DependencyGraphNode represents.\n      dependencies: List of DependencyGraphNodes on which this one depends.\n      dependents: List of DependencyGraphNodes that depend on this one.\n    \"\"\"\n\n    class CircularException(GypError):\n        pass\n\n    def __init__(self, ref):\n        self.ref = ref\n        self.dependencies = []\n        self.dependents = []\n\n    def __repr__(self):\n        return \"<DependencyGraphNode: %r>\" % self.ref\n\n    def FlattenToList(self):\n        # flat_list is the sorted list of dependencies - actually, the list items\n        # are the \"ref\" attributes of DependencyGraphNodes.  Every target will\n        # appear in flat_list after all of its dependencies, and before all of its\n        # dependents.\n        flat_list = OrderedSet()\n\n        def ExtractNodeRef(node):\n            \"\"\"Extracts the object that the node represents from the given node.\"\"\"\n            return node.ref\n\n        # in_degree_zeros is the list of DependencyGraphNodes that have no\n        # dependencies not in flat_list.  Initially, it is a copy of the children\n        # of this node, because when the graph was built, nodes with no\n        # dependencies were made implicit dependents of the root node.\n        in_degree_zeros = sorted(self.dependents[:], key=ExtractNodeRef)\n\n        while in_degree_zeros:\n            # Nodes in in_degree_zeros have no dependencies not in flat_list, so they\n            # can be appended to flat_list.  Take these nodes out of in_degree_zeros\n            # as work progresses, so that the next node to process from the list can\n            # always be accessed at a consistent position.\n            node = in_degree_zeros.pop()\n            flat_list.add(node.ref)\n\n            # Look at dependents of the node just added to flat_list.  Some of them\n            # may now belong in in_degree_zeros.\n            for node_dependent in sorted(node.dependents, key=ExtractNodeRef):\n                is_in_degree_zero = True\n                # TODO: We want to check through the\n                # node_dependent.dependencies list but if it's long and we\n                # always start at the beginning, then we get O(n^2) behaviour.\n                for node_dependent_dependency in sorted(\n                    node_dependent.dependencies, key=ExtractNodeRef\n                ):\n                    if node_dependent_dependency.ref not in flat_list:\n                        # The dependent one or more dependencies not in flat_list.\n                        # There will be more chances to add it to flat_list\n                        # when examining it again as a dependent of those other\n                        # dependencies, provided that there are no cycles.\n                        is_in_degree_zero = False\n                        break\n\n                if is_in_degree_zero:\n                    # All of the dependent's dependencies are already in flat_list.  Add\n                    # it to in_degree_zeros where it will be processed in a future\n                    # iteration of the outer loop.\n                    in_degree_zeros += [node_dependent]\n\n        return list(flat_list)\n\n    def FindCycles(self):\n        \"\"\"\n        Returns a list of cycles in the graph, where each cycle is its own list.\n        \"\"\"\n        results = []\n        visited = set()\n\n        def Visit(node, path):\n            for child in node.dependents:\n                if child in path:\n                    results.append([child] + path[: path.index(child) + 1])\n                elif child not in visited:\n                    visited.add(child)\n                    Visit(child, [child] + path)\n\n        visited.add(self)\n        Visit(self, [self])\n\n        return results\n\n    def DirectDependencies(self, dependencies=None):\n        \"\"\"Returns a list of just direct dependencies.\"\"\"\n        if dependencies is None:\n            dependencies = []\n\n        for dependency in self.dependencies:\n            # Check for None, corresponding to the root node.\n            if dependency.ref and dependency.ref not in dependencies:\n                dependencies.append(dependency.ref)\n\n        return dependencies\n\n    def _AddImportedDependencies(self, targets, dependencies=None):\n        \"\"\"Given a list of direct dependencies, adds indirect dependencies that\n        other dependencies have declared to export their settings.\n\n        This method does not operate on self.  Rather, it operates on the list\n        of dependencies in the |dependencies| argument.  For each dependency in\n        that list, if any declares that it exports the settings of one of its\n        own dependencies, those dependencies whose settings are \"passed through\"\n        are added to the list.  As new items are added to the list, they too will\n        be processed, so it is possible to import settings through multiple levels\n        of dependencies.\n\n        This method is not terribly useful on its own, it depends on being\n        \"primed\" with a list of direct dependencies such as one provided by\n        DirectDependencies.  DirectAndImportedDependencies is intended to be the\n        public entry point.\n        \"\"\"\n\n        if dependencies is None:\n            dependencies = []\n\n        index = 0\n        while index < len(dependencies):\n            dependency = dependencies[index]\n            dependency_dict = targets[dependency]\n            # Add any dependencies whose settings should be imported to the list\n            # if not already present.  Newly-added items will be checked for\n            # their own imports when the list iteration reaches them.\n            # Rather than simply appending new items, insert them after the\n            # dependency that exported them.  This is done to more closely match\n            # the depth-first method used by DeepDependencies.\n            add_index = 1\n            for imported_dependency in dependency_dict.get(\n                \"export_dependent_settings\", []\n            ):\n                if imported_dependency not in dependencies:\n                    dependencies.insert(index + add_index, imported_dependency)\n                    add_index = add_index + 1\n            index = index + 1\n\n        return dependencies\n\n    def DirectAndImportedDependencies(self, targets, dependencies=None):\n        \"\"\"Returns a list of a target's direct dependencies and all indirect\n        dependencies that a dependency has advertised settings should be exported\n        through the dependency for.\n        \"\"\"\n\n        dependencies = self.DirectDependencies(dependencies)\n        return self._AddImportedDependencies(targets, dependencies)\n\n    def DeepDependencies(self, dependencies=None):\n        \"\"\"Returns an OrderedSet of all of a target's dependencies, recursively.\"\"\"\n        if dependencies is None:\n            # Using a list to get ordered output and a set to do fast \"is it\n            # already added\" checks.\n            dependencies = OrderedSet()\n\n        for dependency in self.dependencies:\n            # Check for None, corresponding to the root node.\n            if dependency.ref is None:\n                continue\n            if dependency.ref not in dependencies:\n                dependency.DeepDependencies(dependencies)\n                dependencies.add(dependency.ref)\n\n        return dependencies\n\n    def _LinkDependenciesInternal(\n        self, targets, include_shared_libraries, dependencies=None, initial=True\n    ):\n        \"\"\"Returns an OrderedSet of dependency targets that are linked\n        into this target.\n\n        This function has a split personality, depending on the setting of\n        |initial|.  Outside callers should always leave |initial| at its default\n        setting.\n\n        When adding a target to the list of dependencies, this function will\n        recurse into itself with |initial| set to False, to collect dependencies\n        that are linked into the linkable target for which the list is being built.\n\n        If |include_shared_libraries| is False, the resulting dependencies will not\n        include shared_library targets that are linked into this target.\n        \"\"\"\n        if dependencies is None:\n            # Using a list to get ordered output and a set to do fast \"is it\n            # already added\" checks.\n            dependencies = OrderedSet()\n\n        # Check for None, corresponding to the root node.\n        if self.ref is None:\n            return dependencies\n\n        # It's kind of sucky that |targets| has to be passed into this function,\n        # but that's presently the easiest way to access the target dicts so that\n        # this function can find target types.\n\n        if \"target_name\" not in targets[self.ref]:\n            raise GypError(\"Missing 'target_name' field in target.\")\n\n        if \"type\" not in targets[self.ref]:\n            raise GypError(\n                \"Missing 'type' field in target %s\" % targets[self.ref][\"target_name\"]\n            )\n\n        target_type = targets[self.ref][\"type\"]\n\n        is_linkable = target_type in linkable_types\n\n        if initial and not is_linkable:\n            # If this is the first target being examined and it's not linkable,\n            # return an empty list of link dependencies, because the link\n            # dependencies are intended to apply to the target itself (initial is\n            # True) and this target won't be linked.\n            return dependencies\n\n        # Don't traverse 'none' targets if explicitly excluded.\n        if target_type == \"none\" and not targets[self.ref].get(\n            \"dependencies_traverse\", True\n        ):\n            dependencies.add(self.ref)\n            return dependencies\n\n        # Executables, mac kernel extensions, windows drivers and loadable modules\n        # are already fully and finally linked. Nothing else can be a link\n        # dependency of them, there can only be dependencies in the sense that a\n        # dependent target might run an executable or load the loadable_module.\n        if not initial and target_type in (\n            \"executable\",\n            \"loadable_module\",\n            \"mac_kernel_extension\",\n            \"windows_driver\",\n        ):\n            return dependencies\n\n        # Shared libraries are already fully linked.  They should only be included\n        # in |dependencies| when adjusting static library dependencies (in order to\n        # link against the shared_library's import lib), but should not be included\n        # in |dependencies| when propagating link_settings.\n        # The |include_shared_libraries| flag controls which of these two cases we\n        # are handling.\n        if (\n            not initial\n            and target_type == \"shared_library\"\n            and not include_shared_libraries\n        ):\n            return dependencies\n\n        # The target is linkable, add it to the list of link dependencies.\n        if self.ref not in dependencies:\n            dependencies.add(self.ref)\n            if initial or not is_linkable:\n                # If this is a subsequent target and it's linkable, don't look any\n                # further for linkable dependencies, as they'll already be linked into\n                # this target linkable.  Always look at dependencies of the initial\n                # target, and always look at dependencies of non-linkables.\n                for dependency in self.dependencies:\n                    dependency._LinkDependenciesInternal(\n                        targets, include_shared_libraries, dependencies, False\n                    )\n\n        return dependencies\n\n    def DependenciesForLinkSettings(self, targets):\n        \"\"\"\n        Returns a list of dependency targets whose link_settings should be merged\n        into this target.\n        \"\"\"\n\n        # TODO(sbaig) Currently, chrome depends on the bug that shared libraries'\n        # link_settings are propagated.  So for now, we will allow it, unless the\n        # 'allow_sharedlib_linksettings_propagation' flag is explicitly set to\n        # False.  Once chrome is fixed, we can remove this flag.\n        include_shared_libraries = targets[self.ref].get(\n            \"allow_sharedlib_linksettings_propagation\", True\n        )\n        return self._LinkDependenciesInternal(targets, include_shared_libraries)\n\n    def DependenciesToLinkAgainst(self, targets):\n        \"\"\"\n        Returns a list of dependency targets that are linked into this target.\n        \"\"\"\n        return self._LinkDependenciesInternal(targets, True)\n\n\ndef BuildDependencyList(targets):\n    # Create a DependencyGraphNode for each target.  Put it into a dict for easy\n    # access.\n    dependency_nodes = {}\n    for target, spec in targets.items():\n        if target not in dependency_nodes:\n            dependency_nodes[target] = DependencyGraphNode(target)\n\n    # Set up the dependency links.  Targets that have no dependencies are treated\n    # as dependent on root_node.\n    root_node = DependencyGraphNode(None)\n    for target, spec in targets.items():\n        target_node = dependency_nodes[target]\n        dependencies = spec.get(\"dependencies\")\n        if not dependencies:\n            target_node.dependencies = [root_node]\n            root_node.dependents.append(target_node)\n        else:\n            for dependency in dependencies:\n                dependency_node = dependency_nodes.get(dependency)\n                if not dependency_node:\n                    raise GypError(\n                        \"Dependency '%s' not found while \"\n                        \"trying to load target %s\" % (dependency, target)\n                    )\n                target_node.dependencies.append(dependency_node)\n                dependency_node.dependents.append(target_node)\n\n    flat_list = root_node.FlattenToList()\n\n    # If there's anything left unvisited, there must be a circular dependency\n    # (cycle).\n    if len(flat_list) != len(targets):\n        if not root_node.dependents:\n            # If all targets have dependencies, add the first target as a dependent\n            # of root_node so that the cycle can be discovered from root_node.\n            target = next(iter(targets))\n            target_node = dependency_nodes[target]\n            target_node.dependencies.append(root_node)\n            root_node.dependents.append(target_node)\n\n        cycles = []\n        for cycle in root_node.FindCycles():\n            paths = [node.ref for node in cycle]\n            cycles.append(\"Cycle: %s\" % \" -> \".join(paths))\n        raise DependencyGraphNode.CircularException(\n            \"Cycles in dependency graph detected:\\n\" + \"\\n\".join(cycles)\n        )\n\n    return [dependency_nodes, flat_list]\n\n\ndef VerifyNoGYPFileCircularDependencies(targets):\n    # Create a DependencyGraphNode for each gyp file containing a target.  Put\n    # it into a dict for easy access.\n    dependency_nodes = {}\n    for target in targets:\n        build_file = gyp.common.BuildFile(target)\n        if build_file not in dependency_nodes:\n            dependency_nodes[build_file] = DependencyGraphNode(build_file)\n\n    # Set up the dependency links.\n    for target, spec in targets.items():\n        build_file = gyp.common.BuildFile(target)\n        build_file_node = dependency_nodes[build_file]\n        target_dependencies = spec.get(\"dependencies\", [])\n        for dependency in target_dependencies:\n            try:\n                dependency_build_file = gyp.common.BuildFile(dependency)\n            except GypError as e:\n                gyp.common.ExceptionAppend(\n                    e, \"while computing dependencies of .gyp file %s\" % build_file\n                )\n                raise\n\n            if dependency_build_file == build_file:\n                # A .gyp file is allowed to refer back to itself.\n                continue\n            dependency_node = dependency_nodes.get(dependency_build_file)\n            if not dependency_node:\n                raise GypError(\"Dependency '%s' not found\" % dependency_build_file)\n            if dependency_node not in build_file_node.dependencies:\n                build_file_node.dependencies.append(dependency_node)\n                dependency_node.dependents.append(build_file_node)\n\n    # Files that have no dependencies are treated as dependent on root_node.\n    root_node = DependencyGraphNode(None)\n    for build_file_node in dependency_nodes.values():\n        if len(build_file_node.dependencies) == 0:\n            build_file_node.dependencies.append(root_node)\n            root_node.dependents.append(build_file_node)\n\n    flat_list = root_node.FlattenToList()\n\n    # If there's anything left unvisited, there must be a circular dependency\n    # (cycle).\n    if len(flat_list) != len(dependency_nodes):\n        if not root_node.dependents:\n            # If all files have dependencies, add the first file as a dependent\n            # of root_node so that the cycle can be discovered from root_node.\n            file_node = next(iter(dependency_nodes.values()))\n            file_node.dependencies.append(root_node)\n            root_node.dependents.append(file_node)\n        cycles = []\n        for cycle in root_node.FindCycles():\n            paths = [node.ref for node in cycle]\n            cycles.append(\"Cycle: %s\" % \" -> \".join(paths))\n        raise DependencyGraphNode.CircularException(\n            \"Cycles in .gyp file dependency graph detected:\\n\" + \"\\n\".join(cycles)\n        )\n\n\ndef DoDependentSettings(key, flat_list, targets, dependency_nodes):\n    # key should be one of all_dependent_settings, direct_dependent_settings,\n    # or link_settings.\n\n    for target in flat_list:\n        target_dict = targets[target]\n        build_file = gyp.common.BuildFile(target)\n\n        if key == \"all_dependent_settings\":\n            dependencies = dependency_nodes[target].DeepDependencies()\n        elif key == \"direct_dependent_settings\":\n            dependencies = dependency_nodes[target].DirectAndImportedDependencies(\n                targets\n            )\n        elif key == \"link_settings\":\n            dependencies = dependency_nodes[target].DependenciesForLinkSettings(targets)\n        else:\n            raise GypError(\n                \"DoDependentSettings doesn't know how to determine \"\n                \"dependencies for \" + key\n            )\n\n        for dependency in dependencies:\n            dependency_dict = targets[dependency]\n            if key not in dependency_dict:\n                continue\n            dependency_build_file = gyp.common.BuildFile(dependency)\n            MergeDicts(\n                target_dict, dependency_dict[key], build_file, dependency_build_file\n            )\n\n\ndef AdjustStaticLibraryDependencies(\n    flat_list, targets, dependency_nodes, sort_dependencies\n):\n    # Recompute target \"dependencies\" properties.  For each static library\n    # target, remove \"dependencies\" entries referring to other static libraries,\n    # unless the dependency has the \"hard_dependency\" attribute set.  For each\n    # linkable target, add a \"dependencies\" entry referring to all of the\n    # target's computed list of link dependencies (including static libraries\n    # if no such entry is already present.\n    for target in flat_list:\n        target_dict = targets[target]\n        target_type = target_dict[\"type\"]\n\n        if target_type == \"static_library\":\n            if \"dependencies\" not in target_dict:\n                continue\n\n            target_dict[\"dependencies_original\"] = target_dict.get(\"dependencies\", [])[\n                :\n            ]\n\n            # A static library should not depend on another static library unless\n            # the dependency relationship is \"hard,\" which should only be done when\n            # a dependent relies on some side effect other than just the build\n            # product, like a rule or action output. Further, if a target has a\n            # non-hard dependency, but that dependency exports a hard dependency,\n            # the non-hard dependency can safely be removed, but the exported hard\n            # dependency must be added to the target to keep the same dependency\n            # ordering.\n            dependencies = dependency_nodes[target].DirectAndImportedDependencies(\n                targets\n            )\n            index = 0\n            while index < len(dependencies):\n                dependency = dependencies[index]\n                dependency_dict = targets[dependency]\n\n                # Remove every non-hard static library dependency and remove every\n                # non-static library dependency that isn't a direct dependency.\n                if (\n                    dependency_dict[\"type\"] == \"static_library\"\n                    and not dependency_dict.get(\"hard_dependency\", False)\n                ) or (\n                    dependency_dict[\"type\"] != \"static_library\"\n                    and dependency not in target_dict[\"dependencies\"]\n                ):\n                    # Take the dependency out of the list, and don't increment index\n                    # because the next dependency to analyze will shift into the index\n                    # formerly occupied by the one being removed.\n                    del dependencies[index]\n                else:\n                    index = index + 1\n\n            # Update the dependencies. If the dependencies list is empty, it's not\n            # needed, so unhook it.\n            if len(dependencies) > 0:\n                target_dict[\"dependencies\"] = dependencies\n            else:\n                del target_dict[\"dependencies\"]\n\n        elif target_type in linkable_types:\n            # Get a list of dependency targets that should be linked into this\n            # target.  Add them to the dependencies list if they're not already\n            # present.\n\n            link_dependencies = dependency_nodes[target].DependenciesToLinkAgainst(\n                targets\n            )\n            for dependency in link_dependencies:\n                if dependency == target:\n                    continue\n                if \"dependencies\" not in target_dict:\n                    target_dict[\"dependencies\"] = []\n                if dependency not in target_dict[\"dependencies\"]:\n                    target_dict[\"dependencies\"].append(dependency)\n            # Sort the dependencies list in the order from dependents to dependencies.\n            # e.g. If A and B depend on C and C depends on D, sort them in A, B, C, D.\n            # Note: flat_list is already sorted in the order from dependencies to\n            # dependents.\n            if sort_dependencies and \"dependencies\" in target_dict:\n                target_dict[\"dependencies\"] = [\n                    dep\n                    for dep in reversed(flat_list)\n                    if dep in target_dict[\"dependencies\"]\n                ]\n\n\n# Initialize this here to speed up MakePathRelative.\nexception_re = re.compile(r\"\"\"[\"']?[-/$<>^]\"\"\")\n\n\ndef MakePathRelative(to_file, fro_file, item):\n    # If item is a relative path, it's relative to the build file dict that it's\n    # coming from.  Fix it up to make it relative to the build file dict that\n    # it's going into.\n    # Exception: any |item| that begins with these special characters is\n    # returned without modification.\n    #   /   Used when a path is already absolute (shortcut optimization;\n    #       such paths would be returned as absolute anyway)\n    #   $   Used for build environment variables\n    #   -   Used for some build environment flags (such as -lapr-1 in a\n    #       \"libraries\" section)\n    #   <   Used for our own variable and command expansions (see ExpandVariables)\n    #   >   Used for our own variable and command expansions (see ExpandVariables)\n    #   ^   Used for our own variable and command expansions (see ExpandVariables)\n    #\n    #   \"/' Used when a value is quoted.  If these are present, then we\n    #       check the second character instead.\n    #\n    if to_file == fro_file or exception_re.match(item):\n        return item\n    else:\n        # TODO(dglazkov) The backslash/forward-slash replacement at the end is a\n        # temporary measure. This should really be addressed by keeping all paths\n        # in POSIX until actual project generation.\n        ret = os.path.normpath(\n            os.path.join(\n                gyp.common.RelativePath(\n                    os.path.dirname(fro_file), os.path.dirname(to_file)\n                ),\n                item,\n            )\n        ).replace(\"\\\\\", \"/\")\n        if item.endswith(\"/\"):\n            ret += \"/\"\n        return ret\n\n\ndef MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True):\n    # Python documentation recommends objects which do not support hash\n    # set this value to None. Python library objects follow this rule.\n    def is_hashable(val):\n        return val.__hash__\n\n    # If x is hashable, returns whether x is in s. Else returns whether x is in items.\n    def is_in_set_or_list(x, s, items):\n        if is_hashable(x):\n            return x in s\n        return x in items\n\n    prepend_index = 0\n\n    # Make membership testing of hashables in |to| (in particular, strings)\n    # faster.\n    hashable_to_set = {x for x in to if is_hashable(x)}\n    for item in fro:\n        singleton = False\n        if type(item) in (str, int):\n            # The cheap and easy case.\n            to_item = MakePathRelative(to_file, fro_file, item) if is_paths else item\n\n            if not (isinstance(item, str) and item.startswith(\"-\")):\n                # Any string that doesn't begin with a \"-\" is a singleton - it can\n                # only appear once in a list, to be enforced by the list merge append\n                # or prepend.\n                singleton = True\n        elif isinstance(item, dict):\n            # Make a copy of the dictionary, continuing to look for paths to fix.\n            # The other intelligent aspects of merge processing won't apply because\n            # item is being merged into an empty dict.\n            to_item = {}\n            MergeDicts(to_item, item, to_file, fro_file)\n        elif isinstance(item, list):\n            # Recurse, making a copy of the list.  If the list contains any\n            # descendant dicts, path fixing will occur.  Note that here, custom\n            # values for is_paths and append are dropped; those are only to be\n            # applied to |to| and |fro|, not sublists of |fro|.  append shouldn't\n            # matter anyway because the new |to_item| list is empty.\n            to_item = []\n            MergeLists(to_item, item, to_file, fro_file)\n        else:\n            raise TypeError(\n                \"Attempt to merge list item of unsupported type \"\n                + item.__class__.__name__\n            )\n\n        if append:\n            # If appending a singleton that's already in the list, don't append.\n            # This ensures that the earliest occurrence of the item will stay put.\n            if not singleton or not is_in_set_or_list(to_item, hashable_to_set, to):\n                to.append(to_item)\n                if is_hashable(to_item):\n                    hashable_to_set.add(to_item)\n        else:\n            # If prepending a singleton that's already in the list, remove the\n            # existing instance and proceed with the prepend.  This ensures that the\n            # item appears at the earliest possible position in the list.\n            while singleton and to_item in to:\n                to.remove(to_item)\n\n            # Don't just insert everything at index 0.  That would prepend the new\n            # items to the list in reverse order, which would be an unwelcome\n            # surprise.\n            to.insert(prepend_index, to_item)\n            if is_hashable(to_item):\n                hashable_to_set.add(to_item)\n            prepend_index = prepend_index + 1\n\n\ndef MergeDicts(to, fro, to_file, fro_file):\n    # I wanted to name the parameter \"from\" but it's a Python keyword...\n    for k, v in fro.items():\n        # It would be nice to do \"if not k in to: to[k] = v\" but that wouldn't give\n        # copy semantics.  Something else may want to merge from the |fro| dict\n        # later, and having the same dict ref pointed to twice in the tree isn't\n        # what anyone wants considering that the dicts may subsequently be\n        # modified.\n        if k in to:\n            bad_merge = False\n            if type(v) in (str, int):\n                if type(to[k]) not in (str, int):\n                    bad_merge = True\n            elif not isinstance(v, type(to[k])):\n                bad_merge = True\n\n            if bad_merge:\n                raise TypeError(\n                    \"Attempt to merge dict value of type \"\n                    + v.__class__.__name__\n                    + \" into incompatible type \"\n                    + to[k].__class__.__name__\n                    + \" for key \"\n                    + k\n                )\n        if type(v) in (str, int):\n            # Overwrite the existing value, if any.  Cheap and easy.\n            is_path = IsPathSection(k)\n            if is_path:\n                to[k] = MakePathRelative(to_file, fro_file, v)\n            else:\n                to[k] = v\n        elif isinstance(v, dict):\n            # Recurse, guaranteeing copies will be made of objects that require it.\n            if k not in to:\n                to[k] = {}\n            MergeDicts(to[k], v, to_file, fro_file)\n        elif isinstance(v, list):\n            # Lists in dicts can be merged with different policies, depending on\n            # how the key in the \"from\" dict (k, the from-key) is written.\n            #\n            # If the from-key has          ...the to-list will have this action\n            # this character appended:...     applied when receiving the from-list:\n            #                           =  replace\n            #                           +  prepend\n            #                           ?  set, only if to-list does not yet exist\n            #                      (none)  append\n            #\n            # This logic is list-specific, but since it relies on the associated\n            # dict key, it's checked in this dict-oriented function.\n            ext = k[-1]\n            append = True\n            if ext == \"=\":\n                list_base = k[:-1]\n                lists_incompatible = [list_base, list_base + \"?\"]\n                to[list_base] = []\n            elif ext == \"+\":\n                list_base = k[:-1]\n                lists_incompatible = [list_base + \"=\", list_base + \"?\"]\n                append = False\n            elif ext == \"?\":\n                list_base = k[:-1]\n                lists_incompatible = [list_base, list_base + \"=\", list_base + \"+\"]\n            else:\n                list_base = k\n                lists_incompatible = [list_base + \"=\", list_base + \"?\"]\n\n            # Some combinations of merge policies appearing together are meaningless.\n            # It's stupid to replace and append simultaneously, for example.  Append\n            # and prepend are the only policies that can coexist.\n            for list_incompatible in lists_incompatible:\n                if list_incompatible in fro:\n                    raise GypError(\n                        \"Incompatible list policies \" + k + \" and \" + list_incompatible\n                    )\n\n            if list_base in to:\n                if ext == \"?\":\n                    # If the key ends in \"?\", the list will only be merged if it doesn't\n                    # already exist.\n                    continue\n                elif not isinstance(to[list_base], list):\n                    # This may not have been checked above if merging in a list with an\n                    # extension character.\n                    raise TypeError(\n                        \"Attempt to merge dict value of type \"\n                        + v.__class__.__name__\n                        + \" into incompatible type \"\n                        + to[list_base].__class__.__name__\n                        + \" for key \"\n                        + list_base\n                        + \"(\"\n                        + k\n                        + \")\"\n                    )\n            else:\n                to[list_base] = []\n\n            # Call MergeLists, which will make copies of objects that require it.\n            # MergeLists can recurse back into MergeDicts, although this will be\n            # to make copies of dicts (with paths fixed), there will be no\n            # subsequent dict \"merging\" once entering a list because lists are\n            # always replaced, appended to, or prepended to.\n            is_paths = IsPathSection(list_base)\n            MergeLists(to[list_base], v, to_file, fro_file, is_paths, append)\n        else:\n            raise TypeError(\n                \"Attempt to merge dict value of unsupported type \"\n                + v.__class__.__name__\n                + \" for key \"\n                + k\n            )\n\n\ndef MergeConfigWithInheritance(\n    new_configuration_dict, build_file, target_dict, configuration, visited\n):\n    # Skip if previously visited.\n    if configuration in visited:\n        return\n\n    # Look at this configuration.\n    configuration_dict = target_dict[\"configurations\"][configuration]\n\n    # Merge in parents.\n    for parent in configuration_dict.get(\"inherit_from\", []):\n        MergeConfigWithInheritance(\n            new_configuration_dict,\n            build_file,\n            target_dict,\n            parent,\n            visited + [configuration],\n        )\n\n    # Merge it into the new config.\n    MergeDicts(new_configuration_dict, configuration_dict, build_file, build_file)\n\n    # Drop abstract.\n    if \"abstract\" in new_configuration_dict:\n        del new_configuration_dict[\"abstract\"]\n\n\ndef SetUpConfigurations(target, target_dict):\n    # key_suffixes is a list of key suffixes that might appear on key names.\n    # These suffixes are handled in conditional evaluations (for =, +, and ?)\n    # and rules/exclude processing (for ! and /).  Keys with these suffixes\n    # should be treated the same as keys without.\n    key_suffixes = [\"=\", \"+\", \"?\", \"!\", \"/\"]\n\n    build_file = gyp.common.BuildFile(target)\n\n    # Provide a single configuration by default if none exists.\n    # TODO(mark): Signal an error if default_configurations exists but\n    # configurations does not.\n    if \"configurations\" not in target_dict:\n        target_dict[\"configurations\"] = {\"Default\": {}}\n    if \"default_configuration\" not in target_dict:\n        concrete = [\n            i\n            for (i, config) in target_dict[\"configurations\"].items()\n            if not config.get(\"abstract\")\n        ]\n        target_dict[\"default_configuration\"] = sorted(concrete)[0]\n\n    merged_configurations = {}\n    configs = target_dict[\"configurations\"]\n    for configuration, old_configuration_dict in configs.items():\n        # Skip abstract configurations (saves work only).\n        if old_configuration_dict.get(\"abstract\"):\n            continue\n        # Configurations inherit (most) settings from the enclosing target scope.\n        # Get the inheritance relationship right by making a copy of the target\n        # dict.\n        new_configuration_dict = {}\n        for key, target_val in target_dict.items():\n            key_ext = key[-1:]\n            key_base = key[:-1] if key_ext in key_suffixes else key\n            if key_base not in non_configuration_keys:\n                new_configuration_dict[key] = gyp.simple_copy.deepcopy(target_val)\n\n        # Merge in configuration (with all its parents first).\n        MergeConfigWithInheritance(\n            new_configuration_dict, build_file, target_dict, configuration, []\n        )\n\n        merged_configurations[configuration] = new_configuration_dict\n\n    # Put the new configurations back into the target dict as a configuration.\n    for configuration, value in merged_configurations.items():\n        target_dict[\"configurations\"][configuration] = value\n    # Now drop all the abstract ones.\n    configs = target_dict[\"configurations\"]\n    target_dict[\"configurations\"] = {\n        k: v for k, v in configs.items() if not v.get(\"abstract\")\n    }\n\n    # Now that all of the target's configurations have been built, go through\n    # the target dict's keys and remove everything that's been moved into a\n    # \"configurations\" section.\n    delete_keys = []\n    for key in target_dict:\n        key_ext = key[-1:]\n        key_base = key[:-1] if key_ext in key_suffixes else key\n        if key_base not in non_configuration_keys:\n            delete_keys.append(key)\n    for key in delete_keys:\n        del target_dict[key]\n\n    # Check the configurations to see if they contain invalid keys.\n    for configuration in target_dict[\"configurations\"]:\n        configuration_dict = target_dict[\"configurations\"][configuration]\n        for key in configuration_dict:\n            if key in invalid_configuration_keys:\n                raise GypError(\n                    \"%s not allowed in the %s configuration, found in \"\n                    \"target %s\" % (key, configuration, target)\n                )\n\n\ndef ProcessListFiltersInDict(name, the_dict):\n    \"\"\"Process regular expression and exclusion-based filters on lists.\n\n    An exclusion list is in a dict key named with a trailing \"!\", like\n    \"sources!\".  Every item in such a list is removed from the associated\n    main list, which in this example, would be \"sources\".  Removed items are\n    placed into a \"sources_excluded\" list in the dict.\n\n    Regular expression (regex) filters are contained in dict keys named with a\n    trailing \"/\", such as \"sources/\" to operate on the \"sources\" list.  Regex\n    filters in a dict take the form:\n      'sources/': [ ['exclude', '_(linux|mac|win)\\\\.cc$'],\n                    ['include', '_mac\\\\.cc$'] ],\n    The first filter says to exclude all files ending in _linux.cc, _mac.cc, and\n    _win.cc.  The second filter then includes all files ending in _mac.cc that\n    are now or were once in the \"sources\" list.  Items matching an \"exclude\"\n    filter are subject to the same processing as would occur if they were listed\n    by name in an exclusion list (ending in \"!\").  Items matching an \"include\"\n    filter are brought back into the main list if previously excluded by an\n    exclusion list or exclusion regex filter.  Subsequent matching \"exclude\"\n    patterns can still cause items to be excluded after matching an \"include\".\n    \"\"\"\n\n    # Look through the dictionary for any lists whose keys end in \"!\" or \"/\".\n    # These are lists that will be treated as exclude lists and regular\n    # expression-based exclude/include lists.  Collect the lists that are\n    # needed first, looking for the lists that they operate on, and assemble\n    # then into |lists|.  This is done in a separate loop up front, because\n    # the _included and _excluded keys need to be added to the_dict, and that\n    # can't be done while iterating through it.\n\n    lists = []\n    del_lists = []\n    for key, value in the_dict.items():\n        if not key:\n            continue\n        operation = key[-1]\n        if operation not in {\"!\", \"/\"}:\n            continue\n\n        if not isinstance(value, list):\n            raise ValueError(\n                name + \" key \" + key + \" must be list, not \" + value.__class__.__name__\n            )\n\n        list_key = key[:-1]\n        if list_key not in the_dict:\n            # This happens when there's a list like \"sources!\" but no corresponding\n            # \"sources\" list.  Since there's nothing for it to operate on, queue up\n            # the \"sources!\" list for deletion now.\n            del_lists.append(key)\n            continue\n\n        if not isinstance(the_dict[list_key], list):\n            value = the_dict[list_key]\n            raise ValueError(\n                name\n                + \" key \"\n                + list_key\n                + \" must be list, not \"\n                + value.__class__.__name__\n                + \" when applying \"\n                + {\"!\": \"exclusion\", \"/\": \"regex\"}[operation]\n            )\n\n        if list_key not in lists:\n            lists.append(list_key)\n\n    # Delete the lists that are known to be unneeded at this point.\n    for del_list in del_lists:\n        del the_dict[del_list]\n\n    for list_key in lists:\n        the_list = the_dict[list_key]\n\n        # Initialize the list_actions list, which is parallel to the_list.  Each\n        # item in list_actions identifies whether the corresponding item in\n        # the_list should be excluded, unconditionally preserved (included), or\n        # whether no exclusion or inclusion has been applied.  Items for which\n        # no exclusion or inclusion has been applied (yet) have value -1, items\n        # excluded have value 0, and items included have value 1.  Includes and\n        # excludes override previous actions.  All items in list_actions are\n        # initialized to -1 because no excludes or includes have been processed\n        # yet.\n        list_actions = list((-1,) * len(the_list))\n\n        exclude_key = list_key + \"!\"\n        if exclude_key in the_dict:\n            for exclude_item in the_dict[exclude_key]:\n                for index, list_item in enumerate(the_list):\n                    if exclude_item == list_item:\n                        # This item matches the exclude_item, so set its action to 0\n                        # (exclude).\n                        list_actions[index] = 0\n\n            # The \"whatever!\" list is no longer needed, dump it.\n            del the_dict[exclude_key]\n\n        regex_key = list_key + \"/\"\n        if regex_key in the_dict:\n            for regex_item in the_dict[regex_key]:\n                [action, pattern] = regex_item\n                pattern_re = re.compile(pattern)\n\n                if action == \"exclude\":\n                    # This item matches an exclude regex, set its value to 0 (exclude).\n                    action_value = 0\n                elif action == \"include\":\n                    # This item matches an include regex, set its value to 1 (include).\n                    action_value = 1\n                else:\n                    # This is an action that doesn't make any sense.\n                    raise ValueError(\n                        \"Unrecognized action \"\n                        + action\n                        + \" in \"\n                        + name\n                        + \" key \"\n                        + regex_key\n                    )\n\n                for index, list_item in enumerate(the_list):\n                    if list_actions[index] == action_value:\n                        # Even if the regex matches, nothing will change so continue\n                        # (regex searches are expensive).\n                        continue\n                    if pattern_re.search(list_item):\n                        # Regular expression match.\n                        list_actions[index] = action_value\n\n            # The \"whatever/\" list is no longer needed, dump it.\n            del the_dict[regex_key]\n\n        # Add excluded items to the excluded list.\n        #\n        # Note that exclude_key (\"sources!\") is different from excluded_key\n        # (\"sources_excluded\").  The exclude_key list is input and it was already\n        # processed and deleted; the excluded_key list is output and it's about\n        # to be created.\n        excluded_key = list_key + \"_excluded\"\n        if excluded_key in the_dict:\n            raise GypError(\n                name + \" key \" + excluded_key + \" must not be present prior \"\n                \" to applying exclusion/regex filters for \" + list_key\n            )\n\n        excluded_list = []\n\n        # Go backwards through the list_actions list so that as items are deleted,\n        # the indices of items that haven't been seen yet don't shift.  That means\n        # that things need to be prepended to excluded_list to maintain them in the\n        # same order that they existed in the_list.\n        for index in range(len(list_actions) - 1, -1, -1):\n            if list_actions[index] == 0:\n                # Dump anything with action 0 (exclude).  Keep anything with action 1\n                # (include) or -1 (no include or exclude seen for the item).\n                excluded_list.insert(0, the_list[index])\n                del the_list[index]\n\n        # If anything was excluded, put the excluded list into the_dict at\n        # excluded_key.\n        if len(excluded_list) > 0:\n            the_dict[excluded_key] = excluded_list\n\n    # Now recurse into subdicts and lists that may contain dicts.\n    for key, value in the_dict.items():\n        if isinstance(value, dict):\n            ProcessListFiltersInDict(key, value)\n        elif isinstance(value, list):\n            ProcessListFiltersInList(key, value)\n\n\ndef ProcessListFiltersInList(name, the_list):\n    for item in the_list:\n        if isinstance(item, dict):\n            ProcessListFiltersInDict(name, item)\n        elif isinstance(item, list):\n            ProcessListFiltersInList(name, item)\n\n\ndef ValidateTargetType(target, target_dict):\n    \"\"\"Ensures the 'type' field on the target is one of the known types.\n\n    Arguments:\n      target: string, name of target.\n      target_dict: dict, target spec.\n\n    Raises an exception on error.\n    \"\"\"\n    VALID_TARGET_TYPES = (\n        \"executable\",\n        \"loadable_module\",\n        \"static_library\",\n        \"shared_library\",\n        \"mac_kernel_extension\",\n        \"none\",\n        \"windows_driver\",\n    )\n    target_type = target_dict.get(\"type\", None)\n    if target_type not in VALID_TARGET_TYPES:\n        raise GypError(\n            \"Target %s has an invalid target type '%s'.  \"\n            \"Must be one of %s.\" % (target, target_type, \"/\".join(VALID_TARGET_TYPES))\n        )\n    if (\n        target_dict.get(\"standalone_static_library\", 0)\n        and not target_type == \"static_library\"\n    ):\n        raise GypError(\n            \"Target %s has type %s but standalone_static_library flag is\"\n            \" only valid for static_library type.\" % (target, target_type)\n        )\n\n\ndef ValidateRulesInTarget(target, target_dict, extra_sources_for_rules):\n    \"\"\"Ensures that the rules sections in target_dict are valid and consistent,\n    and determines which sources they apply to.\n\n    Arguments:\n      target: string, name of target.\n      target_dict: dict, target spec containing \"rules\" and \"sources\" lists.\n      extra_sources_for_rules: a list of keys to scan for rule matches in\n          addition to 'sources'.\n    \"\"\"\n\n    # Dicts to map between values found in rules' 'rule_name' and 'extension'\n    # keys and the rule dicts themselves.\n    rule_names = {}\n    rule_extensions = {}\n\n    rules = target_dict.get(\"rules\", [])\n    for rule in rules:\n        # Make sure that there's no conflict among rule names and extensions.\n        rule_name = rule[\"rule_name\"]\n        if rule_name in rule_names:\n            raise GypError(f\"rule {rule_name} exists in duplicate, target {target}\")\n        rule_names[rule_name] = rule\n\n        rule_extension = rule[\"extension\"]\n        if rule_extension.startswith(\".\"):\n            rule_extension = rule_extension[1:]\n        if rule_extension in rule_extensions:\n            raise GypError(\n                (\n                    \"extension %s associated with multiple rules, \"\n                    + \"target %s rules %s and %s\"\n                )\n                % (\n                    rule_extension,\n                    target,\n                    rule_extensions[rule_extension][\"rule_name\"],\n                    rule_name,\n                )\n            )\n        rule_extensions[rule_extension] = rule\n\n        # Make sure rule_sources isn't already there.  It's going to be\n        # created below if needed.\n        if \"rule_sources\" in rule:\n            raise GypError(\n                \"rule_sources must not exist in input, target %s rule %s\"\n                % (target, rule_name)\n            )\n\n        rule_sources = []\n        source_keys = [\"sources\"]\n        source_keys.extend(extra_sources_for_rules)\n        for source_key in source_keys:\n            for source in target_dict.get(source_key, []):\n                (_source_root, source_extension) = os.path.splitext(source)\n                if source_extension.startswith(\".\"):\n                    source_extension = source_extension[1:]\n                if source_extension == rule_extension:\n                    rule_sources.append(source)\n\n        if len(rule_sources) > 0:\n            rule[\"rule_sources\"] = rule_sources\n\n\ndef ValidateRunAsInTarget(target, target_dict, build_file):\n    target_name = target_dict.get(\"target_name\")\n    run_as = target_dict.get(\"run_as\")\n    if not run_as:\n        return\n    if not isinstance(run_as, dict):\n        raise GypError(\n            \"The 'run_as' in target %s from file %s should be a \"\n            \"dictionary.\" % (target_name, build_file)\n        )\n    action = run_as.get(\"action\")\n    if not action:\n        raise GypError(\n            \"The 'run_as' in target %s from file %s must have an \"\n            \"'action' section.\" % (target_name, build_file)\n        )\n    if not isinstance(action, list):\n        raise GypError(\n            \"The 'action' for 'run_as' in target %s from file %s \"\n            \"must be a list.\" % (target_name, build_file)\n        )\n    working_directory = run_as.get(\"working_directory\")\n    if working_directory and not isinstance(working_directory, str):\n        raise GypError(\n            \"The 'working_directory' for 'run_as' in target %s \"\n            \"in file %s should be a string.\" % (target_name, build_file)\n        )\n    environment = run_as.get(\"environment\")\n    if environment and not isinstance(environment, dict):\n        raise GypError(\n            \"The 'environment' for 'run_as' in target %s \"\n            \"in file %s should be a dictionary.\" % (target_name, build_file)\n        )\n\n\ndef ValidateActionsInTarget(target, target_dict, build_file):\n    \"\"\"Validates the inputs to the actions in a target.\"\"\"\n    target_name = target_dict.get(\"target_name\")\n    actions = target_dict.get(\"actions\", [])\n    for action in actions:\n        action_name = action.get(\"action_name\")\n        if not action_name:\n            raise GypError(\n                \"Anonymous action in target %s.  \"\n                \"An action must have an 'action_name' field.\" % target_name\n            )\n        inputs = action.get(\"inputs\", None)\n        if inputs is None:\n            raise GypError(\"Action in target %s has no inputs.\" % target_name)\n        action_command = action.get(\"action\")\n        if action_command and not action_command[0]:\n            raise GypError(\"Empty action as command in target %s.\" % target_name)\n\n\ndef TurnIntIntoStrInDict(the_dict):\n    \"\"\"Given dict the_dict, recursively converts all integers into strings.\"\"\"\n    # Use items instead of iteritems because there's no need to try to look at\n    # reinserted keys and their associated values.\n    for k, v in the_dict.items():\n        if isinstance(v, int):\n            v = str(v)\n            the_dict[k] = v\n        elif isinstance(v, dict):\n            TurnIntIntoStrInDict(v)\n        elif isinstance(v, list):\n            TurnIntIntoStrInList(v)\n\n        if isinstance(k, int):\n            del the_dict[k]\n            the_dict[str(k)] = v\n\n\ndef TurnIntIntoStrInList(the_list):\n    \"\"\"Given list the_list, recursively converts all integers into strings.\"\"\"\n    for index, item in enumerate(the_list):\n        if isinstance(item, int):\n            the_list[index] = str(item)\n        elif isinstance(item, dict):\n            TurnIntIntoStrInDict(item)\n        elif isinstance(item, list):\n            TurnIntIntoStrInList(item)\n\n\ndef PruneUnwantedTargets(targets, flat_list, dependency_nodes, root_targets, data):\n    \"\"\"Return only the targets that are deep dependencies of |root_targets|.\"\"\"\n    qualified_root_targets = []\n    for target in root_targets:\n        target = target.strip()\n        qualified_targets = gyp.common.FindQualifiedTargets(target, flat_list)\n        if not qualified_targets:\n            raise GypError(\"Could not find target %s\" % target)\n        qualified_root_targets.extend(qualified_targets)\n\n    wanted_targets = {}\n    for target in qualified_root_targets:\n        wanted_targets[target] = targets[target]\n        for dependency in dependency_nodes[target].DeepDependencies():\n            wanted_targets[dependency] = targets[dependency]\n\n    wanted_flat_list = [t for t in flat_list if t in wanted_targets]\n\n    # Prune unwanted targets from each build_file's data dict.\n    for build_file in data[\"target_build_files\"]:\n        if \"targets\" not in data[build_file]:\n            continue\n        new_targets = []\n        for target in data[build_file][\"targets\"]:\n            qualified_name = gyp.common.QualifiedTarget(\n                build_file, target[\"target_name\"], target[\"toolset\"]\n            )\n            if qualified_name in wanted_targets:\n                new_targets.append(target)\n        data[build_file][\"targets\"] = new_targets\n\n    return wanted_targets, wanted_flat_list\n\n\ndef VerifyNoCollidingTargets(targets):\n    \"\"\"Verify that no two targets in the same directory share the same name.\n\n    Arguments:\n      targets: A list of targets in the form 'path/to/file.gyp:target_name'.\n    \"\"\"\n    # Keep a dict going from 'subdirectory:target_name' to 'foo.gyp'.\n    used = {}\n    for target in targets:\n        # Separate out 'path/to/file.gyp, 'target_name' from\n        # 'path/to/file.gyp:target_name'.\n        path, name = target.rsplit(\":\", 1)\n        # Separate out 'path/to', 'file.gyp' from 'path/to/file.gyp'.\n        subdir, gyp = os.path.split(path)\n        # Use '.' for the current directory '', so that the error messages make\n        # more sense.\n        if not subdir:\n            subdir = \".\"\n        # Prepare a key like 'path/to:target_name'.\n        key = subdir + \":\" + name\n        if key in used:\n            # Complain if this target is already used.\n            raise GypError(\n                'Duplicate target name \"%s\" in directory \"%s\" used both '\n                'in \"%s\" and \"%s\".' % (name, subdir, gyp, used[key])\n            )\n        used[key] = gyp\n\n\ndef SetGeneratorGlobals(generator_input_info):\n    # Set up path_sections and non_configuration_keys with the default data plus\n    # the generator-specific data.\n    global path_sections\n    path_sections = set(base_path_sections)\n    path_sections.update(generator_input_info[\"path_sections\"])\n\n    global non_configuration_keys\n    non_configuration_keys = base_non_configuration_keys[:]\n    non_configuration_keys.extend(generator_input_info[\"non_configuration_keys\"])\n\n    global multiple_toolsets\n    multiple_toolsets = generator_input_info[\"generator_supports_multiple_toolsets\"]\n\n    global generator_filelist_paths\n    generator_filelist_paths = generator_input_info[\"generator_filelist_paths\"]\n\n\ndef Load(\n    build_files,\n    variables,\n    includes,\n    depth,\n    generator_input_info,\n    check,\n    circular_check,\n    parallel,\n    root_targets,\n):\n    SetGeneratorGlobals(generator_input_info)\n    # A generator can have other lists (in addition to sources) be processed\n    # for rules.\n    extra_sources_for_rules = generator_input_info[\"extra_sources_for_rules\"]\n\n    # Load build files.  This loads every target-containing build file into\n    # the |data| dictionary such that the keys to |data| are build file names,\n    # and the values are the entire build file contents after \"early\" or \"pre\"\n    # processing has been done and includes have been resolved.\n    # NOTE: data contains both \"target\" files (.gyp) and \"includes\" (.gypi), as\n    # well as meta-data (e.g. 'included_files' key). 'target_build_files' keeps\n    # track of the keys corresponding to \"target\" files.\n    data = {\"target_build_files\": set()}\n    # Normalize paths everywhere.  This is important because paths will be\n    # used as keys to the data dict and for references between input files.\n    build_files = set(map(os.path.normpath, build_files))\n    if parallel:\n        LoadTargetBuildFilesParallel(\n            build_files, data, variables, includes, depth, check, generator_input_info\n        )\n    else:\n        aux_data = {}\n        for build_file in build_files:\n            try:\n                LoadTargetBuildFile(\n                    build_file, data, aux_data, variables, includes, depth, check, True\n                )\n            except Exception as e:\n                gyp.common.ExceptionAppend(e, \"while trying to load %s\" % build_file)\n                raise\n\n    # Build a dict to access each target's subdict by qualified name.\n    targets = BuildTargetsDict(data)\n\n    # Fully qualify all dependency links.\n    QualifyDependencies(targets)\n\n    # Remove self-dependencies from targets that have 'prune_self_dependencies'\n    # set to 1.\n    RemoveSelfDependencies(targets)\n\n    # Expand dependencies specified as build_file:*.\n    ExpandWildcardDependencies(targets, data)\n\n    # Remove all dependencies marked as 'link_dependency' from the targets of\n    # type 'none'.\n    RemoveLinkDependenciesFromNoneTargets(targets)\n\n    # Apply exclude (!) and regex (/) list filters only for dependency_sections.\n    for target_name, target_dict in targets.items():\n        tmp_dict = {}\n        for key_base in dependency_sections:\n            for op in (\"\", \"!\", \"/\"):\n                key = key_base + op\n                if key in target_dict:\n                    tmp_dict[key] = target_dict[key]\n                    del target_dict[key]\n        ProcessListFiltersInDict(target_name, tmp_dict)\n        # Write the results back to |target_dict|.\n        for key, value in tmp_dict.items():\n            target_dict[key] = value\n\n    # Make sure every dependency appears at most once.\n    RemoveDuplicateDependencies(targets)\n\n    if circular_check:\n        # Make sure that any targets in a.gyp don't contain dependencies in other\n        # .gyp files that further depend on a.gyp.\n        VerifyNoGYPFileCircularDependencies(targets)\n\n    [dependency_nodes, flat_list] = BuildDependencyList(targets)\n\n    if root_targets:\n        # Remove, from |targets| and |flat_list|, the targets that are not deep\n        # dependencies of the targets specified in |root_targets|.\n        targets, flat_list = PruneUnwantedTargets(\n            targets, flat_list, dependency_nodes, root_targets, data\n        )\n\n    # Check that no two targets in the same directory have the same name.\n    VerifyNoCollidingTargets(flat_list)\n\n    # Handle dependent settings of various types.\n    for settings_type in [\n        \"all_dependent_settings\",\n        \"direct_dependent_settings\",\n        \"link_settings\",\n    ]:\n        DoDependentSettings(settings_type, flat_list, targets, dependency_nodes)\n\n        # Take out the dependent settings now that they've been published to all\n        # of the targets that require them.\n        for target in flat_list:\n            if settings_type in targets[target]:\n                del targets[target][settings_type]\n\n    # Make sure static libraries don't declare dependencies on other static\n    # libraries, but that linkables depend on all unlinked static libraries\n    # that they need so that their link steps will be correct.\n    gii = generator_input_info\n    if gii[\"generator_wants_static_library_dependencies_adjusted\"]:\n        AdjustStaticLibraryDependencies(\n            flat_list,\n            targets,\n            dependency_nodes,\n            gii[\"generator_wants_sorted_dependencies\"],\n        )\n\n    # Apply \"post\"/\"late\"/\"target\" variable expansions and condition evaluations.\n    for target in flat_list:\n        target_dict = targets[target]\n        build_file = gyp.common.BuildFile(target)\n        ProcessVariablesAndConditionsInDict(\n            target_dict, PHASE_LATE, variables, build_file\n        )\n\n    # Move everything that can go into a \"configurations\" section into one.\n    for target in flat_list:\n        target_dict = targets[target]\n        SetUpConfigurations(target, target_dict)\n\n    # Apply exclude (!) and regex (/) list filters.\n    for target in flat_list:\n        target_dict = targets[target]\n        ProcessListFiltersInDict(target, target_dict)\n\n    # Apply \"latelate\" variable expansions and condition evaluations.\n    for target in flat_list:\n        target_dict = targets[target]\n        build_file = gyp.common.BuildFile(target)\n        ProcessVariablesAndConditionsInDict(\n            target_dict, PHASE_LATELATE, variables, build_file\n        )\n\n    # Make sure that the rules make sense, and build up rule_sources lists as\n    # needed.  Not all generators will need to use the rule_sources lists, but\n    # some may, and it seems best to build the list in a common spot.\n    # Also validate actions and run_as elements in targets.\n    for target in flat_list:\n        target_dict = targets[target]\n        build_file = gyp.common.BuildFile(target)\n        ValidateTargetType(target, target_dict)\n        ValidateRulesInTarget(target, target_dict, extra_sources_for_rules)\n        ValidateRunAsInTarget(target, target_dict, build_file)\n        ValidateActionsInTarget(target, target_dict, build_file)\n\n    # Generators might not expect ints.  Turn them into strs.\n    TurnIntIntoStrInDict(data)\n\n    # TODO(mark): Return |data| for now because the generator needs a list of\n    # build files that came in.  In the future, maybe it should just accept\n    # a list, and not the whole data dict.\n    return [flat_list, targets, data]\n"
  },
  {
    "path": "gyp/pylib/gyp/input_test.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright 2013 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Unit tests for the input.py file.\"\"\"\n\nimport unittest\n\nimport gyp.input\n\n\nclass TestFindCycles(unittest.TestCase):\n    def setUp(self):\n        self.nodes = {}\n        for x in (\"a\", \"b\", \"c\", \"d\", \"e\"):\n            self.nodes[x] = gyp.input.DependencyGraphNode(x)\n\n    def _create_dependency(self, dependent, dependency):\n        dependent.dependencies.append(dependency)\n        dependency.dependents.append(dependent)\n\n    def test_no_cycle_empty_graph(self):\n        for label, node in self.nodes.items():\n            self.assertEqual([], node.FindCycles())\n\n    def test_no_cycle_line(self):\n        self._create_dependency(self.nodes[\"a\"], self.nodes[\"b\"])\n        self._create_dependency(self.nodes[\"b\"], self.nodes[\"c\"])\n        self._create_dependency(self.nodes[\"c\"], self.nodes[\"d\"])\n\n        for label, node in self.nodes.items():\n            self.assertEqual([], node.FindCycles())\n\n    def test_no_cycle_dag(self):\n        self._create_dependency(self.nodes[\"a\"], self.nodes[\"b\"])\n        self._create_dependency(self.nodes[\"a\"], self.nodes[\"c\"])\n        self._create_dependency(self.nodes[\"b\"], self.nodes[\"c\"])\n\n        for label, node in self.nodes.items():\n            self.assertEqual([], node.FindCycles())\n\n    def test_cycle_self_reference(self):\n        self._create_dependency(self.nodes[\"a\"], self.nodes[\"a\"])\n\n        self.assertEqual(\n            [[self.nodes[\"a\"], self.nodes[\"a\"]]], self.nodes[\"a\"].FindCycles()\n        )\n\n    def test_cycle_two_nodes(self):\n        self._create_dependency(self.nodes[\"a\"], self.nodes[\"b\"])\n        self._create_dependency(self.nodes[\"b\"], self.nodes[\"a\"])\n\n        self.assertEqual(\n            [[self.nodes[\"a\"], self.nodes[\"b\"], self.nodes[\"a\"]]],\n            self.nodes[\"a\"].FindCycles(),\n        )\n        self.assertEqual(\n            [[self.nodes[\"b\"], self.nodes[\"a\"], self.nodes[\"b\"]]],\n            self.nodes[\"b\"].FindCycles(),\n        )\n\n    def test_two_cycles(self):\n        self._create_dependency(self.nodes[\"a\"], self.nodes[\"b\"])\n        self._create_dependency(self.nodes[\"b\"], self.nodes[\"a\"])\n\n        self._create_dependency(self.nodes[\"b\"], self.nodes[\"c\"])\n        self._create_dependency(self.nodes[\"c\"], self.nodes[\"b\"])\n\n        cycles = self.nodes[\"a\"].FindCycles()\n        self.assertTrue([self.nodes[\"a\"], self.nodes[\"b\"], self.nodes[\"a\"]] in cycles)\n        self.assertTrue([self.nodes[\"b\"], self.nodes[\"c\"], self.nodes[\"b\"]] in cycles)\n        self.assertEqual(2, len(cycles))\n\n    def test_big_cycle(self):\n        self._create_dependency(self.nodes[\"a\"], self.nodes[\"b\"])\n        self._create_dependency(self.nodes[\"b\"], self.nodes[\"c\"])\n        self._create_dependency(self.nodes[\"c\"], self.nodes[\"d\"])\n        self._create_dependency(self.nodes[\"d\"], self.nodes[\"e\"])\n        self._create_dependency(self.nodes[\"e\"], self.nodes[\"a\"])\n\n        self.assertEqual(\n            [\n                [\n                    self.nodes[\"a\"],\n                    self.nodes[\"b\"],\n                    self.nodes[\"c\"],\n                    self.nodes[\"d\"],\n                    self.nodes[\"e\"],\n                    self.nodes[\"a\"],\n                ]\n            ],\n            self.nodes[\"a\"].FindCycles(),\n        )\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
  },
  {
    "path": "gyp/pylib/gyp/mac_tool.py",
    "content": "#!/usr/bin/env python3\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Utility functions to perform Xcode-style build steps.\n\nThese functions are executed via gyp-mac-tool when using the Makefile generator.\n\"\"\"\n\nimport fcntl\nimport fnmatch\nimport glob\nimport json\nimport os\nimport plistlib\nimport re\nimport shutil\nimport struct\nimport subprocess\nimport sys\nimport tempfile\n\n\ndef main(args):\n    executor = MacTool()\n    if (exit_code := executor.Dispatch(args)) is not None:\n        sys.exit(exit_code)\n\n\nclass MacTool:\n    \"\"\"This class performs all the Mac tooling steps. The methods can either be\n    executed directly, or dispatched from an argument list.\"\"\"\n\n    def Dispatch(self, args):\n        \"\"\"Dispatches a string command to a method.\"\"\"\n        if len(args) < 1:\n            raise Exception(\"Not enough arguments\")\n\n        method = \"Exec%s\" % self._CommandifyName(args[0])\n        return getattr(self, method)(*args[1:])\n\n    def _CommandifyName(self, name_string):\n        \"\"\"Transforms a tool name like copy-info-plist to CopyInfoPlist\"\"\"\n        return name_string.title().replace(\"-\", \"\")\n\n    def ExecCopyBundleResource(self, source, dest, convert_to_binary):\n        \"\"\"Copies a resource file to the bundle/Resources directory, performing any\n        necessary compilation on each resource.\"\"\"\n        convert_to_binary = convert_to_binary == \"True\"\n        extension = os.path.splitext(source)[1].lower()\n        if os.path.isdir(source):\n            # Copy tree.\n            # TODO(thakis): This copies file attributes like mtime, while the\n            # single-file branch below doesn't. This should probably be changed to\n            # be consistent with the single-file branch.\n            if os.path.exists(dest):\n                shutil.rmtree(dest)\n            shutil.copytree(source, dest)\n        elif extension in {\".xib\", \".storyboard\"}:\n            return self._CopyXIBFile(source, dest)\n        elif extension == \".strings\" and not convert_to_binary:\n            self._CopyStringsFile(source, dest)\n        else:\n            if os.path.exists(dest):\n                os.unlink(dest)\n            shutil.copy(source, dest)\n\n        if convert_to_binary and extension in {\".plist\", \".strings\"}:\n            self._ConvertToBinary(dest)\n\n    def _CopyXIBFile(self, source, dest):\n        \"\"\"Compiles a XIB file with ibtool into a binary plist in the bundle.\"\"\"\n\n        # ibtool sometimes crashes with relative paths. See crbug.com/314728.\n        base = os.path.dirname(os.path.realpath(__file__))\n        if os.path.relpath(source):\n            source = os.path.join(base, source)\n        if os.path.relpath(dest):\n            dest = os.path.join(base, dest)\n\n        args = [\"xcrun\", \"ibtool\", \"--errors\", \"--warnings\", \"--notices\"]\n\n        if os.environ[\"XCODE_VERSION_ACTUAL\"] > \"0700\":\n            args.extend([\"--auto-activate-custom-fonts\"])\n            if \"IPHONEOS_DEPLOYMENT_TARGET\" in os.environ:\n                args.extend(\n                    [\n                        \"--target-device\",\n                        \"iphone\",\n                        \"--target-device\",\n                        \"ipad\",\n                        \"--minimum-deployment-target\",\n                        os.environ[\"IPHONEOS_DEPLOYMENT_TARGET\"],\n                    ]\n                )\n            else:\n                args.extend(\n                    [\n                        \"--target-device\",\n                        \"mac\",\n                        \"--minimum-deployment-target\",\n                        os.environ[\"MACOSX_DEPLOYMENT_TARGET\"],\n                    ]\n                )\n\n        args.extend(\n            [\"--output-format\", \"human-readable-text\", \"--compile\", dest, source]\n        )\n\n        ibtool_section_re = re.compile(r\"/\\*.*\\*/\")\n        ibtool_re = re.compile(r\".*note:.*is clipping its content\")\n        try:\n            stdout = subprocess.check_output(args)\n        except subprocess.CalledProcessError as e:\n            print(e.output)\n            raise\n        current_section_header = None\n        for line in stdout.splitlines():\n            if ibtool_section_re.match(line):\n                current_section_header = line\n            elif not ibtool_re.match(line):\n                if current_section_header:\n                    print(current_section_header)\n                    current_section_header = None\n                print(line)\n        return 0\n\n    def _ConvertToBinary(self, dest):\n        subprocess.check_call(\n            [\"xcrun\", \"plutil\", \"-convert\", \"binary1\", \"-o\", dest, dest]\n        )\n\n    def _CopyStringsFile(self, source, dest):\n        \"\"\"Copies a .strings file using iconv to reconvert the input into UTF-16.\"\"\"\n        input_code = self._DetectInputEncoding(source) or \"UTF-8\"\n\n        # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call\n        # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints\n        #     CFPropertyListCreateFromXMLData(): Old-style plist parser: missing\n        #     semicolon in dictionary.\n        # on invalid files. Do the same kind of validation.\n        import CoreFoundation  # noqa: PLC0415\n\n        with open(source, \"rb\") as in_file:\n            s = in_file.read()\n        d = CoreFoundation.CFDataCreate(None, s, len(s))\n        _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None)\n        if error:\n            return\n\n        with open(dest, \"wb\") as fp:\n            fp.write(s.decode(input_code).encode(\"UTF-16\"))\n\n    def _DetectInputEncoding(self, file_name):\n        \"\"\"Reads the first few bytes from file_name and tries to guess the text\n        encoding. Returns None as a guess if it can't detect it.\"\"\"\n        with open(file_name, \"rb\") as fp:\n            try:\n                header = fp.read(3)\n            except Exception:\n                return None\n        if header.startswith((b\"\\xfe\\xff\", b\"\\xff\\xfe\")):\n            return \"UTF-16\"\n        elif header.startswith(b\"\\xef\\xbb\\xbf\"):\n            return \"UTF-8\"\n        else:\n            return None\n\n    def ExecCopyInfoPlist(self, source, dest, convert_to_binary, *keys):\n        \"\"\"Copies the |source| Info.plist to the destination directory |dest|.\"\"\"\n        # Read the source Info.plist into memory.\n        with open(source) as fd:\n            lines = fd.read()\n\n        # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild).\n        plist = plistlib.readPlistFromString(lines)\n        if keys:\n            plist.update(json.loads(keys[0]))\n        lines = plistlib.writePlistToString(plist)\n\n        # Go through all the environment variables and replace them as variables in\n        # the file.\n        IDENT_RE = re.compile(r\"[_/\\s]\")\n        for key in os.environ:\n            if key.startswith(\"_\"):\n                continue\n            evar = \"${%s}\" % key\n            evalue = os.environ[key]\n            lines = lines.replace(lines, evar, evalue)\n\n            # Xcode supports various suffices on environment variables, which are\n            # all undocumented. :rfc1034identifier is used in the standard project\n            # template these days, and :identifier was used earlier. They are used to\n            # convert non-url characters into things that look like valid urls --\n            # except that the replacement character for :identifier, '_' isn't valid\n            # in a URL either -- oops, hence :rfc1034identifier was born.\n            evar = \"${%s:identifier}\" % key\n            evalue = IDENT_RE.sub(\"_\", os.environ[key])\n            lines = lines.replace(lines, evar, evalue)\n\n            evar = \"${%s:rfc1034identifier}\" % key\n            evalue = IDENT_RE.sub(\"-\", os.environ[key])\n            lines = lines.replace(lines, evar, evalue)\n\n        # Remove any keys with values that haven't been replaced.\n        lines = lines.splitlines()\n        for i in range(len(lines)):\n            if lines[i].strip().startswith(\"<string>${\"):\n                lines[i] = None\n                lines[i - 1] = None\n        lines = \"\\n\".join(line for line in lines if line is not None)\n\n        # Write out the file with variables replaced.\n        with open(dest, \"w\") as fd:\n            fd.write(lines)\n\n        # Now write out PkgInfo file now that the Info.plist file has been\n        # \"compiled\".\n        self._WritePkgInfo(dest)\n\n        if convert_to_binary == \"True\":\n            self._ConvertToBinary(dest)\n\n    def _WritePkgInfo(self, info_plist):\n        \"\"\"This writes the PkgInfo file from the data stored in Info.plist.\"\"\"\n        plist = plistlib.readPlist(info_plist)\n        if not plist:\n            return\n\n        # Only create PkgInfo for executable types.\n        package_type = plist[\"CFBundlePackageType\"]\n        if package_type != \"APPL\":\n            return\n\n        # The format of PkgInfo is eight characters, representing the bundle type\n        # and bundle signature, each four characters. If that is missing, four\n        # '?' characters are used instead.\n        signature_code = plist.get(\"CFBundleSignature\", \"????\")\n        if len(signature_code) != 4:  # Wrong length resets everything, too.\n            signature_code = \"?\" * 4\n\n        dest = os.path.join(os.path.dirname(info_plist), \"PkgInfo\")\n        with open(dest, \"w\") as fp:\n            fp.write(f\"{package_type}{signature_code}\")\n\n    def ExecFlock(self, lockfile, *cmd_list):\n        \"\"\"Emulates the most basic behavior of Linux's flock(1).\"\"\"\n        # Rely on exception handling to report errors.\n        fd = os.open(lockfile, os.O_RDONLY | os.O_NOCTTY | os.O_CREAT, 0o666)\n        fcntl.flock(fd, fcntl.LOCK_EX)\n        return subprocess.call(cmd_list)\n\n    def ExecFilterLibtool(self, *cmd_list):\n        \"\"\"Calls libtool and filters out '/path/to/libtool: file: foo.o has no\n        symbols'.\"\"\"\n        libtool_re = re.compile(\n            r\"^.*libtool: (?:for architecture: \\S* )?file: .* has no symbols$\"\n        )\n        libtool_re5 = re.compile(\n            r\"^.*libtool: warning for library: \"\n            + r\".* the table of contents is empty \"\n            + r\"\\(no object file members in the library define global symbols\\)$\"\n        )\n        env = os.environ.copy()\n        # Ref:\n        # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c\n        # The problem with this flag is that it resets the file mtime on the file to\n        # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone.\n        env[\"ZERO_AR_DATE\"] = \"1\"\n        libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env)\n        err = libtoolout.communicate()[1].decode(\"utf-8\")\n        for line in err.splitlines():\n            if not libtool_re.match(line) and not libtool_re5.match(line):\n                print(line, file=sys.stderr)\n        # Unconditionally touch the output .a file on the command line if present\n        # and the command succeeded. A bit hacky.\n        if not libtoolout.returncode:\n            for i in range(len(cmd_list) - 1):\n                if cmd_list[i] == \"-o\" and cmd_list[i + 1].endswith(\".a\"):\n                    os.utime(cmd_list[i + 1], None)\n                    break\n        return libtoolout.returncode\n\n    def ExecPackageIosFramework(self, framework):\n        # Find the name of the binary based on the part before the \".framework\".\n        binary = os.path.basename(framework).split(\".\")[0]\n        module_path = os.path.join(framework, \"Modules\")\n        if not os.path.exists(module_path):\n            os.mkdir(module_path)\n        module_template = (\n            \"framework module %s {\\n\"\n            '  umbrella header \"%s.h\"\\n'\n            \"\\n\"\n            \"  export *\\n\"\n            \"  module * { export * }\\n\"\n            \"}\\n\" % (binary, binary)\n        )\n\n        with open(os.path.join(module_path, \"module.modulemap\"), \"w\") as module_file:\n            module_file.write(module_template)\n\n    def ExecPackageFramework(self, framework, version):\n        \"\"\"Takes a path to Something.framework and the Current version of that and\n        sets up all the symlinks.\"\"\"\n        # Find the name of the binary based on the part before the \".framework\".\n        binary = os.path.basename(framework).split(\".\")[0]\n\n        CURRENT = \"Current\"\n        RESOURCES = \"Resources\"\n        VERSIONS = \"Versions\"\n\n        if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)):\n            # Binary-less frameworks don't seem to contain symlinks (see e.g.\n            # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle).\n            return\n\n        # Move into the framework directory to set the symlinks correctly.\n        pwd = os.getcwd()\n        os.chdir(framework)\n\n        # Set up the Current version.\n        self._Relink(version, os.path.join(VERSIONS, CURRENT))\n\n        # Set up the root symlinks.\n        self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary)\n        self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES)\n\n        # Back to where we were before!\n        os.chdir(pwd)\n\n    def _Relink(self, dest, link):\n        \"\"\"Creates a symlink to |dest| named |link|. If |link| already exists,\n        it is overwritten.\"\"\"\n        if os.path.lexists(link):\n            os.remove(link)\n        os.symlink(dest, link)\n\n    def ExecCompileIosFrameworkHeaderMap(self, out, framework, *all_headers):\n        framework_name = os.path.basename(framework).split(\".\")[0]\n        all_headers = [os.path.abspath(header) for header in all_headers]\n        filelist = {}\n        for header in all_headers:\n            filename = os.path.basename(header)\n            filelist[filename] = header\n            filelist[os.path.join(framework_name, filename)] = header\n        WriteHmap(out, filelist)\n\n    def ExecCopyIosFrameworkHeaders(self, framework, *copy_headers):\n        header_path = os.path.join(framework, \"Headers\")\n        if not os.path.exists(header_path):\n            os.makedirs(header_path)\n        for header in copy_headers:\n            shutil.copy(header, os.path.join(header_path, os.path.basename(header)))\n\n    def ExecCompileXcassets(self, keys, *inputs):\n        \"\"\"Compiles multiple .xcassets files into a single .car file.\n\n        This invokes 'actool' to compile all the inputs .xcassets files. The\n        |keys| arguments is a json-encoded dictionary of extra arguments to\n        pass to 'actool' when the asset catalogs contains an application icon\n        or a launch image.\n\n        Note that 'actool' does not create the Assets.car file if the asset\n        catalogs does not contains imageset.\n        \"\"\"\n        command_line = [\n            \"xcrun\",\n            \"actool\",\n            \"--output-format\",\n            \"human-readable-text\",\n            \"--compress-pngs\",\n            \"--notices\",\n            \"--warnings\",\n            \"--errors\",\n        ]\n        is_iphone_target = \"IPHONEOS_DEPLOYMENT_TARGET\" in os.environ\n        if is_iphone_target:\n            platform = os.environ[\"CONFIGURATION\"].split(\"-\")[-1]\n            if platform not in (\"iphoneos\", \"iphonesimulator\"):\n                platform = \"iphonesimulator\"\n            command_line.extend(\n                [\n                    \"--platform\",\n                    platform,\n                    \"--target-device\",\n                    \"iphone\",\n                    \"--target-device\",\n                    \"ipad\",\n                    \"--minimum-deployment-target\",\n                    os.environ[\"IPHONEOS_DEPLOYMENT_TARGET\"],\n                    \"--compile\",\n                    os.path.abspath(os.environ[\"CONTENTS_FOLDER_PATH\"]),\n                ]\n            )\n        else:\n            command_line.extend(\n                [\n                    \"--platform\",\n                    \"macosx\",\n                    \"--target-device\",\n                    \"mac\",\n                    \"--minimum-deployment-target\",\n                    os.environ[\"MACOSX_DEPLOYMENT_TARGET\"],\n                    \"--compile\",\n                    os.path.abspath(os.environ[\"UNLOCALIZED_RESOURCES_FOLDER_PATH\"]),\n                ]\n            )\n        if keys:\n            keys = json.loads(keys)\n            for key, value in keys.items():\n                arg_name = \"--\" + key\n                if isinstance(value, bool):\n                    if value:\n                        command_line.append(arg_name)\n                elif isinstance(value, list):\n                    for v in value:\n                        command_line.append(arg_name)\n                        command_line.append(str(v))\n                else:\n                    command_line.append(arg_name)\n                    command_line.append(str(value))\n        # Note: actool crashes if inputs path are relative, so use os.path.abspath\n        # to get absolute path name for inputs.\n        command_line.extend(map(os.path.abspath, inputs))\n        subprocess.check_call(command_line)\n\n    def ExecMergeInfoPlist(self, output, *inputs):\n        \"\"\"Merge multiple .plist files into a single .plist file.\"\"\"\n        merged_plist = {}\n        for path in inputs:\n            plist = self._LoadPlistMaybeBinary(path)\n            self._MergePlist(merged_plist, plist)\n        plistlib.writePlist(merged_plist, output)\n\n    def ExecCodeSignBundle(self, key, entitlements, provisioning, path, preserve):\n        \"\"\"Code sign a bundle.\n\n        This function tries to code sign an iOS bundle, following the same\n        algorithm as Xcode:\n          1. pick the provisioning profile that best match the bundle identifier,\n             and copy it into the bundle as embedded.mobileprovision,\n          2. copy Entitlements.plist from user or SDK next to the bundle,\n          3. code sign the bundle.\n        \"\"\"\n        substitutions, overrides = self._InstallProvisioningProfile(\n            provisioning, self._GetCFBundleIdentifier()\n        )\n        entitlements_path = self._InstallEntitlements(\n            entitlements, substitutions, overrides\n        )\n\n        args = [\"codesign\", \"--force\", \"--sign\", key]\n        if preserve == \"True\":\n            args.extend([\"--deep\", \"--preserve-metadata=identifier,entitlements\"])\n        else:\n            args.extend([\"--entitlements\", entitlements_path])\n        args.extend([\"--timestamp=none\", path])\n        subprocess.check_call(args)\n\n    def _InstallProvisioningProfile(self, profile, bundle_identifier):\n        \"\"\"Installs embedded.mobileprovision into the bundle.\n\n        Args:\n          profile: string, optional, short name of the .mobileprovision file\n            to use, if empty or the file is missing, the best file installed\n            will be used\n          bundle_identifier: string, value of CFBundleIdentifier from Info.plist\n\n        Returns:\n          A tuple containing two dictionary: variables substitutions and values\n          to overrides when generating the entitlements file.\n        \"\"\"\n        source_path, provisioning_data, team_id = self._FindProvisioningProfile(\n            profile, bundle_identifier\n        )\n        target_path = os.path.join(\n            os.environ[\"BUILT_PRODUCTS_DIR\"],\n            os.environ[\"CONTENTS_FOLDER_PATH\"],\n            \"embedded.mobileprovision\",\n        )\n        shutil.copy2(source_path, target_path)\n        substitutions = self._GetSubstitutions(bundle_identifier, team_id + \".\")\n        return substitutions, provisioning_data[\"Entitlements\"]\n\n    def _FindProvisioningProfile(self, profile, bundle_identifier):\n        \"\"\"Finds the .mobileprovision file to use for signing the bundle.\n\n        Checks all the installed provisioning profiles (or if the user specified\n        the PROVISIONING_PROFILE variable, only consult it) and select the most\n        specific that correspond to the bundle identifier.\n\n        Args:\n          profile: string, optional, short name of the .mobileprovision file\n            to use, if empty or the file is missing, the best file installed\n            will be used\n          bundle_identifier: string, value of CFBundleIdentifier from Info.plist\n\n        Returns:\n          A tuple of the path to the selected provisioning profile, the data of\n          the embedded plist in the provisioning profile and the team identifier\n          to use for code signing.\n\n        Raises:\n          SystemExit: if no .mobileprovision can be used to sign the bundle.\n        \"\"\"\n        profiles_dir = os.path.join(\n            os.environ[\"HOME\"], \"Library\", \"MobileDevice\", \"Provisioning Profiles\"\n        )\n        if not os.path.isdir(profiles_dir):\n            print(\n                \"cannot find mobile provisioning for %s\" % (bundle_identifier),\n                file=sys.stderr,\n            )\n            sys.exit(1)\n        provisioning_profiles = None\n        if profile:\n            profile_path = os.path.join(profiles_dir, profile + \".mobileprovision\")\n            if os.path.exists(profile_path):\n                provisioning_profiles = [profile_path]\n        if not provisioning_profiles:\n            provisioning_profiles = glob.glob(\n                os.path.join(profiles_dir, \"*.mobileprovision\")\n            )\n        valid_provisioning_profiles = {}\n        for profile_path in provisioning_profiles:\n            profile_data = self._LoadProvisioningProfile(profile_path)\n            app_id_pattern = profile_data.get(\"Entitlements\", {}).get(\n                \"application-identifier\", \"\"\n            )\n            for team_identifier in profile_data.get(\"TeamIdentifier\", []):\n                app_id = f\"{team_identifier}.{bundle_identifier}\"\n                if fnmatch.fnmatch(app_id, app_id_pattern):\n                    valid_provisioning_profiles[app_id_pattern] = (\n                        profile_path,\n                        profile_data,\n                        team_identifier,\n                    )\n        if not valid_provisioning_profiles:\n            print(\n                \"cannot find mobile provisioning for %s\" % (bundle_identifier),\n                file=sys.stderr,\n            )\n            sys.exit(1)\n        # If the user has multiple provisioning profiles installed that can be\n        # used for ${bundle_identifier}, pick the most specific one (ie. the\n        # provisioning profile whose pattern is the longest).\n        selected_key = max(valid_provisioning_profiles, key=lambda v: len(v))\n        return valid_provisioning_profiles[selected_key]\n\n    def _LoadProvisioningProfile(self, profile_path):\n        \"\"\"Extracts the plist embedded in a provisioning profile.\n\n        Args:\n          profile_path: string, path to the .mobileprovision file\n\n        Returns:\n          Content of the plist embedded in the provisioning profile as a dictionary.\n        \"\"\"\n        with tempfile.NamedTemporaryFile() as temp:\n            subprocess.check_call(\n                [\"security\", \"cms\", \"-D\", \"-i\", profile_path, \"-o\", temp.name]\n            )\n            return self._LoadPlistMaybeBinary(temp.name)\n\n    def _MergePlist(self, merged_plist, plist):\n        \"\"\"Merge |plist| into |merged_plist|.\"\"\"\n        for key, value in plist.items():\n            if isinstance(value, dict):\n                merged_value = merged_plist.get(key, {})\n                if isinstance(merged_value, dict):\n                    self._MergePlist(merged_value, value)\n                    merged_plist[key] = merged_value\n                else:\n                    merged_plist[key] = value\n            else:\n                merged_plist[key] = value\n\n    def _LoadPlistMaybeBinary(self, plist_path):\n        \"\"\"Loads into a memory a plist possibly encoded in binary format.\n\n        This is a wrapper around plistlib.readPlist that tries to convert the\n        plist to the XML format if it can't be parsed (assuming that it is in\n        the binary format).\n\n        Args:\n          plist_path: string, path to a plist file, in XML or binary format\n\n        Returns:\n          Content of the plist as a dictionary.\n        \"\"\"\n        try:\n            # First, try to read the file using plistlib that only supports XML,\n            # and if an exception is raised, convert a temporary copy to XML and\n            # load that copy.\n            return plistlib.readPlist(plist_path)\n        except Exception:\n            pass\n        with tempfile.NamedTemporaryFile() as temp:\n            shutil.copy2(plist_path, temp.name)\n            subprocess.check_call([\"plutil\", \"-convert\", \"xml1\", temp.name])\n            return plistlib.readPlist(temp.name)\n\n    def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix):\n        \"\"\"Constructs a dictionary of variable substitutions for Entitlements.plist.\n\n        Args:\n          bundle_identifier: string, value of CFBundleIdentifier from Info.plist\n          app_identifier_prefix: string, value for AppIdentifierPrefix\n\n        Returns:\n          Dictionary of substitutions to apply when generating Entitlements.plist.\n        \"\"\"\n        return {\n            \"CFBundleIdentifier\": bundle_identifier,\n            \"AppIdentifierPrefix\": app_identifier_prefix,\n        }\n\n    def _GetCFBundleIdentifier(self):\n        \"\"\"Extracts CFBundleIdentifier value from Info.plist in the bundle.\n\n        Returns:\n          Value of CFBundleIdentifier in the Info.plist located in the bundle.\n        \"\"\"\n        info_plist_path = os.path.join(\n            os.environ[\"TARGET_BUILD_DIR\"], os.environ[\"INFOPLIST_PATH\"]\n        )\n        info_plist_data = self._LoadPlistMaybeBinary(info_plist_path)\n        return info_plist_data[\"CFBundleIdentifier\"]\n\n    def _InstallEntitlements(self, entitlements, substitutions, overrides):\n        \"\"\"Generates and install the ${BundleName}.xcent entitlements file.\n\n        Expands variables \"$(variable)\" pattern in the source entitlements file,\n        add extra entitlements defined in the .mobileprovision file and the copy\n        the generated plist to \"${BundlePath}.xcent\".\n\n        Args:\n          entitlements: string, optional, path to the Entitlements.plist template\n            to use, defaults to \"${SDKROOT}/Entitlements.plist\"\n          substitutions: dictionary, variable substitutions\n          overrides: dictionary, values to add to the entitlements\n\n        Returns:\n          Path to the generated entitlements file.\n        \"\"\"\n        source_path = entitlements\n        target_path = os.path.join(\n            os.environ[\"BUILT_PRODUCTS_DIR\"], os.environ[\"PRODUCT_NAME\"] + \".xcent\"\n        )\n        if not source_path:\n            source_path = os.path.join(os.environ[\"SDKROOT\"], \"Entitlements.plist\")\n        shutil.copy2(source_path, target_path)\n        data = self._LoadPlistMaybeBinary(target_path)\n        data = self._ExpandVariables(data, substitutions)\n        if overrides:\n            for key in overrides:\n                if key not in data:\n                    data[key] = overrides[key]\n        plistlib.writePlist(data, target_path)\n        return target_path\n\n    def _ExpandVariables(self, data, substitutions):\n        \"\"\"Expands variables \"$(variable)\" in data.\n\n        Args:\n          data: object, can be either string, list or dictionary\n          substitutions: dictionary, variable substitutions to perform\n\n        Returns:\n          Copy of data where each references to \"$(variable)\" has been replaced\n          by the corresponding value found in substitutions, or left intact if\n          the key was not found.\n        \"\"\"\n        if isinstance(data, str):\n            for key, value in substitutions.items():\n                data = data.replace(\"$(%s)\" % key, value)\n            return data\n        if isinstance(data, list):\n            return [self._ExpandVariables(v, substitutions) for v in data]\n        if isinstance(data, dict):\n            return {k: self._ExpandVariables(data[k], substitutions) for k in data}\n        return data\n\n\ndef NextGreaterPowerOf2(x):\n    return 2 ** (x).bit_length()\n\n\ndef WriteHmap(output_name, filelist):\n    \"\"\"Generates a header map based on |filelist|.\n\n    Per Mark Mentovai:\n      A header map is structured essentially as a hash table, keyed by names used\n      in #includes, and providing pathnames to the actual files.\n\n    The implementation below and the comment above comes from inspecting:\n      http://www.opensource.apple.com/source/distcc/distcc-2503/distcc_dist/include_server/headermap.py?txt\n    while also looking at the implementation in clang in:\n      https://llvm.org/svn/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp\n    \"\"\"\n    magic = 1751998832\n    version = 1\n    _reserved = 0\n    count = len(filelist)\n    capacity = NextGreaterPowerOf2(count)\n    strings_offset = 24 + (12 * capacity)\n    max_value_length = max(len(value) for value in filelist.values())\n\n    out = open(output_name, \"wb\")\n    out.write(\n        struct.pack(\n            \"<LHHLLLL\",\n            magic,\n            version,\n            _reserved,\n            strings_offset,\n            count,\n            capacity,\n            max_value_length,\n        )\n    )\n\n    # Create empty hashmap buckets.\n    buckets = [None] * capacity\n    for file, path in filelist.items():\n        key = 0\n        for c in file:\n            key += ord(c.lower()) * 13\n\n        # Fill next empty bucket.\n        while buckets[key & capacity - 1] is not None:\n            key = key + 1\n        buckets[key & capacity - 1] = (file, path)\n\n    next_offset = 1\n    for bucket in buckets:\n        if bucket is None:\n            out.write(struct.pack(\"<LLL\", 0, 0, 0))\n        else:\n            (file, path) = bucket\n            key_offset = next_offset\n            prefix_offset = key_offset + len(file) + 1\n            suffix_offset = prefix_offset + len(os.path.dirname(path) + os.sep) + 1\n            next_offset = suffix_offset + len(os.path.basename(path)) + 1\n            out.write(struct.pack(\"<LLL\", key_offset, prefix_offset, suffix_offset))\n\n    # Pad byte since next offset starts at 1.\n    out.write(struct.pack(\"<x\"))\n\n    for bucket in buckets:\n        if bucket is not None:\n            (file, path) = bucket\n            out.write(struct.pack(\"<%ds\" % len(file), file))\n            out.write(struct.pack(\"<s\", \"\\0\"))\n            base = os.path.dirname(path) + os.sep\n            out.write(struct.pack(\"<%ds\" % len(base), base))\n            out.write(struct.pack(\"<s\", \"\\0\"))\n            path = os.path.basename(path)\n            out.write(struct.pack(\"<%ds\" % len(path), path))\n            out.write(struct.pack(\"<s\", \"\\0\"))\n\n\nif __name__ == \"__main__\":\n    sys.exit(main(sys.argv[1:]))\n"
  },
  {
    "path": "gyp/pylib/gyp/msvs_emulation.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"\nThis module helps emulate Visual Studio 2008 behavior on top of other\nbuild systems, primarily ninja.\n\"\"\"\n\nimport os\nimport re\nimport subprocess\nimport sys\nfrom collections import namedtuple\n\nimport gyp.MSVSUtil\nimport gyp.MSVSVersion\nfrom gyp.common import OrderedSet\n\nwindows_quoter_regex = re.compile(r'(\\\\*)\"')\n\n\ndef QuoteForRspFile(arg, quote_cmd=True):\n    \"\"\"Quote a command line argument so that it appears as one argument when\n    processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for\n    Windows programs).\"\"\"\n    # See http://goo.gl/cuFbX and http://goo.gl/dhPnp including the comment\n    # threads. This is actually the quoting rules for CommandLineToArgvW, not\n    # for the shell, because the shell doesn't do anything in Windows. This\n    # works more or less because most programs (including the compiler, etc.)\n    # use that function to handle command line arguments.\n\n    # Use a heuristic to try to find args that are paths, and normalize them\n    if arg.find(\"/\") > 0 or arg.count(\"/\") > 1:\n        arg = os.path.normpath(arg)\n\n    # For a literal quote, CommandLineToArgvW requires 2n+1 backslashes\n    # preceding it, and results in n backslashes + the quote. So we substitute\n    # in 2* what we match, +1 more, plus the quote.\n    if quote_cmd:\n        arg = windows_quoter_regex.sub(lambda mo: 2 * mo.group(1) + '\\\\\"', arg)\n\n    # %'s also need to be doubled otherwise they're interpreted as batch\n    # positional arguments. Also make sure to escape the % so that they're\n    # passed literally through escaping so they can be singled to just the\n    # original %. Otherwise, trying to pass the literal representation that\n    # looks like an environment variable to the shell (e.g. %PATH%) would fail.\n    arg = arg.replace(\"%\", \"%%\")\n\n    # These commands are used in rsp files, so no escaping for the shell (via ^)\n    # is necessary.\n\n    # As a workaround for programs that don't use CommandLineToArgvW, gyp\n    # supports msvs_quote_cmd=0, which simply disables all quoting.\n    if quote_cmd:\n        # Finally, wrap the whole thing in quotes so that the above quote rule\n        # applies and whitespace isn't a word break.\n        return f'\"{arg}\"'\n\n    return arg\n\n\ndef EncodeRspFileList(args, quote_cmd):\n    \"\"\"Process a list of arguments using QuoteCmdExeArgument.\"\"\"\n    # Note that the first argument is assumed to be the command. Don't add\n    # quotes around it because then built-ins like 'echo', etc. won't work.\n    # Take care to normpath only the path in the case of 'call ../x.bat' because\n    # otherwise the whole thing is incorrectly interpreted as a path and not\n    # normalized correctly.\n    if not args:\n        return \"\"\n    if args[0].startswith(\"call \"):\n        call, program = args[0].split(\" \", 1)\n        program = call + \" \" + os.path.normpath(program)\n    else:\n        program = os.path.normpath(args[0])\n    return program + \" \" + \" \".join(QuoteForRspFile(arg, quote_cmd) for arg in args[1:])\n\n\ndef _GenericRetrieve(root, default, path):\n    \"\"\"Given a list of dictionary keys |path| and a tree of dicts |root|, find\n    value at path, or return |default| if any of the path doesn't exist.\"\"\"\n    if not root:\n        return default\n    if not path:\n        return root\n    return _GenericRetrieve(root.get(path[0]), default, path[1:])\n\n\ndef _AddPrefix(element, prefix):\n    \"\"\"Add |prefix| to |element| or each subelement if element is iterable.\"\"\"\n    if element is None:\n        return element\n    # Note, not Iterable because we don't want to handle strings like that.\n    if isinstance(element, (list, tuple)):\n        return [prefix + e for e in element]\n    else:\n        return prefix + element\n\n\ndef _DoRemapping(element, map):\n    \"\"\"If |element| then remap it through |map|. If |element| is iterable then\n    each item will be remapped. Any elements not found will be removed.\"\"\"\n    if map is not None and element is not None:\n        if not callable(map):\n            map = map.get  # Assume it's a dict, otherwise a callable to do the remap.\n        if isinstance(element, (list, tuple)):\n            element = filter(None, [map(elem) for elem in element])\n        else:\n            element = map(element)\n    return element\n\n\ndef _AppendOrReturn(append, element):\n    \"\"\"If |append| is None, simply return |element|. If |append| is not None,\n    then add |element| to it, adding each item in |element| if it's a list or\n    tuple.\"\"\"\n    if append is not None and element is not None:\n        if isinstance(element, (list, tuple)):\n            append.extend(element)\n        else:\n            append.append(element)\n    else:\n        return element\n\n\ndef _FindDirectXInstallation():\n    \"\"\"Try to find an installation location for the DirectX SDK. Check for the\n    standard environment variable, and if that doesn't exist, try to find\n    via the registry. May return None if not found in either location.\"\"\"\n    # Return previously calculated value, if there is one\n    if hasattr(_FindDirectXInstallation, \"dxsdk_dir\"):\n        return _FindDirectXInstallation.dxsdk_dir\n\n    dxsdk_dir = os.environ.get(\"DXSDK_DIR\")\n    if not dxsdk_dir:\n        # Setup params to pass to and attempt to launch reg.exe.\n        cmd = [\"reg.exe\", \"query\", r\"HKLM\\Software\\Microsoft\\DirectX\", \"/s\"]\n        p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n        stdout = p.communicate()[0].decode(\"utf-8\")\n        for line in stdout.splitlines():\n            if \"InstallPath\" in line:\n                dxsdk_dir = line.split(\"    \")[3] + \"\\\\\"\n\n    # Cache return value\n    _FindDirectXInstallation.dxsdk_dir = dxsdk_dir\n    return dxsdk_dir\n\n\ndef GetGlobalVSMacroEnv(vs_version):\n    \"\"\"Get a dict of variables mapping internal VS macro names to their gyp\n    equivalents. Returns all variables that are independent of the target.\"\"\"\n    env = {}\n    # '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when\n    # Visual Studio is actually installed.\n    if vs_version.Path():\n        env[\"$(VSInstallDir)\"] = vs_version.Path()\n        env[\"$(VCInstallDir)\"] = os.path.join(vs_version.Path(), \"VC\") + \"\\\\\"\n    # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be\n    # set. This happens when the SDK is sync'd via src-internal, rather than\n    # by typical end-user installation of the SDK. If it's not set, we don't\n    # want to leave the unexpanded variable in the path, so simply strip it.\n    dxsdk_dir = _FindDirectXInstallation()\n    env[\"$(DXSDK_DIR)\"] = dxsdk_dir if dxsdk_dir else \"\"\n    # Try to find an installation location for the Windows DDK by checking\n    # the WDK_DIR environment variable, may be None.\n    env[\"$(WDK_DIR)\"] = os.environ.get(\"WDK_DIR\", \"\")\n    return env\n\n\ndef ExtractSharedMSVSSystemIncludes(configs, generator_flags):\n    \"\"\"Finds msvs_system_include_dirs that are common to all targets, removes\n    them from all targets, and returns an OrderedSet containing them.\"\"\"\n    all_system_includes = OrderedSet(configs[0].get(\"msvs_system_include_dirs\", []))\n    for config in configs[1:]:\n        system_includes = config.get(\"msvs_system_include_dirs\", [])\n        all_system_includes = all_system_includes & OrderedSet(system_includes)\n    if not all_system_includes:\n        return None\n    # Expand macros in all_system_includes.\n    env = GetGlobalVSMacroEnv(GetVSVersion(generator_flags))\n    expanded_system_includes = OrderedSet(\n        [ExpandMacros(include, env) for include in all_system_includes]\n    )\n    if any(\"$\" in include for include in expanded_system_includes):\n        # Some path relies on target-specific variables, bail.\n        return None\n\n    # Remove system includes shared by all targets from the targets.\n    for config in configs:\n        includes = config.get(\"msvs_system_include_dirs\", [])\n        if includes:  # Don't insert a msvs_system_include_dirs key if not needed.\n            # This must check the unexpanded includes list:\n            new_includes = [i for i in includes if i not in all_system_includes]\n            config[\"msvs_system_include_dirs\"] = new_includes\n    return expanded_system_includes\n\n\nclass MsvsSettings:\n    \"\"\"A class that understands the gyp 'msvs_...' values (especially the\n    msvs_settings field). They largely correpond to the VS2008 IDE DOM. This\n    class helps map those settings to command line options.\"\"\"\n\n    def __init__(self, spec, generator_flags):\n        self.spec = spec\n        self.vs_version = GetVSVersion(generator_flags)\n\n        supported_fields = [\n            (\"msvs_configuration_attributes\", dict),\n            (\"msvs_settings\", dict),\n            (\"msvs_system_include_dirs\", list),\n            (\"msvs_disabled_warnings\", list),\n            (\"msvs_precompiled_header\", str),\n            (\"msvs_precompiled_source\", str),\n            (\"msvs_configuration_platform\", str),\n            (\"msvs_target_platform\", str),\n        ]\n        configs = spec[\"configurations\"]\n        for field, default in supported_fields:\n            setattr(self, field, {})\n            for configname, config in configs.items():\n                getattr(self, field)[configname] = config.get(field, default())\n\n        self.msvs_cygwin_dirs = spec.get(\"msvs_cygwin_dirs\", [\".\"])\n\n        unsupported_fields = [\n            \"msvs_prebuild\",\n            \"msvs_postbuild\",\n        ]\n        unsupported = []\n        for field in unsupported_fields:\n            for config in configs.values():\n                if field in config:\n                    unsupported += [\n                        \"{} not supported (target {}).\".format(\n                            field, spec[\"target_name\"]\n                        )\n                    ]\n        if unsupported:\n            raise Exception(\"\\n\".join(unsupported))\n\n    def GetExtension(self):\n        \"\"\"Returns the extension for the target, with no leading dot.\n\n        Uses 'product_extension' if specified, otherwise uses MSVS defaults based on\n        the target type.\n        \"\"\"\n        ext = self.spec.get(\"product_extension\", None)\n        return ext or gyp.MSVSUtil.TARGET_TYPE_EXT.get(self.spec[\"type\"], \"\")\n\n    def GetVSMacroEnv(self, base_to_build=None, config=None):\n        \"\"\"Get a dict of variables mapping internal VS macro names to their gyp\n        equivalents.\"\"\"\n        target_arch = self.GetArch(config)\n        target_platform = \"Win32\" if target_arch == \"x86\" else target_arch\n        target_name = self.spec.get(\"product_prefix\", \"\") + self.spec.get(\n            \"product_name\", self.spec[\"target_name\"]\n        )\n        target_dir = base_to_build + \"\\\\\" if base_to_build else \"\"\n        target_ext = \".\" + self.GetExtension()\n        target_file_name = target_name + target_ext\n\n        replacements = {\n            \"$(InputName)\": \"${root}\",\n            \"$(InputPath)\": \"${source}\",\n            \"$(IntDir)\": \"$!INTERMEDIATE_DIR\",\n            \"$(OutDir)\\\\\": target_dir,\n            \"$(PlatformName)\": target_platform,\n            \"$(ProjectDir)\\\\\": \"\",\n            \"$(ProjectName)\": self.spec[\"target_name\"],\n            \"$(TargetDir)\\\\\": target_dir,\n            \"$(TargetExt)\": target_ext,\n            \"$(TargetFileName)\": target_file_name,\n            \"$(TargetName)\": target_name,\n            \"$(TargetPath)\": os.path.join(target_dir, target_file_name),\n        }\n        replacements.update(GetGlobalVSMacroEnv(self.vs_version))\n        return replacements\n\n    def ConvertVSMacros(self, s, base_to_build=None, config=None):\n        \"\"\"Convert from VS macro names to something equivalent.\"\"\"\n        env = self.GetVSMacroEnv(base_to_build, config=config)\n        return ExpandMacros(s, env)\n\n    def AdjustLibraries(self, libraries):\n        \"\"\"Strip -l from library if it's specified with that.\"\"\"\n        libs = [lib[2:] if lib.startswith(\"-l\") else lib for lib in libraries]\n        return [\n            lib + \".lib\"\n            if not lib.lower().endswith(\".lib\") and not lib.lower().endswith(\".obj\")\n            else lib\n            for lib in libs\n        ]\n\n    def _GetAndMunge(self, field, path, default, prefix, append, map):\n        \"\"\"Retrieve a value from |field| at |path| or return |default|. If\n        |append| is specified, and the item is found, it will be appended to that\n        object instead of returned. If |map| is specified, results will be\n        remapped through |map| before being returned or appended.\"\"\"\n        result = _GenericRetrieve(field, default, path)\n        result = _DoRemapping(result, map)\n        result = _AddPrefix(result, prefix)\n        return _AppendOrReturn(append, result)\n\n    class _GetWrapper:\n        def __init__(self, parent, field, base_path, append=None):\n            self.parent = parent\n            self.field = field\n            self.base_path = [base_path]\n            self.append = append\n\n        def __call__(self, name, map=None, prefix=\"\", default=None):\n            return self.parent._GetAndMunge(\n                self.field,\n                self.base_path + [name],\n                default=default,\n                prefix=prefix,\n                append=self.append,\n                map=map,\n            )\n\n    def GetArch(self, config):\n        \"\"\"Get architecture based on msvs_configuration_platform and\n        msvs_target_platform. Returns either 'x86' or 'x64'.\"\"\"\n        configuration_platform = self.msvs_configuration_platform.get(config, \"\")\n        platform = self.msvs_target_platform.get(config, \"\")\n        if not platform:  # If no specific override, use the configuration's.\n            platform = configuration_platform\n        # Map from platform to architecture.\n        return {\"Win32\": \"x86\", \"x64\": \"x64\", \"ARM64\": \"arm64\"}.get(platform, \"x86\")\n\n    def _TargetConfig(self, config):\n        \"\"\"Returns the target-specific configuration.\"\"\"\n        # There's two levels of architecture/platform specification in VS. The\n        # first level is globally for the configuration (this is what we consider\n        # \"the\" config at the gyp level, which will be something like 'Debug' or\n        # 'Release'), VS2015 and later only use this level\n        if int(self.vs_version.short_name) >= 2015:\n            return config\n        # and a second target-specific configuration, which is an\n        # override for the global one. |config| is remapped here to take into\n        # account the local target-specific overrides to the global configuration.\n        arch = self.GetArch(config)\n        if arch == \"x64\" and not config.endswith(\"_x64\"):\n            config += \"_x64\"\n        if arch == \"x86\" and config.endswith(\"_x64\"):\n            config = config.rsplit(\"_\", 1)[0]\n        return config\n\n    def _Setting(self, path, config, default=None, prefix=\"\", append=None, map=None):\n        \"\"\"_GetAndMunge for msvs_settings.\"\"\"\n        return self._GetAndMunge(\n            self.msvs_settings[config], path, default, prefix, append, map\n        )\n\n    def _ConfigAttrib(\n        self, path, config, default=None, prefix=\"\", append=None, map=None\n    ):\n        \"\"\"_GetAndMunge for msvs_configuration_attributes.\"\"\"\n        return self._GetAndMunge(\n            self.msvs_configuration_attributes[config],\n            path,\n            default,\n            prefix,\n            append,\n            map,\n        )\n\n    def AdjustIncludeDirs(self, include_dirs, config):\n        \"\"\"Updates include_dirs to expand VS specific paths, and adds the system\n        include dirs used for platform SDK and similar.\"\"\"\n        config = self._TargetConfig(config)\n        includes = include_dirs + self.msvs_system_include_dirs[config]\n        includes.extend(\n            self._Setting(\n                (\"VCCLCompilerTool\", \"AdditionalIncludeDirectories\"), config, default=[]\n            )\n        )\n        return [self.ConvertVSMacros(p, config=config) for p in includes]\n\n    def AdjustMidlIncludeDirs(self, midl_include_dirs, config):\n        \"\"\"Updates midl_include_dirs to expand VS specific paths, and adds the\n        system include dirs used for platform SDK and similar.\"\"\"\n        config = self._TargetConfig(config)\n        includes = midl_include_dirs + self.msvs_system_include_dirs[config]\n        includes.extend(\n            self._Setting(\n                (\"VCMIDLTool\", \"AdditionalIncludeDirectories\"), config, default=[]\n            )\n        )\n        return [self.ConvertVSMacros(p, config=config) for p in includes]\n\n    def GetComputedDefines(self, config):\n        \"\"\"Returns the set of defines that are injected to the defines list based\n        on other VS settings.\"\"\"\n        config = self._TargetConfig(config)\n        defines = []\n        if self._ConfigAttrib([\"CharacterSet\"], config) == \"1\":\n            defines.extend((\"_UNICODE\", \"UNICODE\"))\n        if self._ConfigAttrib([\"CharacterSet\"], config) == \"2\":\n            defines.append(\"_MBCS\")\n        defines.extend(\n            self._Setting(\n                (\"VCCLCompilerTool\", \"PreprocessorDefinitions\"), config, default=[]\n            )\n        )\n        return defines\n\n    def GetCompilerPdbName(self, config, expand_special):\n        \"\"\"Get the pdb file name that should be used for compiler invocations, or\n        None if there's no explicit name specified.\"\"\"\n        config = self._TargetConfig(config)\n        pdbname = self._Setting((\"VCCLCompilerTool\", \"ProgramDataBaseFileName\"), config)\n        if pdbname:\n            pdbname = expand_special(self.ConvertVSMacros(pdbname))\n        return pdbname\n\n    def GetMapFileName(self, config, expand_special):\n        \"\"\"Gets the explicitly overridden map file name for a target or returns None\n        if it's not set.\"\"\"\n        config = self._TargetConfig(config)\n        map_file = self._Setting((\"VCLinkerTool\", \"MapFileName\"), config)\n        if map_file:\n            map_file = expand_special(self.ConvertVSMacros(map_file, config=config))\n        return map_file\n\n    def GetOutputName(self, config, expand_special):\n        \"\"\"Gets the explicitly overridden output name for a target or returns None\n        if it's not overridden.\"\"\"\n        config = self._TargetConfig(config)\n        type = self.spec[\"type\"]\n        root = \"VCLibrarianTool\" if type == \"static_library\" else \"VCLinkerTool\"\n        # TODO(scottmg): Handle OutputDirectory without OutputFile.\n        output_file = self._Setting((root, \"OutputFile\"), config)\n        if output_file:\n            output_file = expand_special(\n                self.ConvertVSMacros(output_file, config=config)\n            )\n        return output_file\n\n    def GetPDBName(self, config, expand_special, default):\n        \"\"\"Gets the explicitly overridden pdb name for a target or returns\n        default if it's not overridden, or if no pdb will be generated.\"\"\"\n        config = self._TargetConfig(config)\n        output_file = self._Setting((\"VCLinkerTool\", \"ProgramDatabaseFile\"), config)\n        generate_debug_info = self._Setting(\n            (\"VCLinkerTool\", \"GenerateDebugInformation\"), config\n        )\n        if generate_debug_info == \"true\":\n            if output_file:\n                return expand_special(self.ConvertVSMacros(output_file, config=config))\n            else:\n                return default\n        else:\n            return None\n\n    def GetNoImportLibrary(self, config):\n        \"\"\"If NoImportLibrary: true, ninja will not expect the output to include\n        an import library.\"\"\"\n        config = self._TargetConfig(config)\n        noimplib = self._Setting((\"NoImportLibrary\",), config)\n        return noimplib == \"true\"\n\n    def GetAsmflags(self, config):\n        \"\"\"Returns the flags that need to be added to ml invocations.\"\"\"\n        config = self._TargetConfig(config)\n        asmflags = []\n        safeseh = self._Setting((\"MASM\", \"UseSafeExceptionHandlers\"), config)\n        if safeseh == \"true\":\n            asmflags.append(\"/safeseh\")\n        return asmflags\n\n    def GetCflags(self, config):\n        \"\"\"Returns the flags that need to be added to .c and .cc compilations.\"\"\"\n        config = self._TargetConfig(config)\n        cflags = []\n        cflags.extend([\"/wd\" + w for w in self.msvs_disabled_warnings[config]])\n        cl = self._GetWrapper(\n            self, self.msvs_settings[config], \"VCCLCompilerTool\", append=cflags\n        )\n        cl(\n            \"Optimization\",\n            map={\"0\": \"d\", \"1\": \"1\", \"2\": \"2\", \"3\": \"x\"},\n            prefix=\"/O\",\n            default=\"2\",\n        )\n        cl(\"InlineFunctionExpansion\", prefix=\"/Ob\")\n        cl(\"DisableSpecificWarnings\", prefix=\"/wd\")\n        cl(\"StringPooling\", map={\"true\": \"/GF\"})\n        cl(\"EnableFiberSafeOptimizations\", map={\"true\": \"/GT\"})\n        cl(\"OmitFramePointers\", map={\"false\": \"-\", \"true\": \"\"}, prefix=\"/Oy\")\n        cl(\"EnableIntrinsicFunctions\", map={\"false\": \"-\", \"true\": \"\"}, prefix=\"/Oi\")\n        cl(\"FavorSizeOrSpeed\", map={\"1\": \"t\", \"2\": \"s\"}, prefix=\"/O\")\n        cl(\n            \"FloatingPointModel\",\n            map={\"0\": \"precise\", \"1\": \"strict\", \"2\": \"fast\"},\n            prefix=\"/fp:\",\n            default=\"0\",\n        )\n        cl(\"CompileAsManaged\", map={\"false\": \"\", \"true\": \"/clr\"})\n        cl(\"WholeProgramOptimization\", map={\"true\": \"/GL\"})\n        cl(\"WarningLevel\", prefix=\"/W\")\n        cl(\"WarnAsError\", map={\"true\": \"/WX\"})\n        cl(\n            \"CallingConvention\",\n            map={\"0\": \"d\", \"1\": \"r\", \"2\": \"z\", \"3\": \"v\"},\n            prefix=\"/G\",\n        )\n        cl(\"DebugInformationFormat\", map={\"1\": \"7\", \"3\": \"i\", \"4\": \"I\"}, prefix=\"/Z\")\n        cl(\"RuntimeTypeInfo\", map={\"true\": \"/GR\", \"false\": \"/GR-\"})\n        cl(\"EnableFunctionLevelLinking\", map={\"true\": \"/Gy\", \"false\": \"/Gy-\"})\n        cl(\"MinimalRebuild\", map={\"true\": \"/Gm\"})\n        cl(\"BufferSecurityCheck\", map={\"true\": \"/GS\", \"false\": \"/GS-\"})\n        cl(\"BasicRuntimeChecks\", map={\"1\": \"s\", \"2\": \"u\", \"3\": \"1\"}, prefix=\"/RTC\")\n        cl(\n            \"RuntimeLibrary\",\n            map={\"0\": \"T\", \"1\": \"Td\", \"2\": \"D\", \"3\": \"Dd\"},\n            prefix=\"/M\",\n        )\n        cl(\"ExceptionHandling\", map={\"1\": \"sc\", \"2\": \"a\"}, prefix=\"/EH\")\n        cl(\"DefaultCharIsUnsigned\", map={\"true\": \"/J\"})\n        cl(\n            \"TreatWChar_tAsBuiltInType\",\n            map={\"false\": \"-\", \"true\": \"\"},\n            prefix=\"/Zc:wchar_t\",\n        )\n        cl(\"EnablePREfast\", map={\"true\": \"/analyze\"})\n        cl(\"AdditionalOptions\", prefix=\"\")\n        cl(\n            \"EnableEnhancedInstructionSet\",\n            map={\"1\": \"SSE\", \"2\": \"SSE2\", \"3\": \"AVX\", \"4\": \"IA32\", \"5\": \"AVX2\"},\n            prefix=\"/arch:\",\n        )\n        cflags.extend(\n            [\n                \"/FI\" + f\n                for f in self._Setting(\n                    (\"VCCLCompilerTool\", \"ForcedIncludeFiles\"), config, default=[]\n                )\n            ]\n        )\n        if float(self.vs_version.project_version) >= 12.0:\n            # New flag introduced in VS2013 (project version 12.0) Forces writes to\n            # the program database (PDB) to be serialized through MSPDBSRV.EXE.\n            # https://msdn.microsoft.com/en-us/library/dn502518.aspx\n            cflags.append(\"/FS\")\n        # ninja handles parallelism by itself, don't have the compiler do it too.\n        cflags = [x for x in cflags if not x.startswith(\"/MP\")]\n        return cflags\n\n    def _GetPchFlags(self, config, extension):\n        \"\"\"Get the flags to be added to the cflags for precompiled header support.\"\"\"\n        config = self._TargetConfig(config)\n        # The PCH is only built once by a particular source file. Usage of PCH must\n        # only be for the same language (i.e. C vs. C++), so only include the pch\n        # flags when the language matches.\n        if self.msvs_precompiled_header[config]:\n            source_ext = os.path.splitext(self.msvs_precompiled_source[config])[1]\n            if _LanguageMatchesForPch(source_ext, extension):\n                pch = self.msvs_precompiled_header[config]\n                pchbase = os.path.split(pch)[1]\n                return [\"/Yu\" + pch, \"/FI\" + pch, \"/Fp${pchprefix}.\" + pchbase + \".pch\"]\n        return []\n\n    def GetCflagsC(self, config):\n        \"\"\"Returns the flags that need to be added to .c compilations.\"\"\"\n        config = self._TargetConfig(config)\n        return self._GetPchFlags(config, \".c\")\n\n    def GetCflagsCC(self, config):\n        \"\"\"Returns the flags that need to be added to .cc compilations.\"\"\"\n        config = self._TargetConfig(config)\n        return [\"/TP\"] + self._GetPchFlags(config, \".cc\")\n\n    def _GetAdditionalLibraryDirectories(self, root, config, gyp_to_build_path):\n        \"\"\"Get and normalize the list of paths in AdditionalLibraryDirectories\n        setting.\"\"\"\n        config = self._TargetConfig(config)\n        libpaths = self._Setting(\n            (root, \"AdditionalLibraryDirectories\"), config, default=[]\n        )\n        libpaths = [\n            os.path.normpath(gyp_to_build_path(self.ConvertVSMacros(p, config=config)))\n            for p in libpaths\n        ]\n        return ['/LIBPATH:\"' + p + '\"' for p in libpaths]\n\n    def GetLibFlags(self, config, gyp_to_build_path):\n        \"\"\"Returns the flags that need to be added to lib commands.\"\"\"\n        config = self._TargetConfig(config)\n        libflags = []\n        lib = self._GetWrapper(\n            self, self.msvs_settings[config], \"VCLibrarianTool\", append=libflags\n        )\n        libflags.extend(\n            self._GetAdditionalLibraryDirectories(\n                \"VCLibrarianTool\", config, gyp_to_build_path\n            )\n        )\n        lib(\"LinkTimeCodeGeneration\", map={\"true\": \"/LTCG\"})\n        lib(\n            \"TargetMachine\",\n            map={\"1\": \"X86\", \"17\": \"X64\", \"3\": \"ARM\"},\n            prefix=\"/MACHINE:\",\n        )\n        lib(\"AdditionalOptions\")\n        return libflags\n\n    def GetDefFile(self, gyp_to_build_path):\n        \"\"\"Returns the .def file from sources, if any.  Otherwise returns None.\"\"\"\n        spec = self.spec\n        if spec[\"type\"] in (\"shared_library\", \"loadable_module\", \"executable\"):\n            def_files = [\n                s for s in spec.get(\"sources\", []) if s.lower().endswith(\".def\")\n            ]\n            if len(def_files) == 1:\n                return gyp_to_build_path(def_files[0])\n            elif len(def_files) > 1:\n                raise Exception(\"Multiple .def files\")\n        return None\n\n    def _GetDefFileAsLdflags(self, ldflags, gyp_to_build_path):\n        \"\"\".def files get implicitly converted to a ModuleDefinitionFile for the\n        linker in the VS generator. Emulate that behaviour here.\"\"\"\n        if def_file := self.GetDefFile(gyp_to_build_path):\n            ldflags.append('/DEF:\"%s\"' % def_file)\n\n    def GetPGDName(self, config, expand_special):\n        \"\"\"Gets the explicitly overridden pgd name for a target or returns None\n        if it's not overridden.\"\"\"\n        config = self._TargetConfig(config)\n        output_file = self._Setting((\"VCLinkerTool\", \"ProfileGuidedDatabase\"), config)\n        if output_file:\n            output_file = expand_special(\n                self.ConvertVSMacros(output_file, config=config)\n            )\n        return output_file\n\n    def GetLdflags(\n        self,\n        config,\n        gyp_to_build_path,\n        expand_special,\n        manifest_base_name,\n        output_name,\n        is_executable,\n        build_dir,\n    ):\n        \"\"\"Returns the flags that need to be added to link commands, and the\n        manifest files.\"\"\"\n        config = self._TargetConfig(config)\n        ldflags = []\n        ld = self._GetWrapper(\n            self, self.msvs_settings[config], \"VCLinkerTool\", append=ldflags\n        )\n        self._GetDefFileAsLdflags(ldflags, gyp_to_build_path)\n        ld(\"GenerateDebugInformation\", map={\"true\": \"/DEBUG\"})\n        # TODO: These 'map' values come from machineTypeOption enum,\n        # and does not have an official value for ARM64 in VS2017 (yet).\n        # It needs to verify the ARM64 value when machineTypeOption is updated.\n        ld(\n            \"TargetMachine\",\n            map={\"1\": \"X86\", \"17\": \"X64\", \"3\": \"ARM\", \"18\": \"ARM64\"},\n            prefix=\"/MACHINE:\",\n        )\n        ldflags.extend(\n            self._GetAdditionalLibraryDirectories(\n                \"VCLinkerTool\", config, gyp_to_build_path\n            )\n        )\n        ld(\"DelayLoadDLLs\", prefix=\"/DELAYLOAD:\")\n        ld(\"TreatLinkerWarningAsErrors\", prefix=\"/WX\", map={\"true\": \"\", \"false\": \":NO\"})\n        if out := self.GetOutputName(config, expand_special):\n            ldflags.append(\"/OUT:\" + out)\n        if pdb := self.GetPDBName(config, expand_special, output_name + \".pdb\"):\n            ldflags.append(\"/PDB:\" + pdb)\n        if pgd := self.GetPGDName(config, expand_special):\n            ldflags.append(\"/PGD:\" + pgd)\n        map_file = self.GetMapFileName(config, expand_special)\n        ld(\"GenerateMapFile\", map={\"true\": \"/MAP:\" + map_file if map_file else \"/MAP\"})\n        ld(\"MapExports\", map={\"true\": \"/MAPINFO:EXPORTS\"})\n        ld(\"AdditionalOptions\", prefix=\"\")\n\n        minimum_required_version = self._Setting(\n            (\"VCLinkerTool\", \"MinimumRequiredVersion\"), config, default=\"\"\n        )\n        if minimum_required_version:\n            minimum_required_version = \",\" + minimum_required_version\n        ld(\n            \"SubSystem\",\n            map={\n                \"1\": \"CONSOLE%s\" % minimum_required_version,\n                \"2\": \"WINDOWS%s\" % minimum_required_version,\n            },\n            prefix=\"/SUBSYSTEM:\",\n        )\n\n        stack_reserve_size = self._Setting(\n            (\"VCLinkerTool\", \"StackReserveSize\"), config, default=\"\"\n        )\n        if stack_reserve_size:\n            stack_commit_size = self._Setting(\n                (\"VCLinkerTool\", \"StackCommitSize\"), config, default=\"\"\n            )\n            if stack_commit_size:\n                stack_commit_size = \",\" + stack_commit_size\n            ldflags.append(f\"/STACK:{stack_reserve_size}{stack_commit_size}\")\n\n        ld(\"TerminalServerAware\", map={\"1\": \":NO\", \"2\": \"\"}, prefix=\"/TSAWARE\")\n        ld(\"LinkIncremental\", map={\"1\": \":NO\", \"2\": \"\"}, prefix=\"/INCREMENTAL\")\n        ld(\"BaseAddress\", prefix=\"/BASE:\")\n        ld(\"FixedBaseAddress\", map={\"1\": \":NO\", \"2\": \"\"}, prefix=\"/FIXED\")\n        ld(\"RandomizedBaseAddress\", map={\"1\": \":NO\", \"2\": \"\"}, prefix=\"/DYNAMICBASE\")\n        ld(\"DataExecutionPrevention\", map={\"1\": \":NO\", \"2\": \"\"}, prefix=\"/NXCOMPAT\")\n        ld(\"OptimizeReferences\", map={\"1\": \"NOREF\", \"2\": \"REF\"}, prefix=\"/OPT:\")\n        ld(\"ForceSymbolReferences\", prefix=\"/INCLUDE:\")\n        ld(\"EnableCOMDATFolding\", map={\"1\": \"NOICF\", \"2\": \"ICF\"}, prefix=\"/OPT:\")\n        ld(\n            \"LinkTimeCodeGeneration\",\n            map={\"1\": \"\", \"2\": \":PGINSTRUMENT\", \"3\": \":PGOPTIMIZE\", \"4\": \":PGUPDATE\"},\n            prefix=\"/LTCG\",\n        )\n        ld(\"IgnoreDefaultLibraryNames\", prefix=\"/NODEFAULTLIB:\")\n        ld(\"ResourceOnlyDLL\", map={\"true\": \"/NOENTRY\"})\n        ld(\"EntryPointSymbol\", prefix=\"/ENTRY:\")\n        ld(\"Profile\", map={\"true\": \"/PROFILE\"})\n        ld(\"LargeAddressAware\", map={\"1\": \":NO\", \"2\": \"\"}, prefix=\"/LARGEADDRESSAWARE\")\n        # TODO(scottmg): This should sort of be somewhere else (not really a flag).\n        ld(\"AdditionalDependencies\", prefix=\"\")\n\n        safeseh_default = \"true\" if self.GetArch(config) == \"x86\" else None\n        ld(\n            \"ImageHasSafeExceptionHandlers\",\n            map={\"false\": \":NO\", \"true\": \"\"},\n            prefix=\"/SAFESEH\",\n            default=safeseh_default,\n        )\n\n        # If the base address is not specifically controlled, DYNAMICBASE should\n        # be on by default.\n        if not any(\"DYNAMICBASE\" in flag or flag == \"/FIXED\" for flag in ldflags):\n            ldflags.append(\"/DYNAMICBASE\")\n\n        # If the NXCOMPAT flag has not been specified, default to on. Despite the\n        # documentation that says this only defaults to on when the subsystem is\n        # Vista or greater (which applies to the linker), the IDE defaults it on\n        # unless it's explicitly off.\n        if not any(\"NXCOMPAT\" in flag for flag in ldflags):\n            ldflags.append(\"/NXCOMPAT\")\n\n        have_def_file = any(flag.startswith(\"/DEF:\") for flag in ldflags)\n        (\n            manifest_flags,\n            intermediate_manifest,\n            manifest_files,\n        ) = self._GetLdManifestFlags(\n            config,\n            manifest_base_name,\n            gyp_to_build_path,\n            is_executable and not have_def_file,\n            build_dir,\n        )\n        ldflags.extend(manifest_flags)\n        return ldflags, intermediate_manifest, manifest_files\n\n    def _GetLdManifestFlags(\n        self, config, name, gyp_to_build_path, allow_isolation, build_dir\n    ):\n        \"\"\"Returns a 3-tuple:\n        - the set of flags that need to be added to the link to generate\n          a default manifest\n        - the intermediate manifest that the linker will generate that should be\n          used to assert it doesn't add anything to the merged one.\n        - the list of all the manifest files to be merged by the manifest tool and\n          included into the link.\"\"\"\n        generate_manifest = self._Setting(\n            (\"VCLinkerTool\", \"GenerateManifest\"), config, default=\"true\"\n        )\n        if generate_manifest != \"true\":\n            # This means not only that the linker should not generate the intermediate\n            # manifest but also that the manifest tool should do nothing even when\n            # additional manifests are specified.\n            return [\"/MANIFEST:NO\"], [], []\n\n        output_name = name + \".intermediate.manifest\"\n        flags = [\n            \"/MANIFEST\",\n            \"/ManifestFile:\" + output_name,\n        ]\n\n        # Instead of using the MANIFESTUAC flags, we generate a .manifest to\n        # include into the list of manifests. This allows us to avoid the need to\n        # do two passes during linking. The /MANIFEST flag and /ManifestFile are\n        # still used, and the intermediate manifest is used to assert that the\n        # final manifest we get from merging all the additional manifest files\n        # (plus the one we generate here) isn't modified by merging the\n        # intermediate into it.\n\n        # Always NO, because we generate a manifest file that has what we want.\n        flags.append(\"/MANIFESTUAC:NO\")\n\n        config = self._TargetConfig(config)\n        enable_uac = self._Setting(\n            (\"VCLinkerTool\", \"EnableUAC\"), config, default=\"true\"\n        )\n        manifest_files = []\n        generated_manifest_outer = (\n            \"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\"\n            \"<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\"\n            \"%s</assembly>\"\n        )\n        if enable_uac == \"true\":\n            execution_level = self._Setting(\n                (\"VCLinkerTool\", \"UACExecutionLevel\"), config, default=\"0\"\n            )\n            execution_level_map = {\n                \"0\": \"asInvoker\",\n                \"1\": \"highestAvailable\",\n                \"2\": \"requireAdministrator\",\n            }\n\n            ui_access = self._Setting(\n                (\"VCLinkerTool\", \"UACUIAccess\"), config, default=\"false\"\n            )\n\n            level = execution_level_map[execution_level]\n            inner = f\"\"\"\n<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n  <security>\n    <requestedPrivileges>\n      <requestedExecutionLevel level='{level}' uiAccess='{ui_access}' />\n    </requestedPrivileges>\n  </security>\n</trustInfo>\"\"\"\n        else:\n            inner = \"\"\n\n        generated_manifest_contents = generated_manifest_outer % inner\n        generated_name = name + \".generated.manifest\"\n        # Need to join with the build_dir here as we're writing it during\n        # generation time, but we return the un-joined version because the build\n        # will occur in that directory. We only write the file if the contents\n        # have changed so that simply regenerating the project files doesn't\n        # cause a relink.\n        build_dir_generated_name = os.path.join(build_dir, generated_name)\n        gyp.common.EnsureDirExists(build_dir_generated_name)\n        f = gyp.common.WriteOnDiff(build_dir_generated_name)\n        f.write(generated_manifest_contents)\n        f.close()\n        manifest_files = [generated_name]\n\n        if allow_isolation:\n            flags.append(\"/ALLOWISOLATION\")\n\n        manifest_files += self._GetAdditionalManifestFiles(config, gyp_to_build_path)\n        return flags, output_name, manifest_files\n\n    def _GetAdditionalManifestFiles(self, config, gyp_to_build_path):\n        \"\"\"Gets additional manifest files that are added to the default one\n        generated by the linker.\"\"\"\n        files = self._Setting(\n            (\"VCManifestTool\", \"AdditionalManifestFiles\"), config, default=[]\n        )\n        if isinstance(files, str):\n            files = files.split(\";\")\n        return [\n            os.path.normpath(gyp_to_build_path(self.ConvertVSMacros(f, config=config)))\n            for f in files\n        ]\n\n    def IsUseLibraryDependencyInputs(self, config):\n        \"\"\"Returns whether the target should be linked via Use Library Dependency\n        Inputs (using component .objs of a given .lib).\"\"\"\n        config = self._TargetConfig(config)\n        uldi = self._Setting((\"VCLinkerTool\", \"UseLibraryDependencyInputs\"), config)\n        return uldi == \"true\"\n\n    def IsEmbedManifest(self, config):\n        \"\"\"Returns whether manifest should be linked into binary.\"\"\"\n        config = self._TargetConfig(config)\n        embed = self._Setting(\n            (\"VCManifestTool\", \"EmbedManifest\"), config, default=\"true\"\n        )\n        return embed == \"true\"\n\n    def IsLinkIncremental(self, config):\n        \"\"\"Returns whether the target should be linked incrementally.\"\"\"\n        config = self._TargetConfig(config)\n        link_inc = self._Setting((\"VCLinkerTool\", \"LinkIncremental\"), config)\n        return link_inc != \"1\"\n\n    def GetRcflags(self, config, gyp_to_ninja_path):\n        \"\"\"Returns the flags that need to be added to invocations of the resource\n        compiler.\"\"\"\n        config = self._TargetConfig(config)\n        rcflags = []\n        rc = self._GetWrapper(\n            self, self.msvs_settings[config], \"VCResourceCompilerTool\", append=rcflags\n        )\n        rc(\"AdditionalIncludeDirectories\", map=gyp_to_ninja_path, prefix=\"/I\")\n        rcflags.append(\"/I\" + gyp_to_ninja_path(\".\"))\n        rc(\"PreprocessorDefinitions\", prefix=\"/d\")\n        # /l arg must be in hex without leading '0x'\n        rc(\"Culture\", prefix=\"/l\", map=lambda x: hex(int(x))[2:])\n        return rcflags\n\n    def BuildCygwinBashCommandLine(self, args, path_to_base):\n        \"\"\"Build a command line that runs args via cygwin bash. We assume that all\n        incoming paths are in Windows normpath'd form, so they need to be\n        converted to posix style for the part of the command line that's passed to\n        bash. We also have to do some Visual Studio macro emulation here because\n        various rules use magic VS names for things. Also note that rules that\n        contain ninja variables cannot be fixed here (for example ${source}), so\n        the outer generator needs to make sure that the paths that are written out\n        are in posix style, if the command line will be used here.\"\"\"\n        cygwin_dir = os.path.normpath(\n            os.path.join(path_to_base, self.msvs_cygwin_dirs[0])\n        )\n        cd = (\"cd %s\" % path_to_base).replace(\"\\\\\", \"/\")\n        args = [a.replace(\"\\\\\", \"/\").replace('\"', '\\\\\"') for a in args]\n        args = [\"'%s'\" % a.replace(\"'\", \"'\\\\''\") for a in args]\n        bash_cmd = \" \".join(args)\n        cmd = (\n            'call \"%s\\\\setup_env.bat\" && set CYGWIN=nontsec && ' % cygwin_dir\n            + f'bash -c \"{cd} ; {bash_cmd}\"'\n        )\n        return cmd\n\n    RuleShellFlags = namedtuple(\"RuleShellFlags\", [\"cygwin\", \"quote\"])  # noqa: PYI024\n\n    def GetRuleShellFlags(self, rule):\n        \"\"\"Return RuleShellFlags about how the given rule should be run. This\n        includes whether it should run under cygwin (msvs_cygwin_shell), and\n        whether the commands should be quoted (msvs_quote_cmd).\"\"\"\n        # If the variable is unset, or set to 1 we use cygwin\n        cygwin = (\n            int(rule.get(\"msvs_cygwin_shell\", self.spec.get(\"msvs_cygwin_shell\", 1)))\n            != 0\n        )\n        # Default to quoting. There's only a few special instances where the\n        # target command uses non-standard command line parsing and handle quotes\n        # and quote escaping differently.\n        quote_cmd = int(rule.get(\"msvs_quote_cmd\", 1))\n        assert quote_cmd != 0 or cygwin != 1, (\n            \"msvs_quote_cmd=0 only applicable for msvs_cygwin_shell=0\"\n        )\n        return MsvsSettings.RuleShellFlags(cygwin, quote_cmd)\n\n    def _HasExplicitRuleForExtension(self, spec, extension):\n        \"\"\"Determine if there's an explicit rule for a particular extension.\"\"\"\n        return any(rule[\"extension\"] == extension for rule in spec.get(\"rules\", []))\n\n    def _HasExplicitIdlActions(self, spec):\n        \"\"\"Determine if an action should not run midl for .idl files.\"\"\"\n        return any(\n            action.get(\"explicit_idl_action\", 0) for action in spec.get(\"actions\", [])\n        )\n\n    def HasExplicitIdlRulesOrActions(self, spec):\n        \"\"\"Determine if there's an explicit rule or action for idl files. When\n        there isn't we need to generate implicit rules to build MIDL .idl files.\"\"\"\n        return self._HasExplicitRuleForExtension(\n            spec, \"idl\"\n        ) or self._HasExplicitIdlActions(spec)\n\n    def HasExplicitAsmRules(self, spec):\n        \"\"\"Determine if there's an explicit rule for asm files. When there isn't we\n        need to generate implicit rules to assemble .asm files.\"\"\"\n        return self._HasExplicitRuleForExtension(spec, \"asm\")\n\n    def GetIdlBuildData(self, source, config):\n        \"\"\"Determine the implicit outputs for an idl file. Returns output\n        directory, outputs, and variables and flags that are required.\"\"\"\n        config = self._TargetConfig(config)\n        midl_get = self._GetWrapper(self, self.msvs_settings[config], \"VCMIDLTool\")\n\n        def midl(name, default=None):\n            return self.ConvertVSMacros(midl_get(name, default=default), config=config)\n\n        tlb = midl(\"TypeLibraryName\", default=\"${root}.tlb\")\n        header = midl(\"HeaderFileName\", default=\"${root}.h\")\n        dlldata = midl(\"DLLDataFileName\", default=\"dlldata.c\")\n        iid = midl(\"InterfaceIdentifierFileName\", default=\"${root}_i.c\")\n        proxy = midl(\"ProxyFileName\", default=\"${root}_p.c\")\n        # Note that .tlb is not included in the outputs as it is not always\n        # generated depending on the content of the input idl file.\n        outdir = midl(\"OutputDirectory\", default=\"\")\n        output = [header, dlldata, iid, proxy]\n        variables = [\n            (\"tlb\", tlb),\n            (\"h\", header),\n            (\"dlldata\", dlldata),\n            (\"iid\", iid),\n            (\"proxy\", proxy),\n        ]\n        # TODO(scottmg): Are there configuration settings to set these flags?\n        target_platform = self.GetArch(config)\n        if target_platform == \"x86\":\n            target_platform = \"win32\"\n        flags = [\"/char\", \"signed\", \"/env\", target_platform, \"/Oicf\"]\n        return outdir, output, variables, flags\n\n\ndef _LanguageMatchesForPch(source_ext, pch_source_ext):\n    c_exts = (\".c\",)\n    cc_exts = (\".cc\", \".cxx\", \".cpp\")\n    return (source_ext in c_exts and pch_source_ext in c_exts) or (\n        source_ext in cc_exts and pch_source_ext in cc_exts\n    )\n\n\nclass PrecompiledHeader:\n    \"\"\"Helper to generate dependencies and build rules to handle generation of\n    precompiled headers. Interface matches the GCH handler in xcode_emulation.py.\n    \"\"\"\n\n    def __init__(\n        self, settings, config, gyp_to_build_path, gyp_to_unique_output, obj_ext\n    ):\n        self.settings = settings\n        self.config = config\n        pch_source = self.settings.msvs_precompiled_source[self.config]\n        self.pch_source = gyp_to_build_path(pch_source)\n        filename, _ = os.path.splitext(pch_source)\n        self.output_obj = gyp_to_unique_output(filename + obj_ext).lower()\n\n    def _PchHeader(self):\n        \"\"\"Get the header that will appear in an #include line for all source\n        files.\"\"\"\n        return self.settings.msvs_precompiled_header[self.config]\n\n    def GetObjDependencies(self, sources, objs, arch):\n        \"\"\"Given a list of sources files and the corresponding object files,\n        returns a list of the pch files that should be depended upon. The\n        additional wrapping in the return value is for interface compatibility\n        with make.py on Mac, and xcode_emulation.py.\"\"\"\n        assert arch is None\n        if not self._PchHeader():\n            return []\n        pch_ext = os.path.splitext(self.pch_source)[1]\n        for source in sources:\n            if _LanguageMatchesForPch(os.path.splitext(source)[1], pch_ext):\n                return [(None, None, self.output_obj)]\n        return []\n\n    def GetPchBuildCommands(self, arch):\n        \"\"\"Not used on Windows as there are no additional build steps required\n        (instead, existing steps are modified in GetFlagsModifications below).\"\"\"\n        return []\n\n    def GetFlagsModifications(\n        self, input, output, implicit, command, cflags_c, cflags_cc, expand_special\n    ):\n        \"\"\"Get the modified cflags and implicit dependencies that should be used\n        for the pch compilation step.\"\"\"\n        if input == self.pch_source:\n            pch_output = [\"/Yc\" + self._PchHeader()]\n            if command == \"cxx\":\n                return (\n                    [(\"cflags_cc\", map(expand_special, cflags_cc + pch_output))],\n                    self.output_obj,\n                    [],\n                )\n            elif command == \"cc\":\n                return (\n                    [(\"cflags_c\", map(expand_special, cflags_c + pch_output))],\n                    self.output_obj,\n                    [],\n                )\n        return [], output, implicit\n\n\nvs_version = None\n\n\ndef GetVSVersion(generator_flags):\n    global vs_version\n    if not vs_version:\n        vs_version = gyp.MSVSVersion.SelectVisualStudioVersion(\n            generator_flags.get(\"msvs_version\", \"auto\"), allow_fallback=False\n        )\n    return vs_version\n\n\ndef _GetVsvarsSetupArgs(generator_flags, arch):\n    vs = GetVSVersion(generator_flags)\n    return vs.SetupScript()\n\n\ndef ExpandMacros(string, expansions):\n    \"\"\"Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv\n    for the canonical way to retrieve a suitable dict.\"\"\"\n    if \"$\" in string:\n        for old, new in expansions.items():\n            assert \"$(\" not in new, new\n            string = string.replace(old, new)\n    return string\n\n\ndef _ExtractImportantEnvironment(output_of_set):\n    \"\"\"Extracts environment variables required for the toolchain to run from\n    a textual dump output by the cmd.exe 'set' command.\"\"\"\n    envvars_to_save = (\n        \"goma_.*\",  # TODO(scottmg): This is ugly, but needed for goma.\n        \"include\",\n        \"lib\",\n        \"libpath\",\n        \"path\",\n        \"pathext\",\n        \"systemroot\",\n        \"temp\",\n        \"tmp\",\n    )\n    env = {}\n    # This occasionally happens and leads to misleading SYSTEMROOT error messages\n    # if not caught here.\n    if output_of_set.count(\"=\") == 0:\n        raise Exception(\"Invalid output_of_set. Value is:\\n%s\" % output_of_set)\n    for line in output_of_set.splitlines():\n        for envvar in envvars_to_save:\n            if re.match(envvar + \"=\", line.lower()):\n                var, setting = line.split(\"=\", 1)\n                if envvar == \"path\":\n                    # Our own rules (for running gyp-win-tool) and other actions in\n                    # Chromium rely on python being in the path. Add the path to this\n                    # python here so that if it's not in the path when ninja is run\n                    # later, python will still be found.\n                    setting = os.path.dirname(sys.executable) + os.pathsep + setting\n                env[var.upper()] = setting\n                break\n    for required in (\"SYSTEMROOT\", \"TEMP\", \"TMP\"):\n        if required not in env:\n            raise Exception(\n                'Environment variable \"%s\" required to be set to valid path' % required\n            )\n    return env\n\n\ndef _FormatAsEnvironmentBlock(envvar_dict):\n    \"\"\"Format as an 'environment block' directly suitable for CreateProcess.\n    Briefly this is a list of key=value\\0, terminated by an additional \\0. See\n    CreateProcess documentation for more details.\"\"\"\n    block = \"\"\n    nul = \"\\0\"\n    for key, value in envvar_dict.items():\n        block += key + \"=\" + value + nul\n    block += nul\n    return block\n\n\ndef _ExtractCLPath(output_of_where):\n    \"\"\"Gets the path to cl.exe based on the output of calling the environment\n    setup batch file, followed by the equivalent of `where`.\"\"\"\n    # Take the first line, as that's the first found in the PATH.\n    for line in output_of_where.strip().splitlines():\n        if line.startswith(\"LOC:\"):\n            return line[len(\"LOC:\") :].strip()\n\n\ndef GenerateEnvironmentFiles(\n    toplevel_build_dir, generator_flags, system_includes, open_out\n):\n    \"\"\"It's not sufficient to have the absolute path to the compiler, linker,\n    etc. on Windows, as those tools rely on .dlls being in the PATH. We also\n    need to support both x86 and x64 compilers within the same build (to support\n    msvs_target_platform hackery). Different architectures require a different\n    compiler binary, and different supporting environment variables (INCLUDE,\n    LIB, LIBPATH). So, we extract the environment here, wrap all invocations\n    of compiler tools (cl, link, lib, rc, midl, etc.) via win_tool.py which\n    sets up the environment, and then we do not prefix the compiler with\n    an absolute path, instead preferring something like \"cl.exe\" in the rule\n    which will then run whichever the environment setup has put in the path.\n    When the following procedure to generate environment files does not\n    meet your requirement (e.g. for custom toolchains), you can pass\n    \"-G ninja_use_custom_environment_files\" to the gyp to suppress file\n    generation and use custom environment files prepared by yourself.\"\"\"\n    archs = (\"x86\", \"x64\")\n    if generator_flags.get(\"ninja_use_custom_environment_files\", 0):\n        cl_paths = {}\n        for arch in archs:\n            cl_paths[arch] = \"cl.exe\"\n        return cl_paths\n    vs = GetVSVersion(generator_flags)\n    cl_paths = {}\n    for arch in archs:\n        # Extract environment variables for subprocesses.\n        args = vs.SetupScript(arch)\n        args.extend((\"&&\", \"set\"))\n        popen = subprocess.Popen(\n            args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n        )\n        variables = popen.communicate()[0].decode(\"utf-8\")\n        if popen.returncode != 0:\n            raise Exception('\"%s\" failed with error %d' % (args, popen.returncode))\n        env = _ExtractImportantEnvironment(variables)\n\n        # Inject system includes from gyp files into INCLUDE.\n        if system_includes:\n            system_includes = system_includes | OrderedSet(\n                env.get(\"INCLUDE\", \"\").split(\";\")\n            )\n            env[\"INCLUDE\"] = \";\".join(system_includes)\n\n        env_block = _FormatAsEnvironmentBlock(env)\n        f = open_out(os.path.join(toplevel_build_dir, \"environment.\" + arch), \"w\")\n        f.write(env_block)\n        f.close()\n\n        # Find cl.exe location for this architecture.\n        args = vs.SetupScript(arch)\n        args.extend(\n            (\"&&\", \"for\", \"%i\", \"in\", \"(cl.exe)\", \"do\", \"@echo\", \"LOC:%~$PATH:i\")\n        )\n        popen = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE)\n        output = popen.communicate()[0].decode(\"utf-8\")\n        cl_paths[arch] = _ExtractCLPath(output)\n    return cl_paths\n\n\ndef VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja):\n    \"\"\"Emulate behavior of msvs_error_on_missing_sources present in the msvs\n    generator: Check that all regular source files, i.e. not created at run time,\n    exist on disk. Missing files cause needless recompilation when building via\n    VS, and we want this check to match for people/bots that build using ninja,\n    so they're not surprised when the VS build fails.\"\"\"\n    if int(generator_flags.get(\"msvs_error_on_missing_sources\", 0)):\n        no_specials = filter(lambda x: \"$\" not in x, sources)\n        relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials]\n        missing = [x for x in relative if not os.path.exists(x)]\n        if missing:\n            # They'll look like out\\Release\\..\\..\\stuff\\things.cc, so normalize the\n            # path for a slightly less crazy looking output.\n            cleaned_up = [os.path.normpath(x) for x in missing]\n            raise Exception(\"Missing input files:\\n%s\" % \"\\n\".join(cleaned_up))\n\n\n# Sets some values in default_variables, which are required for many\n# generators, run on Windows.\ndef CalculateCommonVariables(default_variables, params):\n    generator_flags = params.get(\"generator_flags\", {})\n\n    # Set a variable so conditions can be based on msvs_version.\n    msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags)\n    default_variables[\"MSVS_VERSION\"] = msvs_version.ShortName()\n\n    # To determine processor word size on Windows, in addition to checking\n    # PROCESSOR_ARCHITECTURE (which reflects the word size of the current\n    # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which\n    # contains the actual word size of the system when running thru WOW64).\n    if \"64\" in os.environ.get(\"PROCESSOR_ARCHITECTURE\", \"\") or \"64\" in os.environ.get(\n        \"PROCESSOR_ARCHITEW6432\", \"\"\n    ):\n        default_variables[\"MSVS_OS_BITS\"] = 64\n    else:\n        default_variables[\"MSVS_OS_BITS\"] = 32\n"
  },
  {
    "path": "gyp/pylib/gyp/ninja_syntax.py",
    "content": "# This file comes from\n#   https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py\n# Do not edit!  Edit the upstream one instead.\n\n\"\"\"Python module for generating .ninja files.\n\nNote that this is emphatically not a required piece of Ninja; it's\njust a helpful utility for build-file-generation systems that already\nuse Python.\n\"\"\"\n\nimport textwrap\n\n\ndef escape_path(word):\n    return word.replace(\"$ \", \"$$ \").replace(\" \", \"$ \").replace(\":\", \"$:\")\n\n\nclass Writer:\n    def __init__(self, output, width=78):\n        self.output = output\n        self.width = width\n\n    def newline(self):\n        self.output.write(\"\\n\")\n\n    def comment(self, text):\n        for line in textwrap.wrap(text, self.width - 2):\n            self.output.write(\"# \" + line + \"\\n\")\n\n    def variable(self, key, value, indent=0):\n        if value is None:\n            return\n        if isinstance(value, list):\n            value = \" \".join(filter(None, value))  # Filter out empty strings.\n        self._line(f\"{key} = {value}\", indent)\n\n    def pool(self, name, depth):\n        self._line(\"pool %s\" % name)\n        self.variable(\"depth\", depth, indent=1)\n\n    def rule(\n        self,\n        name,\n        command,\n        description=None,\n        depfile=None,\n        generator=False,\n        pool=None,\n        restat=False,\n        rspfile=None,\n        rspfile_content=None,\n        deps=None,\n    ):\n        self._line(\"rule %s\" % name)\n        self.variable(\"command\", command, indent=1)\n        if description:\n            self.variable(\"description\", description, indent=1)\n        if depfile:\n            self.variable(\"depfile\", depfile, indent=1)\n        if generator:\n            self.variable(\"generator\", \"1\", indent=1)\n        if pool:\n            self.variable(\"pool\", pool, indent=1)\n        if restat:\n            self.variable(\"restat\", \"1\", indent=1)\n        if rspfile:\n            self.variable(\"rspfile\", rspfile, indent=1)\n        if rspfile_content:\n            self.variable(\"rspfile_content\", rspfile_content, indent=1)\n        if deps:\n            self.variable(\"deps\", deps, indent=1)\n\n    def build(\n        self, outputs, rule, inputs=None, implicit=None, order_only=None, variables=None\n    ):\n        outputs = self._as_list(outputs)\n        all_inputs = self._as_list(inputs)[:]\n        out_outputs = list(map(escape_path, outputs))\n        all_inputs = list(map(escape_path, all_inputs))\n\n        if implicit:\n            implicit = map(escape_path, self._as_list(implicit))\n            all_inputs.append(\"|\")\n            all_inputs.extend(implicit)\n        if order_only:\n            order_only = map(escape_path, self._as_list(order_only))\n            all_inputs.append(\"||\")\n            all_inputs.extend(order_only)\n\n        self._line(\n            \"build {}: {}\".format(\" \".join(out_outputs), \" \".join([rule] + all_inputs))\n        )\n\n        if variables:\n            if isinstance(variables, dict):\n                iterator = iter(variables.items())\n            else:\n                iterator = iter(variables)\n\n            for key, val in iterator:\n                self.variable(key, val, indent=1)\n\n        return outputs\n\n    def include(self, path):\n        self._line(\"include %s\" % path)\n\n    def subninja(self, path):\n        self._line(\"subninja %s\" % path)\n\n    def default(self, paths):\n        self._line(\"default %s\" % \" \".join(self._as_list(paths)))\n\n    def _count_dollars_before_index(self, s, i):\n        \"\"\"Returns the number of '$' characters right in front of s[i].\"\"\"\n        dollar_count = 0\n        dollar_index = i - 1\n        while dollar_index > 0 and s[dollar_index] == \"$\":\n            dollar_count += 1\n            dollar_index -= 1\n        return dollar_count\n\n    def _line(self, text, indent=0):\n        \"\"\"Write 'text' word-wrapped at self.width characters.\"\"\"\n        leading_space = \"  \" * indent\n        while len(leading_space) + len(text) > self.width:\n            # The text is too wide; wrap if possible.\n\n            # Find the rightmost space that would obey our width constraint and\n            # that's not an escaped space.\n            available_space = self.width - len(leading_space) - len(\" $\")\n            space = available_space\n            while True:\n                space = text.rfind(\" \", 0, space)\n                if space < 0 or self._count_dollars_before_index(text, space) % 2 == 0:\n                    break\n\n            if space < 0:\n                # No such space; just use the first unescaped space we can find.\n                space = available_space - 1\n                while True:\n                    space = text.find(\" \", space + 1)\n                    if (\n                        space < 0\n                        or self._count_dollars_before_index(text, space) % 2 == 0\n                    ):\n                        break\n            if space < 0:\n                # Give up on breaking.\n                break\n\n            self.output.write(leading_space + text[0:space] + \" $\\n\")\n            text = text[space + 1 :]\n\n            # Subsequent lines are continuations, so indent them.\n            leading_space = \"  \" * (indent + 2)\n\n        self.output.write(leading_space + text + \"\\n\")\n\n    def _as_list(self, input):\n        if input is None:\n            return []\n        if isinstance(input, list):\n            return input\n        return [input]\n\n\ndef escape(string):\n    \"\"\"Escape a string such that it can be embedded into a Ninja file without\n    further interpretation.\"\"\"\n    assert \"\\n\" not in string, \"Ninja syntax does not allow newlines\"\n    # We only have one special metacharacter: '$'.\n    return string.replace(\"$\", \"$$\")\n"
  },
  {
    "path": "gyp/pylib/gyp/simple_copy.py",
    "content": "# Copyright 2014 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"A clone of the default copy.deepcopy that doesn't handle cyclic\nstructures or complex types except for dicts and lists. This is\nbecause gyp copies so large structure that small copy overhead ends up\ntaking seconds in a project the size of Chromium.\"\"\"\n\n\nclass Error(Exception):\n    pass\n\n\n__all__ = [\"Error\", \"deepcopy\"]\n\n\ndef deepcopy(x):\n    \"\"\"Deep copy operation on gyp objects such as strings, ints, dicts\n    and lists. More than twice as fast as copy.deepcopy but much less\n    generic.\"\"\"\n\n    try:\n        return _deepcopy_dispatch[type(x)](x)\n    except KeyError:\n        raise Error(\n            \"Unsupported type %s for deepcopy. Use copy.deepcopy \"\n            + \"or expand simple_copy support.\" % type(x)\n        )\n\n\n_deepcopy_dispatch = d = {}\n\n\ndef _deepcopy_atomic(x):\n    return x\n\n\ntypes = bool, float, int, str, type, type(None)\n\nfor x in types:\n    d[x] = _deepcopy_atomic\n\n\ndef _deepcopy_list(x):\n    return [deepcopy(a) for a in x]\n\n\nd[list] = _deepcopy_list\n\n\ndef _deepcopy_dict(x):\n    y = {}\n    for key, value in x.items():\n        y[deepcopy(key)] = deepcopy(value)\n    return y\n\n\nd[dict] = _deepcopy_dict\n\ndel d\n"
  },
  {
    "path": "gyp/pylib/gyp/win_tool.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Utility functions for Windows builds.\n\nThese functions are executed via gyp-win-tool when using the ninja generator.\n\"\"\"\n\nimport os\nimport re\nimport shutil\nimport stat\nimport string\nimport subprocess\nimport sys\n\nBASE_DIR = os.path.dirname(os.path.abspath(__file__))\n\n# A regex matching an argument corresponding to the output filename passed to\n# link.exe.\n_LINK_EXE_OUT_ARG = re.compile(\"/OUT:(?P<out>.+)$\", re.IGNORECASE)\n\n\ndef main(args):\n    executor = WinTool()\n    if (exit_code := executor.Dispatch(args)) is not None:\n        sys.exit(exit_code)\n\n\nclass WinTool:\n    \"\"\"This class performs all the Windows tooling steps. The methods can either\n    be executed directly, or dispatched from an argument list.\"\"\"\n\n    def _UseSeparateMspdbsrv(self, env, args):\n        \"\"\"Allows to use a unique instance of mspdbsrv.exe per linker instead of a\n        shared one.\"\"\"\n        if len(args) < 1:\n            raise Exception(\"Not enough arguments\")\n\n        if args[0] != \"link.exe\":\n            return\n\n        # Use the output filename passed to the linker to generate an endpoint name\n        # for mspdbsrv.exe.\n        endpoint_name = None\n        for arg in args:\n            m = _LINK_EXE_OUT_ARG.match(arg)\n            if m:\n                endpoint_name = re.sub(\n                    r\"\\W+\", \"\", \"%s_%d\" % (m.group(\"out\"), os.getpid())\n                )\n                break\n\n        if endpoint_name is None:\n            return\n\n        # Adds the appropriate environment variable. This will be read by link.exe\n        # to know which instance of mspdbsrv.exe it should connect to (if it's\n        # not set then the default endpoint is used).\n        env[\"_MSPDBSRV_ENDPOINT_\"] = endpoint_name\n\n    def Dispatch(self, args):\n        \"\"\"Dispatches a string command to a method.\"\"\"\n        if len(args) < 1:\n            raise Exception(\"Not enough arguments\")\n\n        method = \"Exec%s\" % self._CommandifyName(args[0])\n        return getattr(self, method)(*args[1:])\n\n    def _CommandifyName(self, name_string):\n        \"\"\"Transforms a tool name like recursive-mirror to RecursiveMirror.\"\"\"\n        return name_string.title().replace(\"-\", \"\")\n\n    def _GetEnv(self, arch):\n        \"\"\"Gets the saved environment from a file for a given architecture.\"\"\"\n        # The environment is saved as an \"environment block\" (see CreateProcess\n        # and msvs_emulation for details). We convert to a dict here.\n        # Drop last 2 NULs, one for list terminator, one for trailing vs. separator.\n        pairs = open(arch).read()[:-2].split(\"\\0\")\n        kvs = [item.split(\"=\", 1) for item in pairs]\n        return dict(kvs)\n\n    def ExecStamp(self, path):\n        \"\"\"Simple stamp command.\"\"\"\n        open(path, \"w\").close()\n\n    def ExecRecursiveMirror(self, source, dest):\n        \"\"\"Emulation of rm -rf out && cp -af in out.\"\"\"\n        if os.path.exists(dest):\n            if os.path.isdir(dest):\n\n                def _on_error(fn, path, excinfo):\n                    # The operation failed, possibly because the file is set to\n                    # read-only. If that's why, make it writable and try the op again.\n                    if not os.access(path, os.W_OK):\n                        os.chmod(path, stat.S_IWRITE)\n                    fn(path)\n\n                shutil.rmtree(dest, onerror=_on_error)\n            else:\n                if not os.access(dest, os.W_OK):\n                    # Attempt to make the file writable before deleting it.\n                    os.chmod(dest, stat.S_IWRITE)\n                os.unlink(dest)\n\n        if os.path.isdir(source):\n            shutil.copytree(source, dest)\n        else:\n            shutil.copy2(source, dest)\n\n    def ExecLinkWrapper(self, arch, use_separate_mspdbsrv, *args):\n        \"\"\"Filter diagnostic output from link that looks like:\n        '   Creating library ui.dll.lib and object ui.dll.exp'\n        This happens when there are exports from the dll or exe.\n        \"\"\"\n        env = self._GetEnv(arch)\n        if use_separate_mspdbsrv == \"True\":\n            self._UseSeparateMspdbsrv(env, args)\n        if sys.platform == \"win32\":\n            args = list(args)  # *args is a tuple by default, which is read-only.\n            args[0] = args[0].replace(\"/\", \"\\\\\")\n        # https://docs.python.org/2/library/subprocess.html:\n        # \"On Unix with shell=True [...] if args is a sequence, the first item\n        # specifies the command string, and any additional items will be treated as\n        # additional arguments to the shell itself.  That is to say, Popen does the\n        # equivalent of:\n        #   Popen(['/bin/sh', '-c', args[0], args[1], ...])\"\n        # For that reason, since going through the shell doesn't seem necessary on\n        # non-Windows don't do that there.\n        link = subprocess.Popen(\n            args,\n            shell=sys.platform == \"win32\",\n            env=env,\n            stdout=subprocess.PIPE,\n            stderr=subprocess.STDOUT,\n        )\n        out = link.communicate()[0].decode(\"utf-8\")\n        for line in out.splitlines():\n            if (\n                not line.startswith(\"   Creating library \")\n                and not line.startswith(\"Generating code\")\n                and not line.startswith(\"Finished generating code\")\n            ):\n                print(line)\n        return link.returncode\n\n    def ExecLinkWithManifests(\n        self,\n        arch,\n        embed_manifest,\n        out,\n        ldcmd,\n        resname,\n        mt,\n        rc,\n        intermediate_manifest,\n        *manifests,\n    ):\n        \"\"\"A wrapper for handling creating a manifest resource and then executing\n        a link command.\"\"\"\n        # The 'normal' way to do manifests is to have link generate a manifest\n        # based on gathering dependencies from the object files, then merge that\n        # manifest with other manifests supplied as sources, convert the merged\n        # manifest to a resource, and then *relink*, including the compiled\n        # version of the manifest resource. This breaks incremental linking, and\n        # is generally overly complicated. Instead, we merge all the manifests\n        # provided (along with one that includes what would normally be in the\n        # linker-generated one, see msvs_emulation.py), and include that into the\n        # first and only link. We still tell link to generate a manifest, but we\n        # only use that to assert that our simpler process did not miss anything.\n        variables = {\n            \"python\": sys.executable,\n            \"arch\": arch,\n            \"out\": out,\n            \"ldcmd\": ldcmd,\n            \"resname\": resname,\n            \"mt\": mt,\n            \"rc\": rc,\n            \"intermediate_manifest\": intermediate_manifest,\n            \"manifests\": \" \".join(manifests),\n        }\n        add_to_ld = \"\"\n        if manifests:\n            subprocess.check_call(\n                \"%(python)s gyp-win-tool manifest-wrapper %(arch)s %(mt)s -nologo \"\n                \"-manifest %(manifests)s -out:%(out)s.manifest\" % variables\n            )\n            if embed_manifest == \"True\":\n                subprocess.check_call(\n                    \"%(python)s gyp-win-tool manifest-to-rc %(arch)s %(out)s.manifest\"\n                    \" %(out)s.manifest.rc %(resname)s\" % variables\n                )\n                subprocess.check_call(\n                    \"%(python)s gyp-win-tool rc-wrapper %(arch)s %(rc)s \"\n                    \"%(out)s.manifest.rc\" % variables\n                )\n                add_to_ld = \" %(out)s.manifest.res\" % variables\n        subprocess.check_call(ldcmd + add_to_ld)\n\n        # Run mt.exe on the theoretically complete manifest we generated, merging\n        # it with the one the linker generated to confirm that the linker\n        # generated one does not add anything. This is strictly unnecessary for\n        # correctness, it's only to verify that e.g. /MANIFESTDEPENDENCY was not\n        # used in a #pragma comment.\n        if manifests:\n            # Merge the intermediate one with ours to .assert.manifest, then check\n            # that .assert.manifest is identical to ours.\n            subprocess.check_call(\n                \"%(python)s gyp-win-tool manifest-wrapper %(arch)s %(mt)s -nologo \"\n                \"-manifest %(out)s.manifest %(intermediate_manifest)s \"\n                \"-out:%(out)s.assert.manifest\" % variables\n            )\n            assert_manifest = \"%(out)s.assert.manifest\" % variables\n            our_manifest = \"%(out)s.manifest\" % variables\n            # Load and normalize the manifests. mt.exe sometimes removes whitespace,\n            # and sometimes doesn't unfortunately.\n            with open(our_manifest) as our_f, open(assert_manifest) as assert_f:\n                translator = str.maketrans(\"\", \"\", string.whitespace)\n                our_data = our_f.read().translate(translator)\n                assert_data = assert_f.read().translate(translator)\n            if our_data != assert_data:\n                os.unlink(out)\n\n                def dump(filename):\n                    print(filename, file=sys.stderr)\n                    print(\"-----\", file=sys.stderr)\n                    with open(filename) as f:\n                        print(f.read(), file=sys.stderr)\n                        print(\"-----\", file=sys.stderr)\n\n                dump(intermediate_manifest)\n                dump(our_manifest)\n                dump(assert_manifest)\n                sys.stderr.write(\n                    'Linker generated manifest \"%s\" added to final manifest \"%s\" '\n                    '(result in \"%s\"). '\n                    \"Were /MANIFEST switches used in #pragma statements? \"\n                    % (intermediate_manifest, our_manifest, assert_manifest)\n                )\n                return 1\n\n    def ExecManifestWrapper(self, arch, *args):\n        \"\"\"Run manifest tool with environment set. Strip out undesirable warning\n        (some XML blocks are recognized by the OS loader, but not the manifest\n        tool).\"\"\"\n        env = self._GetEnv(arch)\n        popen = subprocess.Popen(\n            args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n        )\n        out = popen.communicate()[0].decode(\"utf-8\")\n        for line in out.splitlines():\n            if line and \"manifest authoring warning 81010002\" not in line:\n                print(line)\n        return popen.returncode\n\n    def ExecManifestToRc(self, arch, *args):\n        \"\"\"Creates a resource file pointing a SxS assembly manifest.\n        |args| is tuple containing path to resource file, path to manifest file\n        and resource name which can be \"1\" (for executables) or \"2\" (for DLLs).\"\"\"\n        manifest_path, resource_path, resource_name = args\n        with open(resource_path, \"w\") as output:\n            output.write(\n                '#include <windows.h>\\n%s RT_MANIFEST \"%s\"'\n                % (resource_name, os.path.abspath(manifest_path).replace(\"\\\\\", \"/\"))\n            )\n\n    def ExecMidlWrapper(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl, *flags):\n        \"\"\"Filter noisy filenames output from MIDL compile step that isn't\n        quietable via command line flags.\n        \"\"\"\n        args = (\n            [\"midl\", \"/nologo\"]\n            + list(flags)\n            + [\n                \"/out\",\n                outdir,\n                \"/tlb\",\n                tlb,\n                \"/h\",\n                h,\n                \"/dlldata\",\n                dlldata,\n                \"/iid\",\n                iid,\n                \"/proxy\",\n                proxy,\n                idl,\n            ]\n        )\n        env = self._GetEnv(arch)\n        popen = subprocess.Popen(\n            args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n        )\n        out = popen.communicate()[0].decode(\"utf-8\")\n        # Filter junk out of stdout, and write filtered versions. Output we want\n        # to filter is pairs of lines that look like this:\n        # Processing C:\\Program Files (x86)\\Microsoft SDKs\\...\\include\\objidl.idl\n        # objidl.idl\n        lines = out.splitlines()\n        prefixes = (\"Processing \", \"64 bit Processing \")\n        processing = {os.path.basename(x) for x in lines if x.startswith(prefixes)}\n        for line in lines:\n            if not line.startswith(prefixes) and line not in processing:\n                print(line)\n        return popen.returncode\n\n    def ExecAsmWrapper(self, arch, *args):\n        \"\"\"Filter logo banner from invocations of asm.exe.\"\"\"\n        env = self._GetEnv(arch)\n        popen = subprocess.Popen(\n            args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n        )\n        out = popen.communicate()[0].decode(\"utf-8\")\n        for line in out.splitlines():\n            if (\n                not line.startswith(\"Copyright (C) Microsoft Corporation\")\n                and not line.startswith(\"Microsoft (R) Macro Assembler\")\n                and not line.startswith(\" Assembling: \")\n                and line\n            ):\n                print(line)\n        return popen.returncode\n\n    def ExecRcWrapper(self, arch, *args):\n        \"\"\"Filter logo banner from invocations of rc.exe. Older versions of RC\n        don't support the /nologo flag.\"\"\"\n        env = self._GetEnv(arch)\n        popen = subprocess.Popen(\n            args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n        )\n        out = popen.communicate()[0].decode(\"utf-8\")\n        for line in out.splitlines():\n            if (\n                not line.startswith(\"Microsoft (R) Windows (R) Resource Compiler\")\n                and not line.startswith(\"Copyright (C) Microsoft Corporation\")\n                and line\n            ):\n                print(line)\n        return popen.returncode\n\n    def ExecActionWrapper(self, arch, rspfile, *dir):\n        \"\"\"Runs an action command line from a response file using the environment\n        for |arch|. If |dir| is supplied, use that as the working directory.\"\"\"\n        env = self._GetEnv(arch)\n        # TODO(scottmg): This is a temporary hack to get some specific variables\n        # through to actions that are set after gyp-time. http://crbug.com/333738.\n        for k, v in os.environ.items():\n            if k not in env:\n                env[k] = v\n        args = open(rspfile).read()\n        dir = dir[0] if dir else None\n        return subprocess.call(args, shell=True, env=env, cwd=dir)\n\n    def ExecClCompile(self, project_dir, selected_files):\n        \"\"\"Executed by msvs-ninja projects when the 'ClCompile' target is used to\n        build selected C/C++ files.\"\"\"\n        project_dir = os.path.relpath(project_dir, BASE_DIR)\n        selected_files = selected_files.split(\";\")\n        ninja_targets = [\n            os.path.join(project_dir, filename) + \"^^\" for filename in selected_files\n        ]\n        cmd = [\"ninja.exe\"]\n        cmd.extend(ninja_targets)\n        return subprocess.call(cmd, shell=True, cwd=BASE_DIR)\n\n\nif __name__ == \"__main__\":\n    sys.exit(main(sys.argv[1:]))\n"
  },
  {
    "path": "gyp/pylib/gyp/xcode_emulation.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"\nThis module contains classes that help to emulate xcodebuild behavior on top of\nother build systems, such as make and ninja.\n\"\"\"\n\nimport copy\nimport os\nimport os.path\nimport re\nimport shlex\nimport subprocess\nimport sys\n\nimport gyp.common\nfrom gyp.common import GypError\n\n# Populated lazily by XcodeVersion, for efficiency, and to fix an issue when\n# \"xcodebuild\" is called too quickly (it has been found to return incorrect\n# version number).\nXCODE_VERSION_CACHE = None\n\n# Populated lazily by GetXcodeArchsDefault, to an |XcodeArchsDefault| instance\n# corresponding to the installed version of Xcode.\nXCODE_ARCHS_DEFAULT_CACHE = None\n\n\ndef XcodeArchsVariableMapping(archs, archs_including_64_bit=None):\n    \"\"\"Constructs a dictionary with expansion for $(ARCHS_STANDARD) variable,\n    and optionally for $(ARCHS_STANDARD_INCLUDING_64_BIT).\"\"\"\n    mapping = {\"$(ARCHS_STANDARD)\": archs}\n    if archs_including_64_bit:\n        mapping[\"$(ARCHS_STANDARD_INCLUDING_64_BIT)\"] = archs_including_64_bit\n    return mapping\n\n\nclass XcodeArchsDefault:\n    \"\"\"A class to resolve ARCHS variable from xcode_settings, resolving Xcode\n    macros and implementing filtering by VALID_ARCHS. The expansion of macros\n    depends on the SDKROOT used (\"macosx\", \"iphoneos\", \"iphonesimulator\") and\n    on the version of Xcode.\n    \"\"\"\n\n    # Match variable like $(ARCHS_STANDARD).\n    variable_pattern = re.compile(r\"\\$\\([a-zA-Z_][a-zA-Z0-9_]*\\)$\")\n\n    def __init__(self, default, mac, iphonesimulator, iphoneos):\n        self._default = (default,)\n        self._archs = {\"mac\": mac, \"ios\": iphoneos, \"iossim\": iphonesimulator}\n\n    def _VariableMapping(self, sdkroot):\n        \"\"\"Returns the dictionary of variable mapping depending on the SDKROOT.\"\"\"\n        sdkroot = sdkroot.lower()\n        if \"iphoneos\" in sdkroot:\n            return self._archs[\"ios\"]\n        elif \"iphonesimulator\" in sdkroot:\n            return self._archs[\"iossim\"]\n        else:\n            return self._archs[\"mac\"]\n\n    def _ExpandArchs(self, archs, sdkroot):\n        \"\"\"Expands variables references in ARCHS, and remove duplicates.\"\"\"\n        variable_mapping = self._VariableMapping(sdkroot)\n        expanded_archs = []\n        for arch in archs:\n            if self.variable_pattern.match(arch):\n                variable = arch\n                try:\n                    variable_expansion = variable_mapping[variable]\n                    for arch in variable_expansion:\n                        if arch not in expanded_archs:\n                            expanded_archs.append(arch)\n                except KeyError:\n                    print('Warning: Ignoring unsupported variable \"%s\".' % variable)\n            elif arch not in expanded_archs:\n                expanded_archs.append(arch)\n        return expanded_archs\n\n    def ActiveArchs(self, archs, valid_archs, sdkroot):\n        \"\"\"Expands variables references in ARCHS, and filter by VALID_ARCHS if it\n        is defined (if not set, Xcode accept any value in ARCHS, otherwise, only\n        values present in VALID_ARCHS are kept).\"\"\"\n        expanded_archs = self._ExpandArchs(archs or self._default, sdkroot or \"\")\n        if valid_archs:\n            filtered_archs = []\n            for arch in expanded_archs:\n                if arch in valid_archs:\n                    filtered_archs.append(arch)\n            expanded_archs = filtered_archs\n        return expanded_archs\n\n\ndef GetXcodeArchsDefault():\n    \"\"\"Returns the |XcodeArchsDefault| object to use to expand ARCHS for the\n    installed version of Xcode. The default values used by Xcode for ARCHS\n    and the expansion of the variables depends on the version of Xcode used.\n\n    For all version anterior to Xcode 5.0 or posterior to Xcode 5.1 included\n    uses $(ARCHS_STANDARD) if ARCHS is unset, while Xcode 5.0 to 5.0.2 uses\n    $(ARCHS_STANDARD_INCLUDING_64_BIT). This variable was added to Xcode 5.0\n    and deprecated with Xcode 5.1.\n\n    For \"macosx\" SDKROOT, all version starting with Xcode 5.0 includes 64-bit\n    architecture as part of $(ARCHS_STANDARD) and default to only building it.\n\n    For \"iphoneos\" and \"iphonesimulator\" SDKROOT, 64-bit architectures are part\n    of $(ARCHS_STANDARD_INCLUDING_64_BIT) from Xcode 5.0. From Xcode 5.1, they\n    are also part of $(ARCHS_STANDARD).\n\n    All these rules are coded in the construction of the |XcodeArchsDefault|\n    object to use depending on the version of Xcode detected. The object is\n    for performance reason.\"\"\"\n    global XCODE_ARCHS_DEFAULT_CACHE\n    if XCODE_ARCHS_DEFAULT_CACHE:\n        return XCODE_ARCHS_DEFAULT_CACHE\n    xcode_version, _ = XcodeVersion()\n    if xcode_version < \"0500\":\n        XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault(\n            \"$(ARCHS_STANDARD)\",\n            XcodeArchsVariableMapping([\"i386\"]),\n            XcodeArchsVariableMapping([\"i386\"]),\n            XcodeArchsVariableMapping([\"armv7\"]),\n        )\n    elif xcode_version < \"0510\":\n        XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault(\n            \"$(ARCHS_STANDARD_INCLUDING_64_BIT)\",\n            XcodeArchsVariableMapping([\"x86_64\"], [\"x86_64\"]),\n            XcodeArchsVariableMapping([\"i386\"], [\"i386\", \"x86_64\"]),\n            XcodeArchsVariableMapping(\n                [\"armv7\", \"armv7s\"], [\"armv7\", \"armv7s\", \"arm64\"]\n            ),\n        )\n    else:\n        XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault(\n            \"$(ARCHS_STANDARD)\",\n            XcodeArchsVariableMapping([\"x86_64\"], [\"x86_64\"]),\n            XcodeArchsVariableMapping([\"i386\", \"x86_64\"], [\"i386\", \"x86_64\"]),\n            XcodeArchsVariableMapping(\n                [\"armv7\", \"armv7s\", \"arm64\"], [\"armv7\", \"armv7s\", \"arm64\"]\n            ),\n        )\n    return XCODE_ARCHS_DEFAULT_CACHE\n\n\nclass XcodeSettings:\n    \"\"\"A class that understands the gyp 'xcode_settings' object.\"\"\"\n\n    # Populated lazily by _SdkPath(). Shared by all XcodeSettings, so cached\n    # at class-level for efficiency.\n    _sdk_path_cache = {}\n    _platform_path_cache = {}\n    _sdk_root_cache = {}\n\n    # Populated lazily by GetExtraPlistItems(). Shared by all XcodeSettings, so\n    # cached at class-level for efficiency.\n    _plist_cache = {}\n\n    # Populated lazily by GetIOSPostbuilds.  Shared by all XcodeSettings, so\n    # cached at class-level for efficiency.\n    _codesigning_key_cache = {}\n\n    def __init__(self, spec):\n        self.spec = spec\n\n        self.isIOS = False\n        self.mac_toolchain_dir = None\n        self.header_map_path = None\n\n        # Per-target 'xcode_settings' are pushed down into configs earlier by gyp.\n        # This means self.xcode_settings[config] always contains all settings\n        # for that config -- the per-target settings as well. Settings that are\n        # the same for all configs are implicitly per-target settings.\n        self.xcode_settings = {}\n        configs = spec[\"configurations\"]\n        for configname, config in configs.items():\n            self.xcode_settings[configname] = config.get(\"xcode_settings\", {})\n            self._ConvertConditionalKeys(configname)\n            if self.xcode_settings[configname].get(\"IPHONEOS_DEPLOYMENT_TARGET\", None):\n                self.isIOS = True\n\n        # This is only non-None temporarily during the execution of some methods.\n        self.configname = None\n\n        # Used by _AdjustLibrary to match .a and .dylib entries in libraries.\n        self.library_re = re.compile(r\"^lib([^/]+)\\.(a|dylib)$\")\n\n    def _ConvertConditionalKeys(self, configname):\n        \"\"\"Converts or warns on conditional keys.  Xcode supports conditional keys,\n        such as CODE_SIGN_IDENTITY[sdk=iphoneos*].  This is a partial implementation\n        with some keys converted while the rest force a warning.\"\"\"\n        settings = self.xcode_settings[configname]\n        conditional_keys = [key for key in settings if key.endswith(\"]\")]\n        for key in conditional_keys:\n            # If you need more, speak up at http://crbug.com/122592\n            if key.endswith(\"[sdk=iphoneos*]\"):\n                if configname.endswith(\"iphoneos\"):\n                    new_key = key.split(\"[\")[0]\n                    settings[new_key] = settings[key]\n            else:\n                print(\n                    \"Warning: Conditional keys not implemented, ignoring:\",\n                    \" \".join(conditional_keys),\n                )\n            del settings[key]\n\n    def _Settings(self):\n        assert self.configname\n        return self.xcode_settings[self.configname]\n\n    def _Test(self, test_key, cond_key, default):\n        return self._Settings().get(test_key, default) == cond_key\n\n    def _Appendf(self, lst, test_key, format_str, default=None):\n        if test_key in self._Settings():\n            lst.append(format_str % str(self._Settings()[test_key]))\n        elif default:\n            lst.append(format_str % str(default))\n\n    def _WarnUnimplemented(self, test_key):\n        if test_key in self._Settings():\n            print('Warning: Ignoring not yet implemented key \"%s\".' % test_key)\n\n    def IsBinaryOutputFormat(self, configname):\n        default = \"binary\" if self.isIOS else \"xml\"\n        format = self.xcode_settings[configname].get(\"INFOPLIST_OUTPUT_FORMAT\", default)\n        return format == \"binary\"\n\n    def IsIosFramework(self):\n        return self.spec[\"type\"] == \"shared_library\" and self._IsBundle() and self.isIOS\n\n    def _IsBundle(self):\n        return (\n            int(self.spec.get(\"mac_bundle\", 0)) != 0\n            or self._IsXCTest()\n            or self._IsXCUiTest()\n        )\n\n    def _IsXCTest(self):\n        return int(self.spec.get(\"mac_xctest_bundle\", 0)) != 0\n\n    def _IsXCUiTest(self):\n        return int(self.spec.get(\"mac_xcuitest_bundle\", 0)) != 0\n\n    def _IsIosAppExtension(self):\n        return int(self.spec.get(\"ios_app_extension\", 0)) != 0\n\n    def _IsIosWatchKitExtension(self):\n        return int(self.spec.get(\"ios_watchkit_extension\", 0)) != 0\n\n    def _IsIosWatchApp(self):\n        return int(self.spec.get(\"ios_watch_app\", 0)) != 0\n\n    def GetFrameworkVersion(self):\n        \"\"\"Returns the framework version of the current target. Only valid for\n        bundles.\"\"\"\n        assert self._IsBundle()\n        return self.GetPerTargetSetting(\"FRAMEWORK_VERSION\", default=\"A\")\n\n    def GetWrapperExtension(self):\n        \"\"\"Returns the bundle extension (.app, .framework, .plugin, etc).  Only\n        valid for bundles.\"\"\"\n        assert self._IsBundle()\n        if self.spec[\"type\"] in (\"loadable_module\", \"shared_library\"):\n            default_wrapper_extension = {\n                \"loadable_module\": \"bundle\",\n                \"shared_library\": \"framework\",\n            }[self.spec[\"type\"]]\n            wrapper_extension = self.GetPerTargetSetting(\n                \"WRAPPER_EXTENSION\", default=default_wrapper_extension\n            )\n            return \".\" + self.spec.get(\"product_extension\", wrapper_extension)\n        elif self.spec[\"type\"] == \"executable\":\n            if self._IsIosAppExtension() or self._IsIosWatchKitExtension():\n                return \".\" + self.spec.get(\"product_extension\", \"appex\")\n            else:\n                return \".\" + self.spec.get(\"product_extension\", \"app\")\n        else:\n            assert False, \"Don't know extension for '{}', target '{}'\".format(\n                self.spec[\"type\"],\n                self.spec[\"target_name\"],\n            )\n\n    def GetProductName(self):\n        \"\"\"Returns PRODUCT_NAME.\"\"\"\n        return self.spec.get(\"product_name\", self.spec[\"target_name\"])\n\n    def GetFullProductName(self):\n        \"\"\"Returns FULL_PRODUCT_NAME.\"\"\"\n        if self._IsBundle():\n            return self.GetWrapperName()\n        else:\n            return self._GetStandaloneBinaryPath()\n\n    def GetWrapperName(self):\n        \"\"\"Returns the directory name of the bundle represented by this target.\n        Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        return self.GetProductName() + self.GetWrapperExtension()\n\n    def GetBundleContentsFolderPath(self):\n        \"\"\"Returns the qualified path to the bundle's contents folder. E.g.\n        Chromium.app/Contents or Foo.bundle/Versions/A. Only valid for bundles.\"\"\"\n        if self.isIOS:\n            return self.GetWrapperName()\n        assert self._IsBundle()\n        if self.spec[\"type\"] == \"shared_library\":\n            return os.path.join(\n                self.GetWrapperName(), \"Versions\", self.GetFrameworkVersion()\n            )\n        else:\n            # loadable_modules have a 'Contents' folder like executables.\n            return os.path.join(self.GetWrapperName(), \"Contents\")\n\n    def GetBundleResourceFolder(self):\n        \"\"\"Returns the qualified path to the bundle's resource folder. E.g.\n        Chromium.app/Contents/Resources. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        if self.isIOS:\n            return self.GetBundleContentsFolderPath()\n        return os.path.join(self.GetBundleContentsFolderPath(), \"Resources\")\n\n    def GetBundleExecutableFolderPath(self):\n        \"\"\"Returns the qualified path to the bundle's executables folder. E.g.\n        Chromium.app/Contents/MacOS. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        if self.spec[\"type\"] in (\"shared_library\") or self.isIOS:\n            return self.GetBundleContentsFolderPath()\n        elif self.spec[\"type\"] in (\"executable\", \"loadable_module\"):\n            return os.path.join(self.GetBundleContentsFolderPath(), \"MacOS\")\n\n    def GetBundleJavaFolderPath(self):\n        \"\"\"Returns the qualified path to the bundle's Java resource folder.\n        E.g. Chromium.app/Contents/Resources/Java. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        return os.path.join(self.GetBundleResourceFolder(), \"Java\")\n\n    def GetBundleFrameworksFolderPath(self):\n        \"\"\"Returns the qualified path to the bundle's frameworks folder. E.g,\n        Chromium.app/Contents/Frameworks. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        return os.path.join(self.GetBundleContentsFolderPath(), \"Frameworks\")\n\n    def GetBundleSharedFrameworksFolderPath(self):\n        \"\"\"Returns the qualified path to the bundle's frameworks folder. E.g,\n        Chromium.app/Contents/SharedFrameworks. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        return os.path.join(self.GetBundleContentsFolderPath(), \"SharedFrameworks\")\n\n    def GetBundleSharedSupportFolderPath(self):\n        \"\"\"Returns the qualified path to the bundle's shared support folder. E.g,\n        Chromium.app/Contents/SharedSupport. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        if self.spec[\"type\"] == \"shared_library\":\n            return self.GetBundleResourceFolder()\n        else:\n            return os.path.join(self.GetBundleContentsFolderPath(), \"SharedSupport\")\n\n    def GetBundlePlugInsFolderPath(self):\n        \"\"\"Returns the qualified path to the bundle's plugins folder. E.g,\n        Chromium.app/Contents/PlugIns. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        return os.path.join(self.GetBundleContentsFolderPath(), \"PlugIns\")\n\n    def GetBundleXPCServicesFolderPath(self):\n        \"\"\"Returns the qualified path to the bundle's XPC services folder. E.g,\n        Chromium.app/Contents/XPCServices. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        return os.path.join(self.GetBundleContentsFolderPath(), \"XPCServices\")\n\n    def GetBundlePlistPath(self):\n        \"\"\"Returns the qualified path to the bundle's plist file. E.g.\n        Chromium.app/Contents/Info.plist. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        if (\n            self.spec[\"type\"] in (\"executable\", \"loadable_module\")\n            or self.IsIosFramework()\n        ):\n            return os.path.join(self.GetBundleContentsFolderPath(), \"Info.plist\")\n        else:\n            return os.path.join(\n                self.GetBundleContentsFolderPath(), \"Resources\", \"Info.plist\"\n            )\n\n    def GetProductType(self):\n        \"\"\"Returns the PRODUCT_TYPE of this target.\"\"\"\n        if self._IsIosAppExtension():\n            assert self._IsBundle(), (\n                \"ios_app_extension flag requires mac_bundle \"\n                \"(target %s)\" % self.spec[\"target_name\"]\n            )\n            return \"com.apple.product-type.app-extension\"\n        if self._IsIosWatchKitExtension():\n            assert self._IsBundle(), (\n                \"ios_watchkit_extension flag requires \"\n                \"mac_bundle (target %s)\" % self.spec[\"target_name\"]\n            )\n            return \"com.apple.product-type.watchkit-extension\"\n        if self._IsIosWatchApp():\n            assert self._IsBundle(), (\n                \"ios_watch_app flag requires mac_bundle \"\n                \"(target %s)\" % self.spec[\"target_name\"]\n            )\n            return \"com.apple.product-type.application.watchapp\"\n        if self._IsXCUiTest():\n            assert self._IsBundle(), (\n                \"mac_xcuitest_bundle flag requires mac_bundle \"\n                \"(target %s)\" % self.spec[\"target_name\"]\n            )\n            return \"com.apple.product-type.bundle.ui-testing\"\n        if self._IsBundle():\n            return {\n                \"executable\": \"com.apple.product-type.application\",\n                \"loadable_module\": \"com.apple.product-type.bundle\",\n                \"shared_library\": \"com.apple.product-type.framework\",\n            }[self.spec[\"type\"]]\n        else:\n            return {\n                \"executable\": \"com.apple.product-type.tool\",\n                \"loadable_module\": \"com.apple.product-type.library.dynamic\",\n                \"shared_library\": \"com.apple.product-type.library.dynamic\",\n                \"static_library\": \"com.apple.product-type.library.static\",\n            }[self.spec[\"type\"]]\n\n    def GetMachOType(self):\n        \"\"\"Returns the MACH_O_TYPE of this target.\"\"\"\n        # Weird, but matches Xcode.\n        if not self._IsBundle() and self.spec[\"type\"] == \"executable\":\n            return \"\"\n        return {\n            \"executable\": \"mh_execute\",\n            \"static_library\": \"staticlib\",\n            \"shared_library\": \"mh_dylib\",\n            \"loadable_module\": \"mh_bundle\",\n        }[self.spec[\"type\"]]\n\n    def _GetBundleBinaryPath(self):\n        \"\"\"Returns the name of the bundle binary of by this target.\n        E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles.\"\"\"\n        assert self._IsBundle()\n        return os.path.join(\n            self.GetBundleExecutableFolderPath(), self.GetExecutableName()\n        )\n\n    def _GetStandaloneExecutableSuffix(self):\n        if \"product_extension\" in self.spec:\n            return \".\" + self.spec[\"product_extension\"]\n        return {\n            \"executable\": \"\",\n            \"static_library\": \".a\",\n            \"shared_library\": \".dylib\",\n            \"loadable_module\": \".so\",\n        }[self.spec[\"type\"]]\n\n    def _GetStandaloneExecutablePrefix(self):\n        return self.spec.get(\n            \"product_prefix\",\n            {\n                \"executable\": \"\",\n                \"static_library\": \"lib\",\n                \"shared_library\": \"lib\",\n                # Non-bundled loadable_modules are called foo.so for some reason\n                # (that is, .so and no prefix) with the xcode build -- match that.\n                \"loadable_module\": \"\",\n            }[self.spec[\"type\"]],\n        )\n\n    def _GetStandaloneBinaryPath(self):\n        \"\"\"Returns the name of the non-bundle binary represented by this target.\n        E.g. hello_world. Only valid for non-bundles.\"\"\"\n        assert not self._IsBundle()\n        assert self.spec[\"type\"] in {\n            \"executable\",\n            \"shared_library\",\n            \"static_library\",\n            \"loadable_module\",\n        }, \"Unexpected type %s\" % self.spec[\"type\"]\n        target = self.spec[\"target_name\"]\n        if self.spec[\"type\"] in {\"loadable_module\", \"shared_library\", \"static_library\"}:\n            if target[:3] == \"lib\":\n                target = target[3:]\n\n        target_prefix = self._GetStandaloneExecutablePrefix()\n        target = self.spec.get(\"product_name\", target)\n        target_ext = self._GetStandaloneExecutableSuffix()\n        return target_prefix + target + target_ext\n\n    def GetExecutableName(self):\n        \"\"\"Returns the executable name of the bundle represented by this target.\n        E.g. Chromium.\"\"\"\n        if self._IsBundle():\n            return self.spec.get(\"product_name\", self.spec[\"target_name\"])\n        else:\n            return self._GetStandaloneBinaryPath()\n\n    def GetExecutablePath(self):\n        \"\"\"Returns the qualified path to the primary executable of the bundle\n        represented by this target. E.g. Chromium.app/Contents/MacOS/Chromium.\"\"\"\n        if self._IsBundle():\n            return self._GetBundleBinaryPath()\n        else:\n            return self._GetStandaloneBinaryPath()\n\n    def GetActiveArchs(self, configname):\n        \"\"\"Returns the architectures this target should be built for.\"\"\"\n        config_settings = self.xcode_settings[configname]\n        xcode_archs_default = GetXcodeArchsDefault()\n        return xcode_archs_default.ActiveArchs(\n            config_settings.get(\"ARCHS\"),\n            config_settings.get(\"VALID_ARCHS\"),\n            config_settings.get(\"SDKROOT\"),\n        )\n\n    def _GetSdkVersionInfoItem(self, sdk, infoitem):\n        # xcodebuild requires Xcode and can't run on Command Line Tools-only\n        # systems from 10.7 onward.\n        # Since the CLT has no SDK paths anyway, returning None is the\n        # most sensible route and should still do the right thing.\n        try:\n            return GetStdoutQuiet([\"xcrun\", \"--sdk\", sdk, infoitem])\n        except (GypError, OSError):\n            pass\n\n    def _SdkRoot(self, configname):\n        if configname is None:\n            configname = self.configname\n        return self.GetPerConfigSetting(\"SDKROOT\", configname, default=\"\")\n\n    def _XcodePlatformPath(self, configname=None):\n        sdk_root = self._SdkRoot(configname)\n        if sdk_root not in XcodeSettings._platform_path_cache:\n            platform_path = self._GetSdkVersionInfoItem(\n                sdk_root, \"--show-sdk-platform-path\"\n            )\n            XcodeSettings._platform_path_cache[sdk_root] = platform_path\n        return XcodeSettings._platform_path_cache[sdk_root]\n\n    def _SdkPath(self, configname=None):\n        sdk_root = self._SdkRoot(configname)\n        if sdk_root.startswith(\"/\"):\n            return sdk_root\n        return self._XcodeSdkPath(sdk_root)\n\n    def _XcodeSdkPath(self, sdk_root):\n        if sdk_root not in XcodeSettings._sdk_path_cache:\n            sdk_path = self._GetSdkVersionInfoItem(sdk_root, \"--show-sdk-path\")\n            XcodeSettings._sdk_path_cache[sdk_root] = sdk_path\n            if sdk_root:\n                XcodeSettings._sdk_root_cache[sdk_path] = sdk_root\n        return XcodeSettings._sdk_path_cache[sdk_root]\n\n    def _AppendPlatformVersionMinFlags(self, lst):\n        self._Appendf(lst, \"MACOSX_DEPLOYMENT_TARGET\", \"-mmacosx-version-min=%s\")\n        if \"IPHONEOS_DEPLOYMENT_TARGET\" in self._Settings():\n            # TODO: Implement this better?\n            sdk_path_basename = os.path.basename(self._SdkPath())\n            if sdk_path_basename.lower().startswith(\"iphonesimulator\"):\n                self._Appendf(\n                    lst, \"IPHONEOS_DEPLOYMENT_TARGET\", \"-mios-simulator-version-min=%s\"\n                )\n            else:\n                self._Appendf(\n                    lst, \"IPHONEOS_DEPLOYMENT_TARGET\", \"-miphoneos-version-min=%s\"\n                )\n\n    def GetCflags(self, configname, arch=None):\n        \"\"\"Returns flags that need to be added to .c, .cc, .m, and .mm\n        compilations.\"\"\"\n        # This functions (and the similar ones below) do not offer complete\n        # emulation of all xcode_settings keys. They're implemented on demand.\n\n        self.configname = configname\n        cflags = []\n\n        sdk_root = self._SdkPath()\n        if \"SDKROOT\" in self._Settings() and sdk_root:\n            cflags.append(\"-isysroot\")\n            cflags.append(sdk_root)\n\n        if self.header_map_path:\n            cflags.append(\"-I%s\" % self.header_map_path)\n\n        if self._Test(\"CLANG_WARN_CONSTANT_CONVERSION\", \"YES\", default=\"NO\"):\n            cflags.append(\"-Wconstant-conversion\")\n\n        if self._Test(\"GCC_CHAR_IS_UNSIGNED_CHAR\", \"YES\", default=\"NO\"):\n            cflags.append(\"-funsigned-char\")\n\n        if self._Test(\"GCC_CW_ASM_SYNTAX\", \"YES\", default=\"YES\"):\n            cflags.append(\"-fasm-blocks\")\n\n        if \"GCC_DYNAMIC_NO_PIC\" in self._Settings():\n            if self._Settings()[\"GCC_DYNAMIC_NO_PIC\"] == \"YES\":\n                cflags.append(\"-mdynamic-no-pic\")\n        else:\n            pass\n            # TODO: In this case, it depends on the target. xcode passes\n            # mdynamic-no-pic by default for executable and possibly static lib\n            # according to mento\n\n        if self._Test(\"GCC_ENABLE_PASCAL_STRINGS\", \"YES\", default=\"YES\"):\n            cflags.append(\"-mpascal-strings\")\n\n        self._Appendf(cflags, \"GCC_OPTIMIZATION_LEVEL\", \"-O%s\", default=\"s\")\n\n        if self._Test(\"GCC_GENERATE_DEBUGGING_SYMBOLS\", \"YES\", default=\"YES\"):\n            dbg_format = self._Settings().get(\"DEBUG_INFORMATION_FORMAT\", \"dwarf\")\n            if dbg_format == \"dwarf\":\n                cflags.append(\"-gdwarf-2\")\n            elif dbg_format == \"stabs\":\n                raise NotImplementedError(\"stabs debug format is not supported yet.\")\n            elif dbg_format == \"dwarf-with-dsym\":\n                cflags.append(\"-gdwarf-2\")\n            else:\n                raise NotImplementedError(\"Unknown debug format %s\" % dbg_format)\n\n        if self._Settings().get(\"GCC_STRICT_ALIASING\") == \"YES\":\n            cflags.append(\"-fstrict-aliasing\")\n        elif self._Settings().get(\"GCC_STRICT_ALIASING\") == \"NO\":\n            cflags.append(\"-fno-strict-aliasing\")\n\n        if self._Test(\"GCC_SYMBOLS_PRIVATE_EXTERN\", \"YES\", default=\"NO\"):\n            cflags.append(\"-fvisibility=hidden\")\n\n        if self._Test(\"GCC_TREAT_WARNINGS_AS_ERRORS\", \"YES\", default=\"NO\"):\n            cflags.append(\"-Werror\")\n\n        if self._Test(\"GCC_WARN_ABOUT_MISSING_NEWLINE\", \"YES\", default=\"NO\"):\n            cflags.append(\"-Wnewline-eof\")\n\n        # In Xcode, this is only activated when GCC_COMPILER_VERSION is clang or\n        # llvm-gcc. It also requires a fairly recent libtool, and\n        # if the system clang isn't used, DYLD_LIBRARY_PATH needs to contain the\n        # path to the libLTO.dylib that matches the used clang.\n        if self._Test(\"LLVM_LTO\", \"YES\", default=\"NO\"):\n            cflags.append(\"-flto\")\n\n        self._AppendPlatformVersionMinFlags(cflags)\n\n        # TODO:\n        if self._Test(\"COPY_PHASE_STRIP\", \"YES\", default=\"NO\"):\n            self._WarnUnimplemented(\"COPY_PHASE_STRIP\")\n        self._WarnUnimplemented(\"GCC_DEBUGGING_SYMBOLS\")\n        self._WarnUnimplemented(\"GCC_ENABLE_OBJC_EXCEPTIONS\")\n\n        # TODO: This is exported correctly, but assigning to it is not supported.\n        self._WarnUnimplemented(\"MACH_O_TYPE\")\n        self._WarnUnimplemented(\"PRODUCT_TYPE\")\n\n        # If GYP_CROSSCOMPILE (--cross-compiling), disable architecture-specific\n        # additions and assume these will be provided as required via CC_host,\n        # CXX_host, CC_target and CXX_target.\n        if not gyp.common.CrossCompileRequested():\n            if arch is not None:\n                archs = [arch]\n            else:\n                assert self.configname\n                archs = self.GetActiveArchs(self.configname)\n            if len(archs) != 1:\n                # TODO: Supporting fat binaries will be annoying.\n                self._WarnUnimplemented(\"ARCHS\")\n                archs = [\"i386\"]\n            cflags.append(\"-arch\")\n            cflags.append(archs[0])\n\n            if archs[0] in (\"i386\", \"x86_64\"):\n                if self._Test(\"GCC_ENABLE_SSE3_EXTENSIONS\", \"YES\", default=\"NO\"):\n                    cflags.append(\"-msse3\")\n                if self._Test(\n                    \"GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS\", \"YES\", default=\"NO\"\n                ):\n                    cflags.append(\"-mssse3\")  # Note 3rd 's'.\n                if self._Test(\"GCC_ENABLE_SSE41_EXTENSIONS\", \"YES\", default=\"NO\"):\n                    cflags.append(\"-msse4.1\")\n                if self._Test(\"GCC_ENABLE_SSE42_EXTENSIONS\", \"YES\", default=\"NO\"):\n                    cflags.append(\"-msse4.2\")\n\n        cflags += self._Settings().get(\"WARNING_CFLAGS\", [])\n\n        if self._IsXCTest():\n            platform_root = self._XcodePlatformPath(configname)\n            if platform_root:\n                cflags.append(\"-F\" + platform_root + \"/Developer/Library/Frameworks/\")\n\n        framework_root = sdk_root if sdk_root else \"\"\n        config = self.spec[\"configurations\"][self.configname]\n        framework_dirs = config.get(\"mac_framework_dirs\", [])\n        for directory in framework_dirs:\n            cflags.append(\"-F\" + directory.replace(\"$(SDKROOT)\", framework_root))\n\n        self.configname = None\n        return cflags\n\n    def GetCflagsC(self, configname):\n        \"\"\"Returns flags that need to be added to .c, and .m compilations.\"\"\"\n        self.configname = configname\n        cflags_c = []\n        if self._Settings().get(\"GCC_C_LANGUAGE_STANDARD\", \"\") == \"ansi\":\n            cflags_c.append(\"-ansi\")\n        else:\n            self._Appendf(cflags_c, \"GCC_C_LANGUAGE_STANDARD\", \"-std=%s\")\n        cflags_c += self._Settings().get(\"OTHER_CFLAGS\", [])\n        self.configname = None\n        return cflags_c\n\n    def GetCflagsCC(self, configname):\n        \"\"\"Returns flags that need to be added to .cc, and .mm compilations.\"\"\"\n        self.configname = configname\n        cflags_cc = []\n\n        clang_cxx_language_standard = self._Settings().get(\n            \"CLANG_CXX_LANGUAGE_STANDARD\"\n        )\n        # Note: Don't make c++0x to c++11 so that c++0x can be used with older\n        # clangs that don't understand c++11 yet (like Xcode 4.2's).\n        if clang_cxx_language_standard:\n            cflags_cc.append(\"-std=%s\" % clang_cxx_language_standard)\n\n        self._Appendf(cflags_cc, \"CLANG_CXX_LIBRARY\", \"-stdlib=%s\")\n\n        if self._Test(\"GCC_ENABLE_CPP_RTTI\", \"NO\", default=\"YES\"):\n            cflags_cc.append(\"-fno-rtti\")\n        if self._Test(\"GCC_ENABLE_CPP_EXCEPTIONS\", \"NO\", default=\"YES\"):\n            cflags_cc.append(\"-fno-exceptions\")\n        if self._Test(\"GCC_INLINES_ARE_PRIVATE_EXTERN\", \"YES\", default=\"NO\"):\n            cflags_cc.append(\"-fvisibility-inlines-hidden\")\n        if self._Test(\"GCC_THREADSAFE_STATICS\", \"NO\", default=\"YES\"):\n            cflags_cc.append(\"-fno-threadsafe-statics\")\n        # Note: This flag is a no-op for clang, it only has an effect for gcc.\n        if self._Test(\"GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO\", \"NO\", default=\"YES\"):\n            cflags_cc.append(\"-Wno-invalid-offsetof\")\n\n        other_ccflags = []\n\n        for flag in self._Settings().get(\"OTHER_CPLUSPLUSFLAGS\", [\"$(inherited)\"]):\n            # TODO: More general variable expansion. Missing in many other places too.\n            if flag in (\"$inherited\", \"$(inherited)\", \"${inherited}\"):\n                flag = \"$OTHER_CFLAGS\"\n            if flag in (\"$OTHER_CFLAGS\", \"$(OTHER_CFLAGS)\", \"${OTHER_CFLAGS}\"):\n                other_ccflags += self._Settings().get(\"OTHER_CFLAGS\", [])\n            else:\n                other_ccflags.append(flag)\n        cflags_cc += other_ccflags\n\n        self.configname = None\n        return cflags_cc\n\n    def _AddObjectiveCGarbageCollectionFlags(self, flags):\n        gc_policy = self._Settings().get(\"GCC_ENABLE_OBJC_GC\", \"unsupported\")\n        if gc_policy == \"supported\":\n            flags.append(\"-fobjc-gc\")\n        elif gc_policy == \"required\":\n            flags.append(\"-fobjc-gc-only\")\n\n    def _AddObjectiveCARCFlags(self, flags):\n        if self._Test(\"CLANG_ENABLE_OBJC_ARC\", \"YES\", default=\"NO\"):\n            flags.append(\"-fobjc-arc\")\n\n    def _AddObjectiveCMissingPropertySynthesisFlags(self, flags):\n        if self._Test(\n            \"CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS\", \"YES\", default=\"NO\"\n        ):\n            flags.append(\"-Wobjc-missing-property-synthesis\")\n\n    def GetCflagsObjC(self, configname):\n        \"\"\"Returns flags that need to be added to .m compilations.\"\"\"\n        self.configname = configname\n        cflags_objc = []\n        self._AddObjectiveCGarbageCollectionFlags(cflags_objc)\n        self._AddObjectiveCARCFlags(cflags_objc)\n        self._AddObjectiveCMissingPropertySynthesisFlags(cflags_objc)\n        self.configname = None\n        return cflags_objc\n\n    def GetCflagsObjCC(self, configname):\n        \"\"\"Returns flags that need to be added to .mm compilations.\"\"\"\n        self.configname = configname\n        cflags_objcc = []\n        self._AddObjectiveCGarbageCollectionFlags(cflags_objcc)\n        self._AddObjectiveCARCFlags(cflags_objcc)\n        self._AddObjectiveCMissingPropertySynthesisFlags(cflags_objcc)\n        if self._Test(\"GCC_OBJC_CALL_CXX_CDTORS\", \"YES\", default=\"NO\"):\n            cflags_objcc.append(\"-fobjc-call-cxx-cdtors\")\n        self.configname = None\n        return cflags_objcc\n\n    def GetInstallNameBase(self):\n        \"\"\"Return DYLIB_INSTALL_NAME_BASE for this target.\"\"\"\n        # Xcode sets this for shared_libraries, and for nonbundled loadable_modules.\n        if self.spec[\"type\"] != \"shared_library\" and (\n            self.spec[\"type\"] != \"loadable_module\" or self._IsBundle()\n        ):\n            return None\n        install_base = self.GetPerTargetSetting(\n            \"DYLIB_INSTALL_NAME_BASE\",\n            default=\"/Library/Frameworks\" if self._IsBundle() else \"/usr/local/lib\",\n        )\n        return install_base\n\n    def _StandardizePath(self, path):\n        \"\"\"Do :standardizepath processing for path.\"\"\"\n        # I'm not quite sure what :standardizepath does. Just call normpath(),\n        # but don't let @executable_path/../foo collapse to foo.\n        if \"/\" in path:\n            prefix, rest = \"\", path\n            if path.startswith(\"@\"):\n                prefix, rest = path.split(\"/\", 1)\n            rest = os.path.normpath(rest)  # :standardizepath\n            path = os.path.join(prefix, rest)\n        return path\n\n    def GetInstallName(self):\n        \"\"\"Return LD_DYLIB_INSTALL_NAME for this target.\"\"\"\n        # Xcode sets this for shared_libraries, and for nonbundled loadable_modules.\n        if self.spec[\"type\"] != \"shared_library\" and (\n            self.spec[\"type\"] != \"loadable_module\" or self._IsBundle()\n        ):\n            return None\n\n        default_install_name = (\n            \"$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)\"\n        )\n        install_name = self.GetPerTargetSetting(\n            \"LD_DYLIB_INSTALL_NAME\", default=default_install_name\n        )\n\n        # Hardcode support for the variables used in chromium for now, to\n        # unblock people using the make build.\n        if \"$\" in install_name:\n            assert install_name in (\n                \"$(DYLIB_INSTALL_NAME_BASE:standardizepath)/\"\n                \"$(WRAPPER_NAME)/$(PRODUCT_NAME)\",\n                default_install_name,\n            ), (\n                \"Variables in LD_DYLIB_INSTALL_NAME are not generally supported \"\n                \"yet in target '%s' (got '%s')\"\n                % (self.spec[\"target_name\"], install_name)\n            )\n\n            install_name = install_name.replace(\n                \"$(DYLIB_INSTALL_NAME_BASE:standardizepath)\",\n                self._StandardizePath(self.GetInstallNameBase()),\n            )\n            if self._IsBundle():\n                # These are only valid for bundles, hence the |if|.\n                install_name = install_name.replace(\n                    \"$(WRAPPER_NAME)\", self.GetWrapperName()\n                )\n                install_name = install_name.replace(\n                    \"$(PRODUCT_NAME)\", self.GetProductName()\n                )\n            else:\n                assert \"$(WRAPPER_NAME)\" not in install_name\n                assert \"$(PRODUCT_NAME)\" not in install_name\n\n            install_name = install_name.replace(\n                \"$(EXECUTABLE_PATH)\", self.GetExecutablePath()\n            )\n        return install_name\n\n    def _MapLinkerFlagFilename(self, ldflag, gyp_to_build_path):\n        \"\"\"Checks if ldflag contains a filename and if so remaps it from\n        gyp-directory-relative to build-directory-relative.\"\"\"\n        # This list is expanded on demand.\n        # They get matched as:\n        #   -exported_symbols_list file\n        #   -Wl,exported_symbols_list file\n        #   -Wl,exported_symbols_list,file\n        LINKER_FILE = r\"(\\S+)\"\n        WORD = r\"\\S+\"\n        linker_flags = [\n            [\"-exported_symbols_list\", LINKER_FILE],  # Needed for NaCl.\n            [\"-unexported_symbols_list\", LINKER_FILE],\n            [\"-reexported_symbols_list\", LINKER_FILE],\n            [\"-sectcreate\", WORD, WORD, LINKER_FILE],  # Needed for remoting.\n        ]\n        for flag_pattern in linker_flags:\n            regex = re.compile(\"(?:-Wl,)?\" + \"[ ,]\".join(flag_pattern))\n            m = regex.match(ldflag)\n            if m:\n                ldflag = (\n                    ldflag[: m.start(1)]\n                    + gyp_to_build_path(m.group(1))\n                    + ldflag[m.end(1) :]\n                )\n        # Required for ffmpeg (no idea why they don't use LIBRARY_SEARCH_PATHS,\n        # TODO(thakis): Update ffmpeg.gyp):\n        if ldflag.startswith(\"-L\"):\n            ldflag = \"-L\" + gyp_to_build_path(ldflag[len(\"-L\") :])\n        return ldflag\n\n    def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None):\n        \"\"\"Returns flags that need to be passed to the linker.\n\n        Args:\n            configname: The name of the configuration to get ld flags for.\n            product_dir: The directory where products such static and dynamic\n                libraries are placed. This is added to the library search path.\n            gyp_to_build_path: A function that converts paths relative to the\n                current gyp file to paths relative to the build directory.\n        \"\"\"\n        self.configname = configname\n        ldflags = []\n\n        # The xcode build is relative to a gyp file's directory, and OTHER_LDFLAGS\n        # can contain entries that depend on this. Explicitly absolutify these.\n        for ldflag in self._Settings().get(\"OTHER_LDFLAGS\", []):\n            ldflags.append(self._MapLinkerFlagFilename(ldflag, gyp_to_build_path))\n\n        if self._Test(\"DEAD_CODE_STRIPPING\", \"YES\", default=\"NO\"):\n            ldflags.append(\"-Wl,-dead_strip\")\n\n        if self._Test(\"PREBINDING\", \"YES\", default=\"NO\"):\n            ldflags.append(\"-Wl,-prebind\")\n\n        self._Appendf(\n            ldflags, \"DYLIB_COMPATIBILITY_VERSION\", \"-compatibility_version %s\"\n        )\n        self._Appendf(ldflags, \"DYLIB_CURRENT_VERSION\", \"-current_version %s\")\n\n        self._AppendPlatformVersionMinFlags(ldflags)\n\n        if \"SDKROOT\" in self._Settings() and self._SdkPath():\n            ldflags.append(\"-isysroot\")\n            ldflags.append(self._SdkPath())\n\n        for library_path in self._Settings().get(\"LIBRARY_SEARCH_PATHS\", []):\n            ldflags.append(\"-L\" + gyp_to_build_path(library_path))\n\n        if \"ORDER_FILE\" in self._Settings():\n            ldflags.append(\"-Wl,-order_file\")\n            ldflags.append(\"-Wl,\" + gyp_to_build_path(self._Settings()[\"ORDER_FILE\"]))\n\n        if not gyp.common.CrossCompileRequested():\n            if arch is not None:\n                archs = [arch]\n            else:\n                assert self.configname\n                archs = self.GetActiveArchs(self.configname)\n            if len(archs) != 1:\n                # TODO: Supporting fat binaries will be annoying.\n                self._WarnUnimplemented(\"ARCHS\")\n                archs = [\"i386\"]\n            # Avoid quoting the space between -arch and the arch name\n            ldflags.append(\"-arch\")\n            ldflags.append(archs[0])\n\n        # Xcode adds the product directory by default.\n        # Rewrite -L. to -L./ to work around http://www.openradar.me/25313838\n        ldflags.append(\"-L\" + (product_dir if product_dir != \".\" else \"./\"))\n\n        install_name = self.GetInstallName()\n        if install_name and self.spec[\"type\"] != \"loadable_module\":\n            ldflags.append(\"-install_name\")\n            ldflags.append(install_name.replace(\" \", r\"\\ \"))\n\n        for rpath in self._Settings().get(\"LD_RUNPATH_SEARCH_PATHS\", []):\n            ldflags.append(\"-Wl,-rpath,\" + rpath)\n\n        sdk_root = self._SdkPath()\n        if not sdk_root:\n            sdk_root = \"\"\n        config = self.spec[\"configurations\"][self.configname]\n        framework_dirs = config.get(\"mac_framework_dirs\", [])\n        for directory in framework_dirs:\n            ldflags.append(\"-F\" + directory.replace(\"$(SDKROOT)\", sdk_root))\n\n        if self._IsXCTest():\n            platform_root = self._XcodePlatformPath(configname)\n            if sdk_root and platform_root:\n                ldflags.append(\"-F\" + platform_root + \"/Developer/Library/Frameworks/\")\n                ldflags.append(\"-framework\")\n                ldflags.append(\"XCTest\")\n\n        is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension()\n        if sdk_root and is_extension:\n            # Adds the link flags for extensions. These flags are common for all\n            # extensions and provide loader and main function.\n            # These flags reflect the compilation options used by xcode to compile\n            # extensions.\n            xcode_version, _ = XcodeVersion()\n            if xcode_version < \"0900\":\n                ldflags.append(\"-lpkstart\")\n                ldflags.append(\n                    sdk_root\n                    + \"/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit\"\n                )\n            else:\n                ldflags.append(\"-e\")\n                ldflags.append(\"_NSExtensionMain\")\n            ldflags.append(\"-fapplication-extension\")\n\n        self._Appendf(ldflags, \"CLANG_CXX_LIBRARY\", \"-stdlib=%s\")\n\n        self.configname = None\n        return ldflags\n\n    def GetLibtoolflags(self, configname):\n        \"\"\"Returns flags that need to be passed to the static linker.\n\n        Args:\n            configname: The name of the configuration to get ld flags for.\n        \"\"\"\n        self.configname = configname\n        libtoolflags = []\n\n        for libtoolflag in self._Settings().get(\"OTHER_LDFLAGS\", []):\n            libtoolflags.append(libtoolflag)\n        # TODO(thakis): ARCHS?\n\n        self.configname = None\n        return libtoolflags\n\n    def GetPerTargetSettings(self):\n        \"\"\"Gets a list of all the per-target settings. This will only fetch keys\n        whose values are the same across all configurations.\"\"\"\n        first_pass = True\n        result = {}\n        for configname in sorted(self.xcode_settings.keys()):\n            if first_pass:\n                result = dict(self.xcode_settings[configname])\n                first_pass = False\n            else:\n                for key, value in self.xcode_settings[configname].items():\n                    if key not in result:\n                        continue\n                    elif result[key] != value:\n                        del result[key]\n        return result\n\n    def GetPerConfigSetting(self, setting, configname, default=None):\n        if configname in self.xcode_settings:\n            return self.xcode_settings[configname].get(setting, default)\n        else:\n            return self.GetPerTargetSetting(setting, default)\n\n    def GetPerTargetSetting(self, setting, default=None):\n        \"\"\"Tries to get xcode_settings.setting from spec. Assumes that the setting\n        has the same value in all configurations and throws otherwise.\"\"\"\n        is_first_pass = True\n        result = None\n        for configname in sorted(self.xcode_settings.keys()):\n            if is_first_pass:\n                result = self.xcode_settings[configname].get(setting, None)\n                is_first_pass = False\n            else:\n                assert result == self.xcode_settings[configname].get(setting, None), (\n                    \"Expected per-target setting for '%s', got per-config setting \"\n                    \"(target %s)\" % (setting, self.spec[\"target_name\"])\n                )\n        if result is None:\n            return default\n        return result\n\n    def _GetStripPostbuilds(self, configname, output_binary, quiet):\n        \"\"\"Returns a list of shell commands that contain the shell commands\n        necessary to strip this target's binary. These should be run as postbuilds\n        before the actual postbuilds run.\"\"\"\n        self.configname = configname\n\n        result = []\n        if self._Test(\"DEPLOYMENT_POSTPROCESSING\", \"YES\", default=\"NO\") and self._Test(\n            \"STRIP_INSTALLED_PRODUCT\", \"YES\", default=\"NO\"\n        ):\n            default_strip_style = \"debugging\"\n            if (\n                self.spec[\"type\"] == \"loadable_module\" or self._IsIosAppExtension()\n            ) and self._IsBundle():\n                default_strip_style = \"non-global\"\n            elif self.spec[\"type\"] == \"executable\":\n                default_strip_style = \"all\"\n\n            strip_style = self._Settings().get(\"STRIP_STYLE\", default_strip_style)\n            strip_flags = {\"all\": \"\", \"non-global\": \"-x\", \"debugging\": \"-S\"}[\n                strip_style\n            ]\n\n            explicit_strip_flags = self._Settings().get(\"STRIPFLAGS\", \"\")\n            if explicit_strip_flags:\n                strip_flags += \" \" + _NormalizeEnvVarReferences(explicit_strip_flags)\n\n            if not quiet:\n                result.append(\"echo STRIP\\\\(%s\\\\)\" % self.spec[\"target_name\"])\n            result.append(f\"strip {strip_flags} {output_binary}\")\n\n        self.configname = None\n        return result\n\n    def _GetDebugInfoPostbuilds(self, configname, output, output_binary, quiet):\n        \"\"\"Returns a list of shell commands that contain the shell commands\n        necessary to massage this target's debug information. These should be run\n        as postbuilds before the actual postbuilds run.\"\"\"\n        self.configname = configname\n\n        # For static libraries, no dSYMs are created.\n        result = []\n        if (\n            self._Test(\"GCC_GENERATE_DEBUGGING_SYMBOLS\", \"YES\", default=\"YES\")\n            and self._Test(\n                \"DEBUG_INFORMATION_FORMAT\", \"dwarf-with-dsym\", default=\"dwarf\"\n            )\n            and self.spec[\"type\"] != \"static_library\"\n        ):\n            if not quiet:\n                result.append(\"echo DSYMUTIL\\\\(%s\\\\)\" % self.spec[\"target_name\"])\n            result.append(\"dsymutil {} -o {}\".format(output_binary, output + \".dSYM\"))\n\n        self.configname = None\n        return result\n\n    def _GetTargetPostbuilds(self, configname, output, output_binary, quiet=False):\n        \"\"\"Returns a list of shell commands that contain the shell commands\n        to run as postbuilds for this target, before the actual postbuilds.\"\"\"\n        # dSYMs need to build before stripping happens.\n        return self._GetDebugInfoPostbuilds(\n            configname, output, output_binary, quiet\n        ) + self._GetStripPostbuilds(configname, output_binary, quiet)\n\n    def _GetIOSPostbuilds(self, configname, output_binary):\n        \"\"\"Return a shell command to codesign the iOS output binary so it can\n        be deployed to a device.  This should be run as the very last step of the\n        build.\"\"\"\n        if not (\n            (self.isIOS and (self.spec[\"type\"] == \"executable\" or self._IsXCTest()))\n            or self.IsIosFramework()\n        ):\n            return []\n\n        postbuilds = []\n        product_name = self.GetFullProductName()\n        settings = self.xcode_settings[configname]\n\n        # Xcode expects XCTests to be copied into the TEST_HOST dir.\n        if self._IsXCTest():\n            source = os.path.join(\"${BUILT_PRODUCTS_DIR}\", product_name)\n            test_host = os.path.dirname(settings.get(\"TEST_HOST\"))\n            xctest_destination = os.path.join(test_host, \"PlugIns\", product_name)\n            postbuilds.extend([f\"ditto {source} {xctest_destination}\"])\n\n        key = self._GetIOSCodeSignIdentityKey(settings)\n        if not key:\n            return postbuilds\n\n        # Warn for any unimplemented signing xcode keys.\n        unimpl = [\"OTHER_CODE_SIGN_FLAGS\"]\n        unimpl = set(unimpl) & set(self.xcode_settings[configname].keys())\n        if unimpl:\n            print(\n                \"Warning: Some codesign keys not implemented, ignoring: %s\"\n                % \", \".join(sorted(unimpl))\n            )\n\n        if self._IsXCTest():\n            # For device xctests, Xcode copies two extra frameworks into $TEST_HOST.\n            test_host = os.path.dirname(settings.get(\"TEST_HOST\"))\n            frameworks_dir = os.path.join(test_host, \"Frameworks\")\n            platform_root = self._XcodePlatformPath(configname)\n            frameworks = [\n                \"Developer/Library/PrivateFrameworks/IDEBundleInjection.framework\",\n                \"Developer/Library/Frameworks/XCTest.framework\",\n            ]\n            for framework in frameworks:\n                source = os.path.join(platform_root, framework)\n                destination = os.path.join(frameworks_dir, os.path.basename(framework))\n                postbuilds.extend([f\"ditto {source} {destination}\"])\n\n                # Then re-sign everything with 'preserve=True'\n                postbuilds.extend(\n                    [\n                        '%s %s code-sign-bundle \"%s\" \"%s\" \"%s\" \"%s\" %s'\n                        % (\n                            sys.executable,\n                            os.path.join(\"${TARGET_BUILD_DIR}\", \"gyp-mac-tool\"),\n                            key,\n                            settings.get(\"CODE_SIGN_ENTITLEMENTS\", \"\"),\n                            settings.get(\"PROVISIONING_PROFILE\", \"\"),\n                            destination,\n                            True,\n                        )\n                    ]\n                )\n            plugin_dir = os.path.join(test_host, \"PlugIns\")\n            targets = [os.path.join(plugin_dir, product_name), test_host]\n            for target in targets:\n                postbuilds.extend(\n                    [\n                        '%s %s code-sign-bundle \"%s\" \"%s\" \"%s\" \"%s\" %s'\n                        % (\n                            sys.executable,\n                            os.path.join(\"${TARGET_BUILD_DIR}\", \"gyp-mac-tool\"),\n                            key,\n                            settings.get(\"CODE_SIGN_ENTITLEMENTS\", \"\"),\n                            settings.get(\"PROVISIONING_PROFILE\", \"\"),\n                            target,\n                            True,\n                        )\n                    ]\n                )\n\n        postbuilds.extend(\n            [\n                '%s %s code-sign-bundle \"%s\" \"%s\" \"%s\" \"%s\" %s'\n                % (\n                    sys.executable,\n                    os.path.join(\"${TARGET_BUILD_DIR}\", \"gyp-mac-tool\"),\n                    key,\n                    settings.get(\"CODE_SIGN_ENTITLEMENTS\", \"\"),\n                    settings.get(\"PROVISIONING_PROFILE\", \"\"),\n                    os.path.join(\"${BUILT_PRODUCTS_DIR}\", product_name),\n                    False,\n                )\n            ]\n        )\n        return postbuilds\n\n    def _GetIOSCodeSignIdentityKey(self, settings):\n        identity = settings.get(\"CODE_SIGN_IDENTITY\")\n        if not identity:\n            return None\n        if identity not in XcodeSettings._codesigning_key_cache:\n            output = subprocess.check_output(\n                [\"security\", \"find-identity\", \"-p\", \"codesigning\", \"-v\"]\n            )\n            for line in output.splitlines():\n                if identity in line:\n                    fingerprint = line.split()[1]\n                    cache = XcodeSettings._codesigning_key_cache\n                    assert identity not in cache or fingerprint == cache[identity], (\n                        \"Multiple codesigning fingerprints for identity: %s\" % identity\n                    )\n                    XcodeSettings._codesigning_key_cache[identity] = fingerprint\n        return XcodeSettings._codesigning_key_cache.get(identity, \"\")\n\n    def AddImplicitPostbuilds(\n        self, configname, output, output_binary, postbuilds=[], quiet=False\n    ):\n        \"\"\"Returns a list of shell commands that should run before and after\n        |postbuilds|.\"\"\"\n        assert output_binary is not None\n        pre = self._GetTargetPostbuilds(configname, output, output_binary, quiet)\n        post = self._GetIOSPostbuilds(configname, output_binary)\n        return pre + postbuilds + post\n\n    def _AdjustLibrary(self, library, config_name=None):\n        if library.endswith(\".framework\"):\n            l_flag = \"-framework \" + os.path.splitext(os.path.basename(library))[0]\n        else:\n            m = self.library_re.match(library)\n            l_flag = \"-l\" + m.group(1) if m else library\n\n        sdk_root = self._SdkPath(config_name)\n        if not sdk_root:\n            sdk_root = \"\"\n        # Xcode 7 started shipping with \".tbd\" (text based stubs) files instead of\n        # \".dylib\" without providing a real support for them. What it does, for\n        # \"/usr/lib\" libraries, is do \"-L/usr/lib -lname\" which is dependent on the\n        # library order and cause collision when building Chrome.\n        #\n        # Instead substitute \".tbd\" to \".dylib\" in the generated project when the\n        # following conditions are both true:\n        # - library is referenced in the gyp file as \"$(SDKROOT)/**/*.dylib\",\n        # - the \".dylib\" file does not exists but a \".tbd\" file do.\n        library = l_flag.replace(\"$(SDKROOT)\", sdk_root)\n        if l_flag.startswith(\"$(SDKROOT)\"):\n            basename, ext = os.path.splitext(library)\n            if ext == \".dylib\" and not os.path.exists(library):\n                tbd_library = basename + \".tbd\"\n                if os.path.exists(tbd_library):\n                    library = tbd_library\n        return library\n\n    def AdjustLibraries(self, libraries, config_name=None):\n        \"\"\"Transforms entries like 'Cocoa.framework' in libraries into entries like\n        '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc.\n        \"\"\"\n        libraries = [self._AdjustLibrary(library, config_name) for library in libraries]\n        return libraries\n\n    def _BuildMachineOSBuild(self):\n        return GetStdout([\"sw_vers\", \"-buildVersion\"])\n\n    def _XcodeIOSDeviceFamily(self, configname):\n        family = self.xcode_settings[configname].get(\"TARGETED_DEVICE_FAMILY\", \"1\")\n        return [int(x) for x in family.split(\",\")]\n\n    def GetExtraPlistItems(self, configname=None):\n        \"\"\"Returns a dictionary with extra items to insert into Info.plist.\"\"\"\n        if configname not in XcodeSettings._plist_cache:\n            cache = {}\n            cache[\"BuildMachineOSBuild\"] = self._BuildMachineOSBuild()\n\n            xcode_version, xcode_build = XcodeVersion()\n            cache[\"DTXcode\"] = xcode_version\n            cache[\"DTXcodeBuild\"] = xcode_build\n            compiler = self.xcode_settings[configname].get(\"GCC_VERSION\")\n            if compiler is not None:\n                cache[\"DTCompiler\"] = compiler\n\n            sdk_root = self._SdkRoot(configname)\n            if not sdk_root:\n                sdk_root = self._DefaultSdkRoot()\n            sdk_version = self._GetSdkVersionInfoItem(sdk_root, \"--show-sdk-version\")\n            cache[\"DTSDKName\"] = sdk_root + (sdk_version or \"\")\n            if xcode_version >= \"0720\":\n                cache[\"DTSDKBuild\"] = self._GetSdkVersionInfoItem(\n                    sdk_root, \"--show-sdk-build-version\"\n                )\n            elif xcode_version >= \"0430\":\n                cache[\"DTSDKBuild\"] = sdk_version\n            else:\n                cache[\"DTSDKBuild\"] = cache[\"BuildMachineOSBuild\"]\n\n            if self.isIOS:\n                cache[\"MinimumOSVersion\"] = self.xcode_settings[configname].get(\n                    \"IPHONEOS_DEPLOYMENT_TARGET\"\n                )\n                cache[\"DTPlatformName\"] = sdk_root\n                cache[\"DTPlatformVersion\"] = sdk_version\n\n                if configname.endswith(\"iphoneos\"):\n                    cache[\"CFBundleSupportedPlatforms\"] = [\"iPhoneOS\"]\n                    cache[\"DTPlatformBuild\"] = cache[\"DTSDKBuild\"]\n                else:\n                    cache[\"CFBundleSupportedPlatforms\"] = [\"iPhoneSimulator\"]\n                    # This is weird, but Xcode sets DTPlatformBuild to an empty field\n                    # for simulator builds.\n                    cache[\"DTPlatformBuild\"] = \"\"\n            XcodeSettings._plist_cache[configname] = cache\n\n        # Include extra plist items that are per-target, not per global\n        # XcodeSettings.\n        items = dict(XcodeSettings._plist_cache[configname])\n        if self.isIOS:\n            items[\"UIDeviceFamily\"] = self._XcodeIOSDeviceFamily(configname)\n        return items\n\n    def _DefaultSdkRoot(self):\n        \"\"\"Returns the default SDKROOT to use.\n\n        Prior to version 5.0.0, if SDKROOT was not explicitly set in the Xcode\n        project, then the environment variable was empty. Starting with this\n        version, Xcode uses the name of the newest SDK installed.\n        \"\"\"\n        xcode_version, _ = XcodeVersion()\n        if xcode_version < \"0500\":\n            return \"\"\n        default_sdk_path = self._XcodeSdkPath(\"\")\n        if default_sdk_root := XcodeSettings._sdk_root_cache.get(default_sdk_path):\n            return default_sdk_root\n        try:\n            all_sdks = GetStdout([\"xcodebuild\", \"-showsdks\"])\n        except (GypError, OSError):\n            # If xcodebuild fails, there will be no valid SDKs\n            return \"\"\n        for line in all_sdks.splitlines():\n            items = line.split()\n            if len(items) >= 3 and items[-2] == \"-sdk\":\n                sdk_root = items[-1]\n                sdk_path = self._XcodeSdkPath(sdk_root)\n                if sdk_path == default_sdk_path:\n                    return sdk_root\n        return \"\"\n\n\nclass MacPrefixHeader:\n    \"\"\"A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature.\n\n    This feature consists of several pieces:\n    * If GCC_PREFIX_HEADER is present, all compilations in that project get an\n      additional |-include path_to_prefix_header| cflag.\n    * If GCC_PRECOMPILE_PREFIX_HEADER is present too, then the prefix header is\n      instead compiled, and all other compilations in the project get an\n      additional |-include path_to_compiled_header| instead.\n      + Compiled prefix headers have the extension gch. There is one gch file for\n        every language used in the project (c, cc, m, mm), since gch files for\n        different languages aren't compatible.\n      + gch files themselves are built with the target's normal cflags, but they\n        obviously don't get the |-include| flag. Instead, they need a -x flag that\n        describes their language.\n      + All o files in the target need to depend on the gch file, to make sure\n        it's built before any o file is built.\n\n    This class helps with some of these tasks, but it needs help from the build\n    system for writing dependencies to the gch files, for writing build commands\n    for the gch files, and for figuring out the location of the gch files.\n    \"\"\"\n\n    def __init__(\n        self, xcode_settings, gyp_path_to_build_path, gyp_path_to_build_output\n    ):\n        \"\"\"If xcode_settings is None, all methods on this class are no-ops.\n\n        Args:\n            gyp_path_to_build_path: A function that takes a gyp-relative path,\n                and returns a path relative to the build directory.\n            gyp_path_to_build_output: A function that takes a gyp-relative path and\n                a language code ('c', 'cc', 'm', or 'mm'), and that returns a path\n                to where the output of precompiling that path for that language\n                should be placed (without the trailing '.gch').\n        \"\"\"\n        # This doesn't support per-configuration prefix headers. Good enough\n        # for now.\n        self.header = None\n        self.compile_headers = False\n        if xcode_settings:\n            self.header = xcode_settings.GetPerTargetSetting(\"GCC_PREFIX_HEADER\")\n            self.compile_headers = (\n                xcode_settings.GetPerTargetSetting(\n                    \"GCC_PRECOMPILE_PREFIX_HEADER\", default=\"NO\"\n                )\n                != \"NO\"\n            )\n        self.compiled_headers = {}\n        if self.header:\n            if self.compile_headers:\n                for lang in [\"c\", \"cc\", \"m\", \"mm\"]:\n                    self.compiled_headers[lang] = gyp_path_to_build_output(\n                        self.header, lang\n                    )\n            self.header = gyp_path_to_build_path(self.header)\n\n    def _CompiledHeader(self, lang, arch):\n        assert self.compile_headers\n        h = self.compiled_headers[lang]\n        if arch:\n            h += \".\" + arch\n        return h\n\n    def GetInclude(self, lang, arch=None):\n        \"\"\"Gets the cflags to include the prefix header for language |lang|.\"\"\"\n        if self.compile_headers and lang in self.compiled_headers:\n            return \"-include %s\" % self._CompiledHeader(lang, arch)\n        elif self.header:\n            return \"-include %s\" % self.header\n        else:\n            return \"\"\n\n    def _Gch(self, lang, arch):\n        \"\"\"Returns the actual file name of the prefix header for language |lang|.\"\"\"\n        assert self.compile_headers\n        return self._CompiledHeader(lang, arch) + \".gch\"\n\n    def GetObjDependencies(self, sources, objs, arch=None):\n        \"\"\"Given a list of source files and the corresponding object files, returns\n        a list of (source, object, gch) tuples, where |gch| is the build-directory\n        relative path to the gch file each object file depends on.  |compilable[i]|\n        has to be the source file belonging to |objs[i]|.\"\"\"\n        if not self.header or not self.compile_headers:\n            return []\n\n        result = []\n        for source, obj in zip(sources, objs):\n            ext = os.path.splitext(source)[1]\n            lang = {\n                \".c\": \"c\",\n                \".cpp\": \"cc\",\n                \".cc\": \"cc\",\n                \".cxx\": \"cc\",\n                \".m\": \"m\",\n                \".mm\": \"mm\",\n            }.get(ext, None)\n            if lang:\n                result.append((source, obj, self._Gch(lang, arch)))\n        return result\n\n    def GetPchBuildCommands(self, arch=None):\n        \"\"\"Returns [(path_to_gch, language_flag, language, header)].\n        |path_to_gch| and |header| are relative to the build directory.\n        \"\"\"\n        if not self.header or not self.compile_headers:\n            return []\n        return [\n            (self._Gch(\"c\", arch), \"-x c-header\", \"c\", self.header),\n            (self._Gch(\"cc\", arch), \"-x c++-header\", \"cc\", self.header),\n            (self._Gch(\"m\", arch), \"-x objective-c-header\", \"m\", self.header),\n            (self._Gch(\"mm\", arch), \"-x objective-c++-header\", \"mm\", self.header),\n        ]\n\n\ndef XcodeVersion():\n    \"\"\"Returns a tuple of version and build version of installed Xcode.\"\"\"\n    # `xcodebuild -version` output looks like\n    #    Xcode 4.6.3\n    #    Build version 4H1503\n    # or like\n    #    Xcode 3.2.6\n    #    Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0\n    #    BuildVersion: 10M2518\n    # Convert that to ('0463', '4H1503') or ('0326', '10M2518').\n    global XCODE_VERSION_CACHE\n    if XCODE_VERSION_CACHE:\n        return XCODE_VERSION_CACHE\n    version = \"\"\n    build = \"\"\n    try:\n        version_list = GetStdoutQuiet([\"xcodebuild\", \"-version\"]).splitlines()\n        # In some circumstances xcodebuild exits 0 but doesn't return\n        # the right results; for example, a user on 10.7 or 10.8 with\n        # a bogus path set via xcode-select\n        # In that case this may be a CLT-only install so fall back to\n        # checking that version.\n        if len(version_list) < 2:\n            raise GypError(\"xcodebuild returned unexpected results\")\n        version = version_list[0].split()[-1]  # Last word on first line\n        build = version_list[-1].split()[-1]  # Last word on last line\n    except (GypError, OSError):\n        # Xcode not installed so look for XCode Command Line Tools\n        version = CLTVersion()  # macOS Catalina returns 11.0.0.0.1.1567737322\n        if not version:\n            raise GypError(\"No Xcode or CLT version detected!\")\n    # Be careful to convert \"4.2.3\" to \"0423\" and \"11.0.0\" to \"1100\":\n    version = version.split(\".\")[:3]  # Just major, minor, micro\n    version[0] = version[0].zfill(2)  # Add a leading zero if major is one digit\n    version = (\"\".join(version) + \"00\")[:4]  # Limit to exactly four characters\n    XCODE_VERSION_CACHE = (version, build)\n    return XCODE_VERSION_CACHE\n\n\n# This function ported from the logic in Homebrew's CLT version check\ndef CLTVersion():\n    \"\"\"Returns the version of command-line tools from pkgutil.\"\"\"\n    # pkgutil output looks like\n    #   package-id: com.apple.pkg.CLTools_Executables\n    #   version: 5.0.1.0.1.1382131676\n    #   volume: /\n    #   location: /\n    #   install-time: 1382544035\n    #   groups: com.apple.FindSystemFiles.pkg-group\n    #           com.apple.DevToolsBoth.pkg-group\n    #           com.apple.DevToolsNonRelocatableShared.pkg-group\n    STANDALONE_PKG_ID = \"com.apple.pkg.DeveloperToolsCLILeo\"\n    FROM_XCODE_PKG_ID = \"com.apple.pkg.DeveloperToolsCLI\"\n    MAVERICKS_PKG_ID = \"com.apple.pkg.CLTools_Executables\"\n\n    regex = re.compile(r\"version: (?P<version>.+)\")\n    for key in [MAVERICKS_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID]:\n        try:\n            output = GetStdout([\"/usr/sbin/pkgutil\", \"--pkg-info\", key])\n            if m := re.search(regex, output):\n                return m.groupdict()[\"version\"]\n        except (GypError, OSError):\n            continue\n\n    regex = re.compile(r\"Command Line Tools for Xcode\\s+(?P<version>\\S+)\")\n    try:\n        output = GetStdout([\"/usr/sbin/softwareupdate\", \"--history\"])\n        if m := re.search(regex, output):\n            return m.groupdict()[\"version\"]\n    except (GypError, OSError):\n        return None\n\n\ndef GetStdoutQuiet(cmdlist):\n    \"\"\"Returns the content of standard output returned by invoking |cmdlist|.\n    Ignores the stderr.\n    Raises |GypError| if the command return with a non-zero return code.\"\"\"\n    job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n    out = job.communicate()[0].decode(\"utf-8\")\n    if job.returncode != 0:\n        raise GypError(\"Error %d running %s\" % (job.returncode, cmdlist[0]))\n    return out.rstrip(\"\\n\")\n\n\ndef GetStdout(cmdlist):\n    \"\"\"Returns the content of standard output returned by invoking |cmdlist|.\n    Raises |GypError| if the command return with a non-zero return code.\"\"\"\n    job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE)\n    out = job.communicate()[0].decode(\"utf-8\")\n    if job.returncode != 0:\n        sys.stderr.write(out + \"\\n\")\n        raise GypError(\"Error %d running %s\" % (job.returncode, cmdlist[0]))\n    return out.rstrip(\"\\n\")\n\n\ndef MergeGlobalXcodeSettingsToSpec(global_dict, spec):\n    \"\"\"Merges the global xcode_settings dictionary into each configuration of the\n    target represented by spec. For keys that are both in the global and the local\n    xcode_settings dict, the local key gets precedence.\n    \"\"\"\n    # The xcode generator special-cases global xcode_settings and does something\n    # that amounts to merging in the global xcode_settings into each local\n    # xcode_settings dict.\n    global_xcode_settings = global_dict.get(\"xcode_settings\", {})\n    for config in spec[\"configurations\"].values():\n        if \"xcode_settings\" in config:\n            new_settings = global_xcode_settings.copy()\n            new_settings.update(config[\"xcode_settings\"])\n            config[\"xcode_settings\"] = new_settings\n\n\ndef IsMacBundle(flavor, spec):\n    \"\"\"Returns if |spec| should be treated as a bundle.\n\n    Bundles are directories with a certain subdirectory structure, instead of\n    just a single file. Bundle rules do not produce a binary but also package\n    resources into that directory.\"\"\"\n    is_mac_bundle = (\n        int(spec.get(\"mac_xctest_bundle\", 0)) != 0\n        or int(spec.get(\"mac_xcuitest_bundle\", 0)) != 0\n        or (int(spec.get(\"mac_bundle\", 0)) != 0 and flavor == \"mac\")\n    )\n\n    if is_mac_bundle:\n        assert spec[\"type\"] != \"none\", (\n            'mac_bundle targets cannot have type none (target \"%s\")'\n            % spec[\"target_name\"]\n        )\n    return is_mac_bundle\n\n\ndef GetMacBundleResources(product_dir, xcode_settings, resources):\n    \"\"\"Yields (output, resource) pairs for every resource in |resources|.\n    Only call this for mac bundle targets.\n\n    Args:\n        product_dir: Path to the directory containing the output bundle,\n            relative to the build directory.\n        xcode_settings: The XcodeSettings of the current target.\n        resources: A list of bundle resources, relative to the build directory.\n    \"\"\"\n    dest = os.path.join(product_dir, xcode_settings.GetBundleResourceFolder())\n    for res in resources:\n        output = dest\n\n        # The make generator doesn't support it, so forbid it everywhere\n        # to keep the generators more interchangeable.\n        assert \" \" not in res, \"Spaces in resource filenames not supported (%s)\" % res\n\n        # Split into (path,file).\n        res_parts = os.path.split(res)\n\n        # Now split the path into (prefix,maybe.lproj).\n        lproj_parts = os.path.split(res_parts[0])\n        # If the resource lives in a .lproj bundle, add that to the destination.\n        if lproj_parts[1].endswith(\".lproj\"):\n            output = os.path.join(output, lproj_parts[1])\n\n        output = os.path.join(output, res_parts[1])\n        # Compiled XIB files are referred to by .nib.\n        if output.endswith(\".xib\"):\n            output = os.path.splitext(output)[0] + \".nib\"\n        # Compiled storyboard files are referred to by .storyboardc.\n        if output.endswith(\".storyboard\"):\n            output = os.path.splitext(output)[0] + \".storyboardc\"\n\n        yield output, res\n\n\ndef GetMacInfoPlist(product_dir, xcode_settings, gyp_path_to_build_path):\n    \"\"\"Returns (info_plist, dest_plist, defines, extra_env), where:\n    * |info_plist| is the source plist path, relative to the\n      build directory,\n    * |dest_plist| is the destination plist path, relative to the\n      build directory,\n    * |defines| is a list of preprocessor defines (empty if the plist\n      shouldn't be preprocessed,\n    * |extra_env| is a dict of env variables that should be exported when\n      invoking |mac_tool copy-info-plist|.\n\n    Only call this for mac bundle targets.\n\n    Args:\n        product_dir: Path to the directory containing the output bundle,\n            relative to the build directory.\n        xcode_settings: The XcodeSettings of the current target.\n        gyp_to_build_path: A function that converts paths relative to the\n            current gyp file to paths relative to the build directory.\n    \"\"\"\n    info_plist = xcode_settings.GetPerTargetSetting(\"INFOPLIST_FILE\")\n    if not info_plist:\n        return None, None, [], {}\n\n    # The make generator doesn't support it, so forbid it everywhere\n    # to keep the generators more interchangeable.\n    assert \" \" not in info_plist, (\n        \"Spaces in Info.plist filenames not supported (%s)\" % info_plist\n    )\n\n    info_plist = gyp_path_to_build_path(info_plist)\n\n    # If explicitly set to preprocess the plist, invoke the C preprocessor and\n    # specify any defines as -D flags.\n    if (\n        xcode_settings.GetPerTargetSetting(\"INFOPLIST_PREPROCESS\", default=\"NO\")\n        == \"YES\"\n    ):\n        # Create an intermediate file based on the path.\n        defines = shlex.split(\n            xcode_settings.GetPerTargetSetting(\n                \"INFOPLIST_PREPROCESSOR_DEFINITIONS\", default=\"\"\n            )\n        )\n    else:\n        defines = []\n\n    dest_plist = os.path.join(product_dir, xcode_settings.GetBundlePlistPath())\n    extra_env = xcode_settings.GetPerTargetSettings()\n\n    return info_plist, dest_plist, defines, extra_env\n\n\ndef _GetXcodeEnv(\n    xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None\n):\n    \"\"\"Return the environment variables that Xcode would set. See\n    http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153\n    for a full list.\n\n    Args:\n        xcode_settings: An XcodeSettings object. If this is None, this function\n            returns an empty dict.\n        built_products_dir: Absolute path to the built products dir.\n        srcroot: Absolute path to the source root.\n        configuration: The build configuration name.\n        additional_settings: An optional dict with more values to add to the\n            result.\n    \"\"\"\n\n    if not xcode_settings:\n        return {}\n\n    # This function is considered a friend of XcodeSettings, so let it reach into\n    # its implementation details.\n    spec = xcode_settings.spec\n\n    # These are filled in on an as-needed basis.\n    env = {\n        \"BUILT_FRAMEWORKS_DIR\": built_products_dir,\n        \"BUILT_PRODUCTS_DIR\": built_products_dir,\n        \"CONFIGURATION\": configuration,\n        \"PRODUCT_NAME\": xcode_settings.GetProductName(),\n        # For FULL_PRODUCT_NAME see:\n        # /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX\\ Product\\ Types.xcspec  # noqa: E501\n        \"SRCROOT\": srcroot,\n        \"SOURCE_ROOT\": \"${SRCROOT}\",\n        # This is not true for static libraries, but currently the env is only\n        # written for bundles:\n        \"TARGET_BUILD_DIR\": built_products_dir,\n        \"TEMP_DIR\": \"${TMPDIR}\",\n        \"XCODE_VERSION_ACTUAL\": XcodeVersion()[0],\n    }\n    if xcode_settings.GetPerConfigSetting(\"SDKROOT\", configuration):\n        env[\"SDKROOT\"] = xcode_settings._SdkPath(configuration)\n    else:\n        env[\"SDKROOT\"] = \"\"\n\n    if xcode_settings.mac_toolchain_dir:\n        env[\"DEVELOPER_DIR\"] = xcode_settings.mac_toolchain_dir\n\n    if spec[\"type\"] in (\n        \"executable\",\n        \"static_library\",\n        \"shared_library\",\n        \"loadable_module\",\n    ):\n        env[\"EXECUTABLE_NAME\"] = xcode_settings.GetExecutableName()\n        env[\"EXECUTABLE_PATH\"] = xcode_settings.GetExecutablePath()\n        env[\"FULL_PRODUCT_NAME\"] = xcode_settings.GetFullProductName()\n        mach_o_type = xcode_settings.GetMachOType()\n        if mach_o_type:\n            env[\"MACH_O_TYPE\"] = mach_o_type\n        env[\"PRODUCT_TYPE\"] = xcode_settings.GetProductType()\n    if xcode_settings._IsBundle():\n        # xcodeproj_file.py sets the same Xcode subfolder value for this as for\n        # FRAMEWORKS_FOLDER_PATH so Xcode builds will actually use FFP's value.\n        env[\"BUILT_FRAMEWORKS_DIR\"] = os.path.join(\n            built_products_dir + os.sep + xcode_settings.GetBundleFrameworksFolderPath()\n        )\n        env[\"CONTENTS_FOLDER_PATH\"] = xcode_settings.GetBundleContentsFolderPath()\n        env[\"EXECUTABLE_FOLDER_PATH\"] = xcode_settings.GetBundleExecutableFolderPath()\n        env[\"UNLOCALIZED_RESOURCES_FOLDER_PATH\"] = (\n            xcode_settings.GetBundleResourceFolder()\n        )\n        env[\"JAVA_FOLDER_PATH\"] = xcode_settings.GetBundleJavaFolderPath()\n        env[\"FRAMEWORKS_FOLDER_PATH\"] = xcode_settings.GetBundleFrameworksFolderPath()\n        env[\"SHARED_FRAMEWORKS_FOLDER_PATH\"] = (\n            xcode_settings.GetBundleSharedFrameworksFolderPath()\n        )\n        env[\"SHARED_SUPPORT_FOLDER_PATH\"] = (\n            xcode_settings.GetBundleSharedSupportFolderPath()\n        )\n        env[\"PLUGINS_FOLDER_PATH\"] = xcode_settings.GetBundlePlugInsFolderPath()\n        env[\"XPCSERVICES_FOLDER_PATH\"] = xcode_settings.GetBundleXPCServicesFolderPath()\n        env[\"INFOPLIST_PATH\"] = xcode_settings.GetBundlePlistPath()\n        env[\"WRAPPER_NAME\"] = xcode_settings.GetWrapperName()\n\n    if install_name := xcode_settings.GetInstallName():\n        env[\"LD_DYLIB_INSTALL_NAME\"] = install_name\n    if install_name_base := xcode_settings.GetInstallNameBase():\n        env[\"DYLIB_INSTALL_NAME_BASE\"] = install_name_base\n    xcode_version, _ = XcodeVersion()\n    if xcode_version >= \"0500\" and not env.get(\"SDKROOT\"):\n        sdk_root = xcode_settings._SdkRoot(configuration)\n        if not sdk_root:\n            sdk_root = xcode_settings._XcodeSdkPath(\"\")\n        if sdk_root is None:\n            sdk_root = \"\"\n        env[\"SDKROOT\"] = sdk_root\n\n    if not additional_settings:\n        additional_settings = {}\n    else:\n        # Flatten lists to strings.\n        for k in additional_settings:\n            if not isinstance(additional_settings[k], str):\n                additional_settings[k] = \" \".join(additional_settings[k])\n    additional_settings.update(env)\n\n    for k in additional_settings:\n        additional_settings[k] = _NormalizeEnvVarReferences(additional_settings[k])\n\n    return additional_settings\n\n\ndef _NormalizeEnvVarReferences(str):\n    \"\"\"Takes a string containing variable references in the form ${FOO}, $(FOO),\n    or $FOO, and returns a string with all variable references in the form ${FOO}.\n    \"\"\"\n    # $FOO -> ${FOO}\n    str = re.sub(r\"\\$([a-zA-Z_][a-zA-Z0-9_]*)\", r\"${\\1}\", str)\n\n    # $(FOO) -> ${FOO}\n    matches = re.findall(r\"(\\$\\(([a-zA-Z0-9\\-_]+)\\))\", str)\n    for match in matches:\n        to_replace, variable = match\n        assert \"$(\" not in match, \"$($(FOO)) variables not supported: \" + match\n        str = str.replace(to_replace, \"${\" + variable + \"}\")\n\n    return str\n\n\ndef ExpandEnvVars(string, expansions):\n    \"\"\"Expands ${VARIABLES}, $(VARIABLES), and $VARIABLES in string per the\n    expansions list. If the variable expands to something that references\n    another variable, this variable is expanded as well if it's in env --\n    until no variables present in env are left.\"\"\"\n    for k, v in reversed(expansions):\n        string = string.replace(\"${\" + k + \"}\", v)\n        string = string.replace(\"$(\" + k + \")\", v)\n        string = string.replace(\"$\" + k, v)\n    return string\n\n\ndef _TopologicallySortedEnvVarKeys(env):\n    \"\"\"Takes a dict |env| whose values are strings that can refer to other keys,\n    for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of\n    env such that key2 is after key1 in L if env[key2] refers to env[key1].\n\n    Throws an Exception in case of dependency cycles.\n    \"\"\"\n    # Since environment variables can refer to other variables, the evaluation\n    # order is important. Below is the logic to compute the dependency graph\n    # and sort it.\n    regex = re.compile(r\"\\$\\{([a-zA-Z0-9\\-_]+)\\}\")\n\n    def GetEdges(node):\n        # Use a definition of edges such that user_of_variable -> used_variable.\n        # This happens to be easier in this case, since a variable's\n        # definition contains all variables it references in a single string.\n        # We can then reverse the result of the topological sort at the end.\n        # Since: reverse(topsort(DAG)) = topsort(reverse_edges(DAG))\n        matches = {v for v in regex.findall(env[node]) if v in env}\n        for dependee in matches:\n            assert \"${\" not in dependee, \"Nested variables not supported: \" + dependee\n        return matches\n\n    try:\n        # Topologically sort, and then reverse, because we used an edge definition\n        # that's inverted from the expected result of this function (see comment\n        # above).\n        order = gyp.common.TopologicallySorted(env.keys(), GetEdges)\n        order.reverse()\n        return order\n    except gyp.common.CycleError as e:\n        raise GypError(\n            \"Xcode environment variables are cyclically dependent: \" + str(e.nodes)\n        )\n\n\ndef GetSortedXcodeEnv(\n    xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None\n):\n    env = _GetXcodeEnv(\n        xcode_settings, built_products_dir, srcroot, configuration, additional_settings\n    )\n    return [(key, env[key]) for key in _TopologicallySortedEnvVarKeys(env)]\n\n\ndef GetSpecPostbuildCommands(spec, quiet=False):\n    \"\"\"Returns the list of postbuilds explicitly defined on |spec|, in a form\n    executable by a shell.\"\"\"\n    postbuilds = []\n    for postbuild in spec.get(\"postbuilds\", []):\n        if not quiet:\n            postbuilds.append(\n                \"echo POSTBUILD\\\\(%s\\\\) %s\"\n                % (spec[\"target_name\"], postbuild[\"postbuild_name\"])\n            )\n        postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild[\"action\"]))\n    return postbuilds\n\n\ndef _HasIOSTarget(targets):\n    \"\"\"Returns true if any target contains the iOS specific key\n    IPHONEOS_DEPLOYMENT_TARGET.\"\"\"\n    for target_dict in targets.values():\n        for config in target_dict[\"configurations\"].values():\n            if config.get(\"xcode_settings\", {}).get(\"IPHONEOS_DEPLOYMENT_TARGET\"):\n                return True\n    return False\n\n\ndef _AddIOSDeviceConfigurations(targets):\n    \"\"\"Clone all targets and append -iphoneos to the name. Configure these targets\n    to build for iOS devices and use correct architectures for those builds.\"\"\"\n    for target_dict in targets.values():\n        toolset = target_dict[\"toolset\"]\n        configs = target_dict[\"configurations\"]\n        for config_name, simulator_config_dict in dict(configs).items():\n            iphoneos_config_dict = copy.deepcopy(simulator_config_dict)\n            configs[config_name + \"-iphoneos\"] = iphoneos_config_dict\n            configs[config_name + \"-iphonesimulator\"] = simulator_config_dict\n            if toolset == \"target\":\n                simulator_config_dict[\"xcode_settings\"][\"SDKROOT\"] = \"iphonesimulator\"\n                iphoneos_config_dict[\"xcode_settings\"][\"SDKROOT\"] = \"iphoneos\"\n    return targets\n\n\ndef CloneConfigurationForDeviceAndEmulator(target_dicts):\n    \"\"\"If |target_dicts| contains any iOS targets, automatically create -iphoneos\n    targets for iOS device builds.\"\"\"\n    if _HasIOSTarget(target_dicts):\n        return _AddIOSDeviceConfigurations(target_dicts)\n    return target_dicts\n"
  },
  {
    "path": "gyp/pylib/gyp/xcode_emulation_test.py",
    "content": "#!/usr/bin/env python3\n\n\"\"\"Unit tests for the xcode_emulation.py file.\"\"\"\n\nimport sys\nimport unittest\n\nfrom gyp.xcode_emulation import XcodeSettings\n\n\nclass TestXcodeSettings(unittest.TestCase):\n    def setUp(self):\n        if sys.platform != \"darwin\":\n            self.skipTest(\"This test only runs on macOS\")\n\n    def test_GetCflags(self):\n        target = {\n            \"type\": \"static_library\",\n            \"configurations\": {\n                \"Release\": {},\n            },\n        }\n        configuration_name = \"Release\"\n        xcode_settings = XcodeSettings(target)\n        cflags = xcode_settings.GetCflags(configuration_name, \"arm64\")\n\n        # Do not quote `-arch arm64` with spaces in one string.\n        self.assertEqual(\n            cflags,\n            [\"-fasm-blocks\", \"-mpascal-strings\", \"-Os\", \"-gdwarf-2\", \"-arch\", \"arm64\"],\n        )\n\n    def GypToBuildPath(self, path):\n        return path\n\n    def test_GetLdflags(self):\n        target = {\n            \"type\": \"static_library\",\n            \"configurations\": {\n                \"Release\": {},\n            },\n        }\n        configuration_name = \"Release\"\n        xcode_settings = XcodeSettings(target)\n        ldflags = xcode_settings.GetLdflags(\n            configuration_name, \"PRODUCT_DIR\", self.GypToBuildPath, \"arm64\"\n        )\n\n        # Do not quote `-arch arm64` with spaces in one string.\n        self.assertEqual(ldflags, [\"-arch\", \"arm64\", \"-LPRODUCT_DIR\"])\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
  },
  {
    "path": "gyp/pylib/gyp/xcode_ninja.py",
    "content": "# Copyright (c) 2014 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Xcode-ninja wrapper project file generator.\n\nThis updates the data structures passed to the Xcode gyp generator to build\nwith ninja instead. The Xcode project itself is transformed into a list of\nexecutable targets, each with a build step to build with ninja, and a target\nwith every source and resource file.  This appears to sidestep some of the\nmajor performance headaches experienced using complex projects and large number\nof targets within Xcode.\n\"\"\"\n\nimport errno\nimport os\nimport re\nimport xml.sax.saxutils\n\nimport gyp.generator.ninja\n\n\ndef _WriteWorkspace(main_gyp, sources_gyp, params):\n    \"\"\"Create a workspace to wrap main and sources gyp paths.\"\"\"\n    (build_file_root, _build_file_ext) = os.path.splitext(main_gyp)\n    workspace_path = build_file_root + \".xcworkspace\"\n    options = params[\"options\"]\n    if options.generator_output:\n        workspace_path = os.path.join(options.generator_output, workspace_path)\n    try:\n        os.makedirs(workspace_path)\n    except OSError as e:\n        if e.errno != errno.EEXIST:\n            raise\n    output_string = (\n        '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' + '<Workspace version = \"1.0\">\\n'\n    )\n    for gyp_name in [main_gyp, sources_gyp]:\n        name = os.path.splitext(os.path.basename(gyp_name))[0] + \".xcodeproj\"\n        name = xml.sax.saxutils.quoteattr(\"group:\" + name)\n        output_string += \"  <FileRef location = %s></FileRef>\\n\" % name\n    output_string += \"</Workspace>\\n\"\n\n    workspace_file = os.path.join(workspace_path, \"contents.xcworkspacedata\")\n\n    try:\n        with open(workspace_file) as input_file:\n            input_string = input_file.read()\n            if input_string == output_string:\n                return\n    except OSError:\n        # Ignore errors if the file doesn't exist.\n        pass\n\n    with open(workspace_file, \"w\") as output_file:\n        output_file.write(output_string)\n\n\ndef _TargetFromSpec(old_spec, params):\n    \"\"\"Create fake target for xcode-ninja wrapper.\"\"\"\n    # Determine ninja top level build dir (e.g. /path/to/out).\n    ninja_toplevel = None\n    jobs = 0\n    if params:\n        options = params[\"options\"]\n        ninja_toplevel = os.path.join(\n            options.toplevel_dir, gyp.generator.ninja.ComputeOutputDir(params)\n        )\n        jobs = params.get(\"generator_flags\", {}).get(\"xcode_ninja_jobs\", 0)\n\n    target_name = old_spec.get(\"target_name\")\n    product_name = old_spec.get(\"product_name\", target_name)\n\n    ninja_target = {}\n    ninja_target[\"target_name\"] = target_name\n    ninja_target[\"product_name\"] = product_name\n    if product_extension := old_spec.get(\"product_extension\"):\n        ninja_target[\"product_extension\"] = product_extension\n    ninja_target[\"toolset\"] = old_spec.get(\"toolset\")\n    ninja_target[\"default_configuration\"] = old_spec.get(\"default_configuration\")\n    ninja_target[\"configurations\"] = {}\n\n    # Tell Xcode to look in |ninja_toplevel| for build products.\n    new_xcode_settings = {}\n    if ninja_toplevel:\n        new_xcode_settings[\"CONFIGURATION_BUILD_DIR\"] = (\n            \"%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\" % ninja_toplevel\n        )\n\n    if \"configurations\" in old_spec:\n        for config in old_spec[\"configurations\"]:\n            old_xcode_settings = old_spec[\"configurations\"][config].get(\n                \"xcode_settings\", {}\n            )\n            if \"IPHONEOS_DEPLOYMENT_TARGET\" in old_xcode_settings:\n                new_xcode_settings[\"CODE_SIGNING_REQUIRED\"] = \"NO\"\n                new_xcode_settings[\"IPHONEOS_DEPLOYMENT_TARGET\"] = old_xcode_settings[\n                    \"IPHONEOS_DEPLOYMENT_TARGET\"\n                ]\n            for key in [\"BUNDLE_LOADER\", \"TEST_HOST\"]:\n                if key in old_xcode_settings:\n                    new_xcode_settings[key] = old_xcode_settings[key]\n\n            ninja_target[\"configurations\"][config] = {}\n            ninja_target[\"configurations\"][config][\"xcode_settings\"] = (\n                new_xcode_settings\n            )\n\n    ninja_target[\"mac_bundle\"] = old_spec.get(\"mac_bundle\", 0)\n    ninja_target[\"mac_xctest_bundle\"] = old_spec.get(\"mac_xctest_bundle\", 0)\n    ninja_target[\"ios_app_extension\"] = old_spec.get(\"ios_app_extension\", 0)\n    ninja_target[\"ios_watchkit_extension\"] = old_spec.get(\"ios_watchkit_extension\", 0)\n    ninja_target[\"ios_watchkit_app\"] = old_spec.get(\"ios_watchkit_app\", 0)\n    ninja_target[\"type\"] = old_spec[\"type\"]\n    if ninja_toplevel:\n        ninja_target[\"actions\"] = [\n            {\n                \"action_name\": \"Compile and copy %s via ninja\" % target_name,\n                \"inputs\": [],\n                \"outputs\": [],\n                \"action\": [\n                    \"env\",\n                    \"PATH=%s\" % os.environ[\"PATH\"],\n                    \"ninja\",\n                    \"-C\",\n                    new_xcode_settings[\"CONFIGURATION_BUILD_DIR\"],\n                    target_name,\n                ],\n                \"message\": \"Compile and copy %s via ninja\" % target_name,\n            },\n        ]\n        if jobs > 0:\n            ninja_target[\"actions\"][0][\"action\"].extend((\"-j\", jobs))\n    return ninja_target\n\n\ndef IsValidTargetForWrapper(target_extras, executable_target_pattern, spec):\n    \"\"\"Limit targets for Xcode wrapper.\n\n    Xcode sometimes performs poorly with too many targets, so only include\n    proper executable targets, with filters to customize.\n    Arguments:\n      target_extras: Regular expression to always add, matching any target.\n      executable_target_pattern: Regular expression limiting executable targets.\n      spec: Specifications for target.\n    \"\"\"\n    target_name = spec.get(\"target_name\")\n    # Always include targets matching target_extras.\n    if target_extras is not None and re.search(target_extras, target_name):\n        return True\n\n    # Otherwise just show executable targets and xc_tests.\n    if int(spec.get(\"mac_xctest_bundle\", 0)) != 0 or (\n        spec.get(\"type\", \"\") == \"executable\"\n        and spec.get(\"product_extension\", \"\") != \"bundle\"\n    ):\n        # If there is a filter and the target does not match, exclude the target.\n        if executable_target_pattern is not None:\n            if not re.search(executable_target_pattern, target_name):\n                return False\n        return True\n    return False\n\n\ndef CreateWrapper(target_list, target_dicts, data, params):\n    \"\"\"Initialize targets for the ninja wrapper.\n\n    This sets up the necessary variables in the targets to generate Xcode projects\n    that use ninja as an external builder.\n    Arguments:\n      target_list: List of target pairs: 'base/base.gyp:base'.\n      target_dicts: Dict of target properties keyed on target pair.\n      data: Dict of flattened build files keyed on gyp path.\n      params: Dict of global options for gyp.\n    \"\"\"\n    orig_gyp = params[\"build_files\"][0]\n    for gyp_name, gyp_dict in data.items():\n        if gyp_name == orig_gyp:\n            depth = gyp_dict[\"_DEPTH\"]\n\n    # Check for custom main gyp name, otherwise use the default CHROMIUM_GYP_FILE\n    # and prepend .ninja before the .gyp extension.\n    generator_flags = params.get(\"generator_flags\", {})\n    main_gyp = generator_flags.get(\"xcode_ninja_main_gyp\", None)\n    if main_gyp is None:\n        (build_file_root, build_file_ext) = os.path.splitext(orig_gyp)\n        main_gyp = build_file_root + \".ninja\" + build_file_ext\n\n    # Create new |target_list|, |target_dicts| and |data| data structures.\n    new_target_list = []\n    new_target_dicts = {}\n    new_data = {}\n\n    # Set base keys needed for |data|.\n    new_data[main_gyp] = {}\n    new_data[main_gyp][\"included_files\"] = []\n    new_data[main_gyp][\"targets\"] = []\n    new_data[main_gyp][\"xcode_settings\"] = data[orig_gyp].get(\"xcode_settings\", {})\n\n    # Normally the xcode-ninja generator includes only valid executable targets.\n    # If |xcode_ninja_executable_target_pattern| is set, that list is reduced to\n    # executable targets that match the pattern. (Default all)\n    executable_target_pattern = generator_flags.get(\n        \"xcode_ninja_executable_target_pattern\", None\n    )\n\n    # For including other non-executable targets, add the matching target name\n    # to the |xcode_ninja_target_pattern| regular expression. (Default none)\n    target_extras = generator_flags.get(\"xcode_ninja_target_pattern\", None)\n\n    for old_qualified_target in target_list:\n        spec = target_dicts[old_qualified_target]\n        if IsValidTargetForWrapper(target_extras, executable_target_pattern, spec):\n            # Add to new_target_list.\n            target_name = spec.get(\"target_name\")\n            new_target_name = f\"{main_gyp}:{target_name}#target\"\n            new_target_list.append(new_target_name)\n\n            # Add to new_target_dicts.\n            new_target_dicts[new_target_name] = _TargetFromSpec(spec, params)\n\n            # Add to new_data.\n            for old_target in data[old_qualified_target.split(\":\")[0]][\"targets\"]:\n                if old_target[\"target_name\"] == target_name:\n                    new_data_target = {}\n                    new_data_target[\"target_name\"] = old_target[\"target_name\"]\n                    new_data_target[\"toolset\"] = old_target[\"toolset\"]\n                    new_data[main_gyp][\"targets\"].append(new_data_target)\n\n    # Create sources target.\n    sources_target_name = \"sources_for_indexing\"\n    sources_target = _TargetFromSpec(\n        {\n            \"target_name\": sources_target_name,\n            \"toolset\": \"target\",\n            \"default_configuration\": \"Default\",\n            \"mac_bundle\": \"0\",\n            \"type\": \"executable\",\n        },\n        None,\n    )\n\n    # Tell Xcode to look everywhere for headers.\n    sources_target[\"configurations\"] = {\"Default\": {\"include_dirs\": [depth]}}\n\n    # Put excluded files into the sources target so they can be opened in Xcode.\n    skip_excluded_files = not generator_flags.get(\n        \"xcode_ninja_list_excluded_files\", True\n    )\n\n    sources = []\n    for target, target_dict in target_dicts.items():\n        base = os.path.dirname(target)\n        files = target_dict.get(\"sources\", []) + target_dict.get(\n            \"mac_bundle_resources\", []\n        )\n\n        if not skip_excluded_files:\n            files.extend(\n                target_dict.get(\"sources_excluded\", [])\n                + target_dict.get(\"mac_bundle_resources_excluded\", [])\n            )\n\n        for action in target_dict.get(\"actions\", []):\n            files.extend(action.get(\"inputs\", []))\n\n            if not skip_excluded_files:\n                files.extend(action.get(\"inputs_excluded\", []))\n\n        # Remove files starting with $. These are mostly intermediate files for the\n        # build system.\n        files = [file for file in files if not file.startswith(\"$\")]\n\n        # Make sources relative to root build file.\n        relative_path = os.path.dirname(main_gyp)\n        sources += [\n            os.path.relpath(os.path.join(base, file), relative_path) for file in files\n        ]\n\n    sources_target[\"sources\"] = sorted(set(sources))\n\n    # Put sources_to_index in it's own gyp.\n    sources_gyp = os.path.join(os.path.dirname(main_gyp), sources_target_name + \".gyp\")\n    fully_qualified_target_name = f\"{sources_gyp}:{sources_target_name}#target\"\n\n    # Add to new_target_list, new_target_dicts and new_data.\n    new_target_list.append(fully_qualified_target_name)\n    new_target_dicts[fully_qualified_target_name] = sources_target\n    new_data_target = {}\n    new_data_target[\"target_name\"] = sources_target[\"target_name\"]\n    new_data_target[\"_DEPTH\"] = depth\n    new_data_target[\"toolset\"] = \"target\"\n    new_data[sources_gyp] = {}\n    new_data[sources_gyp][\"targets\"] = []\n    new_data[sources_gyp][\"included_files\"] = []\n    new_data[sources_gyp][\"xcode_settings\"] = data[orig_gyp].get(\"xcode_settings\", {})\n    new_data[sources_gyp][\"targets\"].append(new_data_target)\n\n    # Write workspace to file.\n    _WriteWorkspace(main_gyp, sources_gyp, params)\n    return (new_target_list, new_target_dicts, new_data)\n"
  },
  {
    "path": "gyp/pylib/gyp/xcodeproj_file.py",
    "content": "# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Xcode project file generator.\n\nThis module is both an Xcode project file generator and a documentation of the\nXcode project file format.  Knowledge of the project file format was gained\nbased on extensive experience with Xcode, and by making changes to projects in\nXcode.app and observing the resultant changes in the associated project files.\n\nXCODE PROJECT FILES\n\nThe generator targets the file format as written by Xcode 3.2 (specifically,\n3.2.6), but past experience has taught that the format has not changed\nsignificantly in the past several years, and future versions of Xcode are able\nto read older project files.\n\nXcode project files are \"bundled\": the project \"file\" from an end-user's\nperspective is actually a directory with an \".xcodeproj\" extension.  The\nproject file from this module's perspective is actually a file inside this\ndirectory, always named \"project.pbxproj\".  This file contains a complete\ndescription of the project and is all that is needed to use the xcodeproj.\nOther files contained in the xcodeproj directory are simply used to store\nper-user settings, such as the state of various UI elements in the Xcode\napplication.\n\nThe project.pbxproj file is a property list, stored in a format almost\nidentical to the NeXTstep property list format.  The file is able to carry\nUnicode data, and is encoded in UTF-8.  The root element in the property list\nis a dictionary that contains several properties of minimal interest, and two\nproperties of immense interest.  The most important property is a dictionary\nnamed \"objects\".  The entire structure of the project is represented by the\nchildren of this property.  The objects dictionary is keyed by unique 96-bit\nvalues represented by 24 uppercase hexadecimal characters.  Each value in the\nobjects dictionary is itself a dictionary, describing an individual object.\n\nEach object in the dictionary is a member of a class, which is identified by\nthe \"isa\" property of each object.  A variety of classes are represented in a\nproject file.  Objects can refer to other objects by ID, using the 24-character\nhexadecimal object key.  A project's objects form a tree, with a root object\nof class PBXProject at the root.  As an example, the PBXProject object serves\nas parent to an XCConfigurationList object defining the build configurations\nused in the project, a PBXGroup object serving as a container for all files\nreferenced in the project, and a list of target objects, each of which defines\na target in the project.  There are several different types of target object,\nsuch as PBXNativeTarget and PBXAggregateTarget.  In this module, this\nrelationship is expressed by having each target type derive from an abstract\nbase named XCTarget.\n\nThe project.pbxproj file's root dictionary also contains a property, sibling to\nthe \"objects\" dictionary, named \"rootObject\".  The value of rootObject is a\n24-character object key referring to the root PBXProject object in the\nobjects dictionary.\n\nIn Xcode, every file used as input to a target or produced as a final product\nof a target must appear somewhere in the hierarchy rooted at the PBXGroup\nobject referenced by the PBXProject's mainGroup property.  A PBXGroup is\ngenerally represented as a folder in the Xcode application.  PBXGroups can\ncontain other PBXGroups as well as PBXFileReferences, which are pointers to\nactual files.\n\nEach XCTarget contains a list of build phases, represented in this module by\nthe abstract base XCBuildPhase.  Examples of concrete XCBuildPhase derivations\nare PBXSourcesBuildPhase and PBXFrameworksBuildPhase, which correspond to the\n\"Compile Sources\" and \"Link Binary With Libraries\" phases displayed in the\nXcode application.  Files used as input to these phases (for example, source\nfiles in the former case and libraries and frameworks in the latter) are\nrepresented by PBXBuildFile objects, referenced by elements of \"files\" lists\nin XCTarget objects.  Each PBXBuildFile object refers to a PBXBuildFile\nobject as a \"weak\" reference: it does not \"own\" the PBXBuildFile, which is\nowned by the root object's mainGroup or a descendant group.  In most cases, the\nlayer of indirection between an XCBuildPhase and a PBXFileReference via a\nPBXBuildFile appears extraneous, but there's actually one reason for this:\nfile-specific compiler flags are added to the PBXBuildFile object so as to\nallow a single file to be a member of multiple targets while having distinct\ncompiler flags for each.  These flags can be modified in the Xcode application\nin the \"Build\" tab of a File Info window.\n\nWhen a project is open in the Xcode application, Xcode will rewrite it.  As\nsuch, this module is careful to adhere to the formatting used by Xcode, to\navoid insignificant changes appearing in the file when it is used in the\nXcode application.  This will keep version control repositories happy, and\nmakes it possible to compare a project file used in Xcode to one generated by\nthis module to determine if any significant changes were made in the\napplication.\n\nXcode has its own way of assigning 24-character identifiers to each object,\nwhich is not duplicated here.  Because the identifier only is only generated\nonce, when an object is created, and is then left unchanged, there is no need\nto attempt to duplicate Xcode's behavior in this area.  The generator is free\nto select any identifier, even at random, to refer to the objects it creates,\nand Xcode will retain those identifiers and use them when subsequently\nrewriting the project file.  However, the generator would choose new random\nidentifiers each time the project files are generated, leading to difficulties\ncomparing \"used\" project files to \"pristine\" ones produced by this module,\nand causing the appearance of changes as every object identifier is changed\nwhen updated projects are checked in to a version control repository.  To\nmitigate this problem, this module chooses identifiers in a more deterministic\nway, by hashing a description of each object as well as its parent and ancestor\nobjects.  This strategy should result in minimal \"shift\" in IDs as successive\ngenerations of project files are produced.\n\nTHIS MODULE\n\nThis module introduces several classes, all derived from the XCObject class.\nNearly all of the \"brains\" are built into the XCObject class, which understands\nhow to create and modify objects, maintain the proper tree structure, compute\nidentifiers, and print objects.  For the most part, classes derived from\nXCObject need only provide a _schema class object, a dictionary that\nexpresses what properties objects of the class may contain.\n\nGiven this structure, it's possible to build a minimal project file by creating\nobjects of the appropriate types and making the proper connections:\n\n  config_list = XCConfigurationList()\n  group = PBXGroup()\n  project = PBXProject({'buildConfigurationList': config_list,\n                        'mainGroup': group})\n\nWith the project object set up, it can be added to an XCProjectFile object.\nXCProjectFile is a pseudo-class in the sense that it is a concrete XCObject\nsubclass that does not actually correspond to a class type found in a project\nfile.  Rather, it is used to represent the project file's root dictionary.\nPrinting an XCProjectFile will print the entire project file, including the\nfull \"objects\" dictionary.\n\n  project_file = XCProjectFile({'rootObject': project})\n  project_file.ComputeIDs()\n  project_file.Print()\n\nXcode project files are always encoded in UTF-8.  This module will accept\nstrings of either the str class or the unicode class.  Strings of class str\nare assumed to already be encoded in UTF-8.  Obviously, if you're just using\nASCII, you won't encounter difficulties because ASCII is a UTF-8 subset.\nStrings of class unicode are handled properly and encoded in UTF-8 when\na project file is output.\n\"\"\"\n\nimport hashlib\nimport posixpath\nimport re\nimport struct\nimport sys\nfrom functools import cmp_to_key\nfrom operator import attrgetter\n\nimport gyp.common\n\n\ndef cmp(x, y):\n    return (x > y) - (x < y)\n\n\n# See XCObject._EncodeString.  This pattern is used to determine when a string\n# can be printed unquoted.  Strings that match this pattern may be printed\n# unquoted.  Strings that do not match must be quoted and may be further\n# transformed to be properly encoded.  Note that this expression matches the\n# characters listed with \"+\", for 1 or more occurrences: if a string is empty,\n# it must not match this pattern, because it needs to be encoded as \"\".\n_unquoted = re.compile(\"^[A-Za-z0-9$./_]+$\")\n\n# Strings that match this pattern are quoted regardless of what _unquoted says.\n# Oddly, Xcode will quote any string with a run of three or more underscores.\n_quoted = re.compile(\"___\")\n\n# This pattern should match any character that needs to be escaped by\n# XCObject._EncodeString.  See that function.\n_escaped = re.compile('[\\\\\\\\\"]|[\\x00-\\x1f]')\n\n\n# Used by SourceTreeAndPathFromPath\n_path_leading_variable = re.compile(r\"^\\$\\((.*?)\\)(/(.*))?$\")\n\n\ndef SourceTreeAndPathFromPath(input_path):\n    \"\"\"Given input_path, returns a tuple with sourceTree and path values.\n\n    Examples:\n      input_path     (source_tree, output_path)\n      '$(VAR)/path'  ('VAR', 'path')\n      '$(VAR)'       ('VAR', None)\n      'path'         (None, 'path')\n    \"\"\"\n\n    if source_group_match := _path_leading_variable.match(input_path):\n        source_tree = source_group_match.group(1)\n        output_path = source_group_match.group(3)  # This may be None.\n    else:\n        source_tree = None\n        output_path = input_path\n\n    return (source_tree, output_path)\n\n\ndef ConvertVariablesToShellSyntax(input_string):\n    return re.sub(r\"\\$\\((.*?)\\)\", \"${\\\\1}\", input_string)\n\n\nclass XCObject:\n    \"\"\"The abstract base of all class types used in Xcode project files.\n\n    Class variables:\n      _schema: A dictionary defining the properties of this class.  The keys to\n               _schema are string property keys as used in project files.  Values\n               are a list of four or five elements:\n               [ is_list, property_type, is_strong, is_required, default ]\n               is_list: True if the property described is a list, as opposed\n                        to a single element.\n               property_type: The type to use as the value of the property,\n                              or if is_list is True, the type to use for each\n                              element of the value's list.  property_type must\n                              be an XCObject subclass, or one of the built-in\n                              types str, int, or dict.\n               is_strong: If property_type is an XCObject subclass, is_strong\n                          is True to assert that this class \"owns,\" or serves\n                          as parent, to the property value (or, if is_list is\n                          True, values).  is_strong must be False if\n                          property_type is not an XCObject subclass.\n               is_required: True if the property is required for the class.\n                            Note that is_required being True does not preclude\n                            an empty string (\"\", in the case of property_type\n                            str) or list ([], in the case of is_list True) from\n                            being set for the property.\n               default: Optional.  If is_required is True, default may be set\n                        to provide a default value for objects that do not supply\n                        their own value.  If is_required is True and default\n                        is not provided, users of the class must supply their own\n                        value for the property.\n               Note that although the values of the array are expressed in\n               boolean terms, subclasses provide values as integers to conserve\n               horizontal space.\n      _should_print_single_line: False in XCObject.  Subclasses whose objects\n                                 should be written to the project file in the\n                                 alternate single-line format, such as\n                                 PBXFileReference and PBXBuildFile, should\n                                 set this to True.\n      _encode_transforms: Used by _EncodeString to encode unprintable characters.\n                          The index into this list is the ordinal of the\n                          character to transform; each value is a string\n                          used to represent the character in the output.  XCObject\n                          provides an _encode_transforms list suitable for most\n                          XCObject subclasses.\n      _alternate_encode_transforms: Provided for subclasses that wish to use\n                                    the alternate encoding rules.  Xcode seems\n                                    to use these rules when printing objects in\n                                    single-line format.  Subclasses that desire\n                                    this behavior should set _encode_transforms\n                                    to _alternate_encode_transforms.\n      _hashables: A list of XCObject subclasses that can be hashed by ComputeIDs\n                  to construct this object's ID.  Most classes that need custom\n                  hashing behavior should do it by overriding Hashables,\n                  but in some cases an object's parent may wish to push a\n                  hashable value into its child, and it can do so by appending\n                  to _hashables.\n    Attributes:\n      id: The object's identifier, a 24-character uppercase hexadecimal string.\n          Usually, objects being created should not set id until the entire\n          project file structure is built.  At that point, UpdateIDs() should\n          be called on the root object to assign deterministic values for id to\n          each object in the tree.\n      parent: The object's parent.  This is set by a parent XCObject when a child\n              object is added to it.\n      _properties: The object's property dictionary.  An object's properties are\n                   described by its class' _schema variable.\n    \"\"\"\n\n    _schema = {}\n    _should_print_single_line = False\n\n    # See _EncodeString.\n    _encode_transforms = []\n    i = 0\n    while i < ord(\" \"):\n        _encode_transforms.append(\"\\\\U%04x\" % i)\n        i = i + 1\n    _encode_transforms[7] = \"\\\\a\"\n    _encode_transforms[8] = \"\\\\b\"\n    _encode_transforms[9] = \"\\\\t\"\n    _encode_transforms[10] = \"\\\\n\"\n    _encode_transforms[11] = \"\\\\v\"\n    _encode_transforms[12] = \"\\\\f\"\n    _encode_transforms[13] = \"\\\\n\"\n\n    _alternate_encode_transforms = list(_encode_transforms)\n    _alternate_encode_transforms[9] = chr(9)\n    _alternate_encode_transforms[10] = chr(10)\n    _alternate_encode_transforms[11] = chr(11)\n\n    def __init__(self, properties=None, id=None, parent=None):\n        self.id = id\n        self.parent = parent\n        self._properties = {}\n        self._hashables = []\n        self._SetDefaultsFromSchema()\n        self.UpdateProperties(properties)\n\n    def __repr__(self):\n        try:\n            name = self.Name()\n        except NotImplementedError:\n            return f\"<{self.__class__.__name__} at 0x{id(self):x}>\"\n        return f\"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>\"\n\n    def Copy(self):\n        \"\"\"Make a copy of this object.\n\n        The new object will have its own copy of lists and dicts.  Any XCObject\n        objects owned by this object (marked \"strong\") will be copied in the\n        new object, even those found in lists.  If this object has any weak\n        references to other XCObjects, the same references are added to the new\n        object without making a copy.\n        \"\"\"\n\n        that = self.__class__(id=self.id, parent=self.parent)\n        for key, value in self._properties.items():\n            is_strong = self._schema[key][2]\n\n            if isinstance(value, XCObject):\n                if is_strong:\n                    new_value = value.Copy()\n                    new_value.parent = that\n                    that._properties[key] = new_value\n                else:\n                    that._properties[key] = value\n            elif isinstance(value, (str, int)):\n                that._properties[key] = value\n            elif isinstance(value, list):\n                if is_strong:\n                    # If is_strong is True, each element is an XCObject, so it's safe to\n                    # call Copy.\n                    that._properties[key] = []\n                    for item in value:\n                        new_item = item.Copy()\n                        new_item.parent = that\n                        that._properties[key].append(new_item)\n                else:\n                    that._properties[key] = value[:]\n            elif isinstance(value, dict):\n                # dicts are never strong.\n                if is_strong:\n                    raise TypeError(\n                        \"Strong dict for key \" + key + \" in \" + self.__class__.__name__\n                    )\n                else:\n                    that._properties[key] = value.copy()\n            else:\n                raise TypeError(\n                    \"Unexpected type \"\n                    + value.__class__.__name__\n                    + \" for key \"\n                    + key\n                    + \" in \"\n                    + self.__class__.__name__\n                )\n\n        return that\n\n    def Name(self):\n        \"\"\"Return the name corresponding to an object.\n\n        Not all objects necessarily need to be nameable, and not all that do have\n        a \"name\" property.  Override as needed.\n        \"\"\"\n\n        # If the schema indicates that \"name\" is required, try to access the\n        # property even if it doesn't exist.  This will result in a KeyError\n        # being raised for the property that should be present, which seems more\n        # appropriate than NotImplementedError in this case.\n        if \"name\" in self._properties or (\n            \"name\" in self._schema and self._schema[\"name\"][3]\n        ):\n            return self._properties[\"name\"]\n\n        raise NotImplementedError(self.__class__.__name__ + \" must implement Name\")\n\n    def Comment(self):\n        \"\"\"Return a comment string for the object.\n\n        Most objects just use their name as the comment, but PBXProject uses\n        different values.\n\n        The returned comment is not escaped and does not have any comment marker\n        strings applied to it.\n        \"\"\"\n\n        return self.Name()\n\n    def Hashables(self):\n        hashables = [self.__class__.__name__]\n\n        if (name := self.Name()) is not None:\n            hashables.append(name)\n\n        hashables.extend(self._hashables)\n\n        return hashables\n\n    def HashablesForChild(self):\n        return None\n\n    def ComputeIDs(self, recursive=True, overwrite=True, seed_hash=None):\n        \"\"\"Set \"id\" properties deterministically.\n\n        An object's \"id\" property is set based on a hash of its class type and\n        name, as well as the class type and name of all ancestor objects.  As\n        such, it is only advisable to call ComputeIDs once an entire project file\n        tree is built.\n\n        If recursive is True, recurse into all descendant objects and update their\n        hashes.\n\n        If overwrite is True, any existing value set in the \"id\" property will be\n        replaced.\n        \"\"\"\n\n        def _HashUpdate(hash, data):\n            \"\"\"Update hash with data's length and contents.\n\n            If the hash were updated only with the value of data, it would be\n            possible for clowns to induce collisions by manipulating the names of\n            their objects.  By adding the length, it's exceedingly less likely that\n            ID collisions will be encountered, intentionally or not.\n            \"\"\"\n\n            hash.update(struct.pack(\">i\", len(data)))\n            if isinstance(data, str):\n                data = data.encode(\"utf-8\")\n            hash.update(data)\n\n        if seed_hash is None:\n            seed_hash = hashlib.sha256()\n\n        hash = seed_hash.copy()\n\n        hashables = self.Hashables()\n        assert len(hashables) > 0\n        for hashable in hashables:\n            _HashUpdate(hash, hashable)\n\n        if recursive:\n            hashables_for_child = self.HashablesForChild()\n            if hashables_for_child is None:\n                child_hash = hash\n            else:\n                assert len(hashables_for_child) > 0\n                child_hash = seed_hash.copy()\n                for hashable in hashables_for_child:\n                    _HashUpdate(child_hash, hashable)\n\n            for child in self.Children():\n                child.ComputeIDs(recursive, overwrite, child_hash)\n\n        if overwrite or self.id is None:\n            # Xcode IDs are only 96 bits (24 hex characters), but a SHA-1 digest is\n            # is 160 bits.  Instead of throwing out 64 bits of the digest, xor them\n            # into the portion that gets used.\n            assert hash.digest_size % 4 == 0\n            digest_int_count = hash.digest_size // 4\n            digest_ints = struct.unpack(\">\" + \"I\" * digest_int_count, hash.digest())\n            id_ints = [0, 0, 0]\n            for index in range(digest_int_count):\n                id_ints[index % 3] ^= digest_ints[index]\n            self.id = \"%08X%08X%08X\" % tuple(id_ints)\n\n    def EnsureNoIDCollisions(self):\n        \"\"\"Verifies that no two objects have the same ID.  Checks all descendants.\"\"\"\n\n        ids = {}\n        descendants = self.Descendants()\n        for descendant in descendants:\n            if descendant.id in ids:\n                other = ids[descendant.id]\n                raise KeyError(\n                    'Duplicate ID %s, objects \"%s\" and \"%s\" in \"%s\"'\n                    % (\n                        descendant.id,\n                        str(descendant._properties),\n                        str(other._properties),\n                        self._properties[\"rootObject\"].Name(),\n                    )\n                )\n            ids[descendant.id] = descendant\n\n    def Children(self):\n        \"\"\"Returns a list of all of this object's owned (strong) children.\"\"\"\n\n        children = []\n        for property, attributes in self._schema.items():\n            (is_list, _property_type, is_strong) = attributes[0:3]\n            if is_strong and property in self._properties:\n                if not is_list:\n                    children.append(self._properties[property])\n                else:\n                    children.extend(self._properties[property])\n        return children\n\n    def Descendants(self):\n        \"\"\"Returns a list of all of this object's descendants, including this\n        object.\n        \"\"\"\n\n        children = self.Children()\n        descendants = [self]\n        for child in children:\n            descendants.extend(child.Descendants())\n        return descendants\n\n    def PBXProjectAncestor(self):\n        # The base case for recursion is defined at PBXProject.PBXProjectAncestor.\n        if self.parent:\n            return self.parent.PBXProjectAncestor()\n        return None\n\n    def _EncodeComment(self, comment):\n        \"\"\"Encodes a comment to be placed in the project file output, mimicking\n        Xcode behavior.\n        \"\"\"\n\n        # This mimics Xcode behavior by wrapping the comment in \"/*\" and \"*/\".  If\n        # the string already contains a \"*/\", it is turned into \"(*)/\".  This keeps\n        # the file writer from outputting something that would be treated as the\n        # end of a comment in the middle of something intended to be entirely a\n        # comment.\n\n        return \"/* \" + comment.replace(\"*/\", \"(*)/\") + \" */\"\n\n    def _EncodeTransform(self, match):\n        # This function works closely with _EncodeString.  It will only be called\n        # by re.sub with match.group(0) containing a character matched by the\n        # the _escaped expression.\n        char = match.group(0)\n\n        # Backslashes (\\) and quotation marks (\") are always replaced with a\n        # backslash-escaped version of the same.  Everything else gets its\n        # replacement from the class' _encode_transforms array.\n        if char == \"\\\\\":\n            return \"\\\\\\\\\"\n        if char == '\"':\n            return '\\\\\"'\n        return self._encode_transforms[ord(char)]\n\n    def _EncodeString(self, value):\n        \"\"\"Encodes a string to be placed in the project file output, mimicking\n        Xcode behavior.\n        \"\"\"\n\n        # Use quotation marks when any character outside of the range A-Z, a-z, 0-9,\n        # $ (dollar sign), . (period), and _ (underscore) is present.  Also use\n        # quotation marks to represent empty strings.\n        #\n        # Escape \" (double-quote) and \\ (backslash) by preceding them with a\n        # backslash.\n        #\n        # Some characters below the printable ASCII range are encoded specially:\n        #     7 ^G BEL is encoded as \"\\a\"\n        #     8 ^H BS  is encoded as \"\\b\"\n        #    11 ^K VT  is encoded as \"\\v\"\n        #    12 ^L NP  is encoded as \"\\f\"\n        #   127 ^? DEL is passed through as-is without escaping\n        #  - In PBXFileReference and PBXBuildFile objects:\n        #     9 ^I HT  is passed through as-is without escaping\n        #    10 ^J NL  is passed through as-is without escaping\n        #    13 ^M CR  is passed through as-is without escaping\n        #  - In other objects:\n        #     9 ^I HT  is encoded as \"\\t\"\n        #    10 ^J NL  is encoded as \"\\n\"\n        #    13 ^M CR  is encoded as \"\\n\" rendering it indistinguishable from\n        #              10 ^J NL\n        # All other characters within the ASCII control character range (0 through\n        # 31 inclusive) are encoded as \"\\U001f\" referring to the Unicode code point\n        # in hexadecimal.  For example, character 14 (^N SO) is encoded as \"\\U000e\".\n        # Characters above the ASCII range are passed through to the output encoded\n        # as UTF-8 without any escaping.  These mappings are contained in the\n        # class' _encode_transforms list.\n\n        if _unquoted.search(value) and not _quoted.search(value):\n            return value\n\n        return '\"' + _escaped.sub(self._EncodeTransform, value) + '\"'\n\n    def _XCPrint(self, file, tabs, line):\n        file.write(\"\\t\" * tabs + line)\n\n    def _XCPrintableValue(self, tabs, value, flatten_list=False):\n        \"\"\"Returns a representation of value that may be printed in a project file,\n        mimicking Xcode's behavior.\n\n        _XCPrintableValue can handle str and int values, XCObjects (which are\n        made printable by returning their id property), and list and dict objects\n        composed of any of the above types.  When printing a list or dict, and\n        _should_print_single_line is False, the tabs parameter is used to determine\n        how much to indent the lines corresponding to the items in the list or\n        dict.\n\n        If flatten_list is True, single-element lists will be transformed into\n        strings.\n        \"\"\"\n\n        printable = \"\"\n        comment = None\n\n        if self._should_print_single_line:\n            sep = \" \"\n            element_tabs = \"\"\n            end_tabs = \"\"\n        else:\n            sep = \"\\n\"\n            element_tabs = \"\\t\" * (tabs + 1)\n            end_tabs = \"\\t\" * tabs\n\n        if isinstance(value, XCObject):\n            printable += value.id\n            comment = value.Comment()\n        elif isinstance(value, str):\n            printable += self._EncodeString(value)\n        elif isinstance(value, str):\n            printable += self._EncodeString(value.encode(\"utf-8\"))\n        elif isinstance(value, int):\n            printable += str(value)\n        elif isinstance(value, list):\n            if flatten_list and len(value) <= 1:\n                if len(value) == 0:\n                    printable += self._EncodeString(\"\")\n                else:\n                    printable += self._EncodeString(value[0])\n            else:\n                printable = \"(\" + sep\n                for item in value:\n                    printable += (\n                        element_tabs\n                        + self._XCPrintableValue(tabs + 1, item, flatten_list)\n                        + \",\"\n                        + sep\n                    )\n                printable += end_tabs + \")\"\n        elif isinstance(value, dict):\n            printable = \"{\" + sep\n            for item_key, item_value in sorted(value.items()):\n                printable += (\n                    element_tabs\n                    + self._XCPrintableValue(tabs + 1, item_key, flatten_list)\n                    + \" = \"\n                    + self._XCPrintableValue(tabs + 1, item_value, flatten_list)\n                    + \";\"\n                    + sep\n                )\n            printable += end_tabs + \"}\"\n        else:\n            raise TypeError(\"Can't make \" + value.__class__.__name__ + \" printable\")\n\n        if comment:\n            printable += \" \" + self._EncodeComment(comment)\n\n        return printable\n\n    def _XCKVPrint(self, file, tabs, key, value):\n        \"\"\"Prints a key and value, members of an XCObject's _properties dictionary,\n        to file.\n\n        tabs is an int identifying the indentation level.  If the class'\n        _should_print_single_line variable is True, tabs is ignored and the\n        key-value pair will be followed by a space instead of a newline.\n        \"\"\"\n\n        if self._should_print_single_line:\n            printable = \"\"\n            after_kv = \" \"\n        else:\n            printable = \"\\t\" * tabs\n            after_kv = \"\\n\"\n\n        # Xcode usually prints remoteGlobalIDString values in PBXContainerItemProxy\n        # objects without comments.  Sometimes it prints them with comments, but\n        # the majority of the time, it doesn't.  To avoid unnecessary changes to\n        # the project file after Xcode opens it, don't write comments for\n        # remoteGlobalIDString.  This is a sucky hack and it would certainly be\n        # cleaner to extend the schema to indicate whether or not a comment should\n        # be printed, but since this is the only case where the problem occurs and\n        # Xcode itself can't seem to make up its mind, the hack will suffice.\n        #\n        # Also see PBXContainerItemProxy._schema['remoteGlobalIDString'].\n        if key == \"remoteGlobalIDString\" and isinstance(self, PBXContainerItemProxy):\n            value_to_print = value.id\n        else:\n            value_to_print = value\n\n        # PBXBuildFile's settings property is represented in the output as a dict,\n        # but a hack here has it represented as a string. Arrange to strip off the\n        # quotes so that it shows up in the output as expected.\n        if key == \"settings\" and isinstance(self, PBXBuildFile):\n            strip_value_quotes = True\n        else:\n            strip_value_quotes = False\n\n        # In another one-off, let's set flatten_list on buildSettings properties\n        # of XCBuildConfiguration objects, because that's how Xcode treats them.\n        if key == \"buildSettings\" and isinstance(self, XCBuildConfiguration):\n            flatten_list = True\n        else:\n            flatten_list = False\n\n        try:\n            printable_key = self._XCPrintableValue(tabs, key, flatten_list)\n            printable_value = self._XCPrintableValue(tabs, value_to_print, flatten_list)\n            if (\n                strip_value_quotes\n                and len(printable_value) > 1\n                and printable_value[0] == '\"'\n                and printable_value[-1] == '\"'\n            ):\n                printable_value = printable_value[1:-1]\n            printable += printable_key + \" = \" + printable_value + \";\" + after_kv\n        except TypeError as e:\n            gyp.common.ExceptionAppend(e, 'while printing key \"%s\"' % key)\n            raise\n\n        self._XCPrint(file, 0, printable)\n\n    def Print(self, file=sys.stdout):\n        \"\"\"Prints a reprentation of this object to file, adhering to Xcode output\n        formatting.\n        \"\"\"\n\n        self.VerifyHasRequiredProperties()\n\n        if self._should_print_single_line:\n            # When printing an object in a single line, Xcode doesn't put any space\n            # between the beginning of a dictionary (or presumably a list) and the\n            # first contained item, so you wind up with snippets like\n            #   ...CDEF = {isa = PBXFileReference; fileRef = 0123...\n            # If it were me, I would have put a space in there after the opening\n            # curly, but I guess this is just another one of those inconsistencies\n            # between how Xcode prints PBXFileReference and PBXBuildFile objects as\n            # compared to other objects.  Mimic Xcode's behavior here by using an\n            # empty string for sep.\n            sep = \"\"\n            end_tabs = 0\n        else:\n            sep = \"\\n\"\n            end_tabs = 2\n\n        # Start the object.  For example, '\\t\\tPBXProject = {\\n'.\n        self._XCPrint(file, 2, self._XCPrintableValue(2, self) + \" = {\" + sep)\n\n        # \"isa\" isn't in the _properties dictionary, it's an intrinsic property\n        # of the class which the object belongs to.  Xcode always outputs \"isa\"\n        # as the first element of an object dictionary.\n        self._XCKVPrint(file, 3, \"isa\", self.__class__.__name__)\n\n        # The remaining elements of an object dictionary are sorted alphabetically.\n        for property, value in sorted(self._properties.items()):\n            self._XCKVPrint(file, 3, property, value)\n\n        # End the object.\n        self._XCPrint(file, end_tabs, \"};\\n\")\n\n    def UpdateProperties(self, properties, do_copy=False):\n        \"\"\"Merge the supplied properties into the _properties dictionary.\n\n        The input properties must adhere to the class schema or a KeyError or\n        TypeError exception will be raised.  If adding an object of an XCObject\n        subclass and the schema indicates a strong relationship, the object's\n        parent will be set to this object.\n\n        If do_copy is True, then lists, dicts, strong-owned XCObjects, and\n        strong-owned XCObjects in lists will be copied instead of having their\n        references added.\n        \"\"\"\n\n        if properties is None:\n            return\n\n        for property, value in properties.items():\n            # Make sure the property is in the schema.\n            if property not in self._schema:\n                raise KeyError(property + \" not in \" + self.__class__.__name__)\n\n            # Make sure the property conforms to the schema.\n            (is_list, property_type, is_strong) = self._schema[property][0:3]\n            if is_list:\n                if not isinstance(value, list):\n                    raise TypeError(\n                        property\n                        + \" of \"\n                        + self.__class__.__name__\n                        + \" must be list, not \"\n                        + value.__class__.__name__\n                    )\n                for item in value:\n                    if not isinstance(item, property_type) and not (\n                        isinstance(item, str) and isinstance(property_type, str)\n                    ):\n                        # Accept unicode where str is specified.  str is treated as\n                        # UTF-8-encoded.\n                        raise TypeError(\n                            \"item of \"\n                            + property\n                            + \" of \"\n                            + self.__class__.__name__\n                            + \" must be \"\n                            + property_type.__name__\n                            + \", not \"\n                            + item.__class__.__name__\n                        )\n            elif not isinstance(value, property_type) and not (\n                isinstance(value, str) and isinstance(property_type, str)\n            ):\n                # Accept unicode where str is specified.  str is treated as\n                # UTF-8-encoded.\n                raise TypeError(\n                    property\n                    + \" of \"\n                    + self.__class__.__name__\n                    + \" must be \"\n                    + property_type.__name__\n                    + \", not \"\n                    + value.__class__.__name__\n                )\n\n            # Checks passed, perform the assignment.\n            if do_copy:\n                if isinstance(value, XCObject):\n                    if is_strong:\n                        self._properties[property] = value.Copy()\n                    else:\n                        self._properties[property] = value\n                elif isinstance(value, (str, int)):\n                    self._properties[property] = value\n                elif isinstance(value, list):\n                    if is_strong:\n                        # If is_strong is True, each element is an XCObject,\n                        # so it's safe to call Copy.\n                        self._properties[property] = []\n                        for item in value:\n                            self._properties[property].append(item.Copy())\n                    else:\n                        self._properties[property] = value[:]\n                elif isinstance(value, dict):\n                    self._properties[property] = value.copy()\n                else:\n                    raise TypeError(\n                        \"Don't know how to copy a \"\n                        + value.__class__.__name__\n                        + \" object for \"\n                        + property\n                        + \" in \"\n                        + self.__class__.__name__\n                    )\n            else:\n                self._properties[property] = value\n\n            # Set up the child's back-reference to this object.  Don't use |value|\n            # any more because it may not be right if do_copy is true.\n            if is_strong:\n                if not is_list:\n                    self._properties[property].parent = self\n                else:\n                    for item in self._properties[property]:\n                        item.parent = self\n\n    def HasProperty(self, key):\n        return key in self._properties\n\n    def GetProperty(self, key):\n        return self._properties[key]\n\n    def SetProperty(self, key, value):\n        self.UpdateProperties({key: value})\n\n    def DelProperty(self, key):\n        if key in self._properties:\n            del self._properties[key]\n\n    def AppendProperty(self, key, value):\n        # TODO(mark): Support ExtendProperty too (and make this call that)?\n\n        # Schema validation.\n        if key not in self._schema:\n            raise KeyError(key + \" not in \" + self.__class__.__name__)\n\n        (is_list, property_type, is_strong) = self._schema[key][0:3]\n        if not is_list:\n            raise TypeError(key + \" of \" + self.__class__.__name__ + \" must be list\")\n        if not isinstance(value, property_type):\n            raise TypeError(\n                \"item of \"\n                + key\n                + \" of \"\n                + self.__class__.__name__\n                + \" must be \"\n                + property_type.__name__\n                + \", not \"\n                + value.__class__.__name__\n            )\n\n        # If the property doesn't exist yet, create a new empty list to receive the\n        # item.\n        self._properties[key] = self._properties.get(key, [])\n\n        # Set up the ownership link.\n        if is_strong:\n            value.parent = self\n\n        # Store the item.\n        self._properties[key].append(value)\n\n    def VerifyHasRequiredProperties(self):\n        \"\"\"Ensure that all properties identified as required by the schema are\n        set.\n        \"\"\"\n\n        # TODO(mark): A stronger verification mechanism is needed.  Some\n        # subclasses need to perform validation beyond what the schema can enforce.\n        for property, attributes in self._schema.items():\n            (_is_list, _property_type, _is_strong, is_required) = attributes[0:4]\n            if is_required and property not in self._properties:\n                raise KeyError(self.__class__.__name__ + \" requires \" + property)\n\n    def _SetDefaultsFromSchema(self):\n        \"\"\"Assign object default values according to the schema.  This will not\n        overwrite properties that have already been set.\"\"\"\n\n        defaults = {}\n        for property, attributes in self._schema.items():\n            (_is_list, _property_type, _is_strong, is_required) = attributes[0:4]\n            if (\n                is_required\n                and len(attributes) >= 5\n                and property not in self._properties\n            ):\n                default = attributes[4]\n\n                defaults[property] = default\n\n        if len(defaults) > 0:\n            # Use do_copy=True so that each new object gets its own copy of strong\n            # objects, lists, and dicts.\n            self.UpdateProperties(defaults, do_copy=True)\n\n\nclass XCHierarchicalElement(XCObject):\n    \"\"\"Abstract base for PBXGroup and PBXFileReference.  Not represented in a\n    project file.\"\"\"\n\n    # TODO(mark): Do name and path belong here?  Probably so.\n    # If path is set and name is not, name may have a default value.  Name will\n    # be set to the basename of path, if the basename of path is different from\n    # the full value of path.  If path is already just a leaf name, name will\n    # not be set.\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"comments\": [0, str, 0, 0],\n            \"fileEncoding\": [0, str, 0, 0],\n            \"includeInIndex\": [0, int, 0, 0],\n            \"indentWidth\": [0, int, 0, 0],\n            \"lineEnding\": [0, int, 0, 0],\n            \"sourceTree\": [0, str, 0, 1, \"<group>\"],\n            \"tabWidth\": [0, int, 0, 0],\n            \"usesTabs\": [0, int, 0, 0],\n            \"wrapsLines\": [0, int, 0, 0],\n        }\n    )\n\n    def __init__(self, properties=None, id=None, parent=None):\n        # super\n        XCObject.__init__(self, properties, id, parent)\n        if \"path\" in self._properties and \"name\" not in self._properties:\n            path = self._properties[\"path\"]\n            name = posixpath.basename(path)\n            if name not in (\"\", path):\n                self.SetProperty(\"name\", name)\n\n        if \"path\" in self._properties and (\n            \"sourceTree\" not in self._properties\n            or self._properties[\"sourceTree\"] == \"<group>\"\n        ):\n            # If the pathname begins with an Xcode variable like \"$(SDKROOT)/\", take\n            # the variable out and make the path be relative to that variable by\n            # assigning the variable name as the sourceTree.\n            (source_tree, path) = SourceTreeAndPathFromPath(self._properties[\"path\"])\n            if source_tree is not None:\n                self._properties[\"sourceTree\"] = source_tree\n            if path is not None:\n                self._properties[\"path\"] = path\n            if (\n                source_tree is not None\n                and path is None\n                and \"name\" not in self._properties\n            ):\n                # The path was of the form \"$(SDKROOT)\" with no path following it.\n                # This object is now relative to that variable, so it has no path\n                # attribute of its own.  It does, however, keep a name.\n                del self._properties[\"path\"]\n                self._properties[\"name\"] = source_tree\n\n    def Name(self):\n        if \"name\" in self._properties:\n            return self._properties[\"name\"]\n        elif \"path\" in self._properties:\n            return self._properties[\"path\"]\n        else:\n            # This happens in the case of the root PBXGroup.\n            return None\n\n    def Hashables(self):\n        \"\"\"Custom hashables for XCHierarchicalElements.\n\n        XCHierarchicalElements are special.  Generally, their hashes shouldn't\n        change if the paths don't change.  The normal XCObject implementation of\n        Hashables adds a hashable for each object, which means that if\n        the hierarchical structure changes (possibly due to changes caused when\n        TakeOverOnlyChild runs and encounters slight changes in the hierarchy),\n        the hashes will change.  For example, if a project file initially contains\n        a/b/f1 and a/b becomes collapsed into a/b, f1 will have a single parent\n        a/b.  If someone later adds a/f2 to the project file, a/b can no longer be\n        collapsed, and f1 winds up with parent b and grandparent a.  That would\n        be sufficient to change f1's hash.\n\n        To counteract this problem, hashables for all XCHierarchicalElements except\n        for the main group (which has neither a name nor a path) are taken to be\n        just the set of path components.  Because hashables are inherited from\n        parents, this provides assurance that a/b/f1 has the same set of hashables\n        whether its parent is b or a/b.\n\n        The main group is a special case.  As it is permitted to have no name or\n        path, it is permitted to use the standard XCObject hash mechanism.  This\n        is not considered a problem because there can be only one main group.\n        \"\"\"\n\n        if self == self.PBXProjectAncestor()._properties[\"mainGroup\"]:\n            # super\n            return XCObject.Hashables(self)\n\n        hashables = []\n\n        # Put the name in first, ensuring that if TakeOverOnlyChild collapses\n        # children into a top-level group like \"Source\", the name always goes\n        # into the list of hashables without interfering with path components.\n        if \"name\" in self._properties:\n            # Make it less likely for people to manipulate hashes by following the\n            # pattern of always pushing an object type value onto the list first.\n            hashables.append(self.__class__.__name__ + \".name\")\n            hashables.append(self._properties[\"name\"])\n\n        # NOTE: This still has the problem that if an absolute path is encountered,\n        # including paths with a sourceTree, they'll still inherit their parents'\n        # hashables, even though the paths aren't relative to their parents.  This\n        # is not expected to be much of a problem in practice.\n        if (path := self.PathFromSourceTreeAndPath()) is not None:\n            components = path.split(posixpath.sep)\n            for component in components:\n                hashables.append(self.__class__.__name__ + \".path\")\n                hashables.append(component)\n\n        hashables.extend(self._hashables)\n\n        return hashables\n\n    def Compare(self, other):\n        # Allow comparison of these types.  PBXGroup has the highest sort rank;\n        # PBXVariantGroup is treated as equal to PBXFileReference.\n        valid_class_types = {\n            PBXFileReference: \"file\",\n            PBXGroup: \"group\",\n            PBXVariantGroup: \"file\",\n        }\n        self_type = valid_class_types[self.__class__]\n        other_type = valid_class_types[other.__class__]\n\n        if self_type == other_type:\n            # If the two objects are of the same sort rank, compare their names.\n            return cmp(self.Name(), other.Name())\n\n        # Otherwise, sort groups before everything else.\n        if self_type == \"group\":\n            return -1\n        return 1\n\n    def CompareRootGroup(self, other):\n        # This function should be used only to compare direct children of the\n        # containing PBXProject's mainGroup.  These groups should appear in the\n        # listed order.\n        # TODO(mark): \"Build\" is used by gyp.generator.xcode, perhaps the\n        # generator should have a way of influencing this list rather than having\n        # to hardcode for the generator here.\n        order = [\n            \"Source\",\n            \"Intermediates\",\n            \"Projects\",\n            \"Frameworks\",\n            \"Products\",\n            \"Build\",\n        ]\n\n        # If the groups aren't in the listed order, do a name comparison.\n        # Otherwise, groups in the listed order should come before those that\n        # aren't.\n        self_name = self.Name()\n        other_name = other.Name()\n        self_in = isinstance(self, PBXGroup) and self_name in order\n        other_in = isinstance(self, PBXGroup) and other_name in order\n        if not self_in and not other_in:\n            return self.Compare(other)\n        if self_name in order and other_name not in order:\n            return -1\n        if other_name in order and self_name not in order:\n            return 1\n\n        # If both groups are in the listed order, go by the defined order.\n        self_index = order.index(self_name)\n        other_index = order.index(other_name)\n        if self_index < other_index:\n            return -1\n        if self_index > other_index:\n            return 1\n        return 0\n\n    def PathFromSourceTreeAndPath(self):\n        # Turn the object's sourceTree and path properties into a single flat\n        # string of a form comparable to the path parameter.  If there's a\n        # sourceTree property other than \"<group>\", wrap it in $(...) for the\n        # comparison.\n        components = []\n        if self._properties[\"sourceTree\"] != \"<group>\":\n            components.append(\"$(\" + self._properties[\"sourceTree\"] + \")\")\n        if \"path\" in self._properties:\n            components.append(self._properties[\"path\"])\n\n        if len(components) > 0:\n            return posixpath.join(*components)\n\n        return None\n\n    def FullPath(self):\n        # Returns a full path to self relative to the project file, or relative\n        # to some other source tree.  Start with self, and walk up the chain of\n        # parents prepending their paths, if any, until no more parents are\n        # available (project-relative path) or until a path relative to some\n        # source tree is found.\n        xche = self\n        path = None\n        while isinstance(xche, XCHierarchicalElement) and (\n            path is None or (not path.startswith(\"/\") and not path.startswith(\"$\"))\n        ):\n            this_path = xche.PathFromSourceTreeAndPath()\n            if this_path is not None and path is not None:\n                path = posixpath.join(this_path, path)\n            elif this_path is not None:\n                path = this_path\n            xche = xche.parent\n\n        return path\n\n\nclass PBXGroup(XCHierarchicalElement):\n    \"\"\"\n    Attributes:\n      _children_by_path: Maps pathnames of children of this PBXGroup to the\n        actual child XCHierarchicalElement objects.\n      _variant_children_by_name_and_path: Maps (name, path) tuples of\n        PBXVariantGroup children to the actual child PBXVariantGroup objects.\n    \"\"\"\n\n    _schema = XCHierarchicalElement._schema.copy()\n    _schema.update(\n        {\n            \"children\": [1, XCHierarchicalElement, 1, 1, []],\n            \"name\": [0, str, 0, 0],\n            \"path\": [0, str, 0, 0],\n        }\n    )\n\n    def __init__(self, properties=None, id=None, parent=None):\n        # super\n        XCHierarchicalElement.__init__(self, properties, id, parent)\n        self._children_by_path = {}\n        self._variant_children_by_name_and_path = {}\n        for child in self._properties.get(\"children\", []):\n            self._AddChildToDicts(child)\n\n    def Hashables(self):\n        # super\n        hashables = XCHierarchicalElement.Hashables(self)\n\n        # It is not sufficient to just rely on name and parent to build a unique\n        # hashable : a node could have two child PBXGroup sharing a common name.\n        # To add entropy the hashable is enhanced with the names of all its\n        # children.\n        for child in self._properties.get(\"children\", []):\n            child_name = child.Name()\n            if child_name is not None:\n                hashables.append(child_name)\n\n        return hashables\n\n    def HashablesForChild(self):\n        # To avoid a circular reference the hashables used to compute a child id do\n        # not include the child names.\n        return XCHierarchicalElement.Hashables(self)\n\n    def _AddChildToDicts(self, child):\n        # Sets up this PBXGroup object's dicts to reference the child properly.\n        child_path = child.PathFromSourceTreeAndPath()\n        if child_path:\n            if child_path in self._children_by_path:\n                raise ValueError(\"Found multiple children with path \" + child_path)\n            self._children_by_path[child_path] = child\n\n        if isinstance(child, PBXVariantGroup):\n            child_name = child._properties.get(\"name\", None)\n            key = (child_name, child_path)\n            if key in self._variant_children_by_name_and_path:\n                raise ValueError(\n                    \"Found multiple PBXVariantGroup children with \"\n                    + \"name \"\n                    + str(child_name)\n                    + \" and path \"\n                    + str(child_path)\n                )\n            self._variant_children_by_name_and_path[key] = child\n\n    def AppendChild(self, child):\n        # Callers should use this instead of calling\n        # AppendProperty('children', child) directly because this function\n        # maintains the group's dicts.\n        self.AppendProperty(\"children\", child)\n        self._AddChildToDicts(child)\n\n    def GetChildByName(self, name):\n        # This is not currently optimized with a dict as GetChildByPath is because\n        # it has few callers.  Most callers probably want GetChildByPath.  This\n        # function is only useful to get children that have names but no paths,\n        # which is rare.  The children of the main group (\"Source\", \"Products\",\n        # etc.) is pretty much the only case where this likely to come up.\n        #\n        # TODO(mark): Maybe this should raise an error if more than one child is\n        # present with the same name.\n        if \"children\" not in self._properties:\n            return None\n\n        for child in self._properties[\"children\"]:\n            if child.Name() == name:\n                return child\n\n        return None\n\n    def GetChildByPath(self, path):\n        if not path:\n            return None\n\n        if path in self._children_by_path:\n            return self._children_by_path[path]\n\n        return None\n\n    def GetChildByRemoteObject(self, remote_object):\n        # This method is a little bit esoteric.  Given a remote_object, which\n        # should be a PBXFileReference in another project file, this method will\n        # return this group's PBXReferenceProxy object serving as a local proxy\n        # for the remote PBXFileReference.\n        #\n        # This function might benefit from a dict optimization as GetChildByPath\n        # for some workloads, but profiling shows that it's not currently a\n        # problem.\n        if \"children\" not in self._properties:\n            return None\n\n        for child in self._properties[\"children\"]:\n            if not isinstance(child, PBXReferenceProxy):\n                continue\n\n            container_proxy = child._properties[\"remoteRef\"]\n            if container_proxy._properties[\"remoteGlobalIDString\"] == remote_object:\n                return child\n\n        return None\n\n    def AddOrGetFileByPath(self, path, hierarchical):\n        \"\"\"Returns an existing or new file reference corresponding to path.\n\n        If hierarchical is True, this method will create or use the necessary\n        hierarchical group structure corresponding to path.  Otherwise, it will\n        look in and create an item in the current group only.\n\n        If an existing matching reference is found, it is returned, otherwise, a\n        new one will be created, added to the correct group, and returned.\n\n        If path identifies a directory by virtue of carrying a trailing slash,\n        this method returns a PBXFileReference of \"folder\" type.  If path\n        identifies a variant, by virtue of it identifying a file inside a directory\n        with an \".lproj\" extension, this method returns a PBXVariantGroup\n        containing the variant named by path, and possibly other variants.  For\n        all other paths, a \"normal\" PBXFileReference will be returned.\n        \"\"\"\n\n        # Adding or getting a directory?  Directories end with a trailing slash.\n        is_dir = False\n        if path.endswith(\"/\"):\n            is_dir = True\n        path = posixpath.normpath(path)\n        if is_dir:\n            path = path + \"/\"\n\n        # Adding or getting a variant?  Variants are files inside directories\n        # with an \".lproj\" extension.  Xcode uses variants for localization.  For\n        # a variant path/to/Language.lproj/MainMenu.nib, put a variant group named\n        # MainMenu.nib inside path/to, and give it a variant named Language.  In\n        # this example, grandparent would be set to path/to and parent_root would\n        # be set to Language.\n        variant_name = None\n        parent = posixpath.dirname(path)\n        grandparent = posixpath.dirname(parent)\n        parent_basename = posixpath.basename(parent)\n        (parent_root, parent_ext) = posixpath.splitext(parent_basename)\n        if parent_ext == \".lproj\":\n            variant_name = parent_root\n        if grandparent == \"\":\n            grandparent = None\n\n        # Putting a directory inside a variant group is not currently supported.\n        assert not is_dir or variant_name is None\n\n        path_split = path.split(posixpath.sep)\n        if (\n            len(path_split) == 1\n            or ((is_dir or variant_name is not None) and len(path_split) == 2)\n            or not hierarchical\n        ):\n            # The PBXFileReference or PBXVariantGroup will be added to or gotten from\n            # this PBXGroup, no recursion necessary.\n            if variant_name is None:\n                # Add or get a PBXFileReference.\n                file_ref = self.GetChildByPath(path)\n                if file_ref is not None:\n                    assert file_ref.__class__ == PBXFileReference\n                else:\n                    file_ref = PBXFileReference({\"path\": path})\n                    self.AppendChild(file_ref)\n            else:\n                # Add or get a PBXVariantGroup.  The variant group name is the same\n                # as the basename (MainMenu.nib in the example above).  grandparent\n                # specifies the path to the variant group itself, and path_split[-2:]\n                # is the path of the specific variant relative to its group.\n                variant_group_name = posixpath.basename(path)\n                variant_group_ref = self.AddOrGetVariantGroupByNameAndPath(\n                    variant_group_name, grandparent\n                )\n                variant_path = posixpath.sep.join(path_split[-2:])\n                variant_ref = variant_group_ref.GetChildByPath(variant_path)\n                if variant_ref is not None:\n                    assert variant_ref.__class__ == PBXFileReference\n                else:\n                    variant_ref = PBXFileReference(\n                        {\"name\": variant_name, \"path\": variant_path}\n                    )\n                    variant_group_ref.AppendChild(variant_ref)\n                # The caller is interested in the variant group, not the specific\n                # variant file.\n                file_ref = variant_group_ref\n            return file_ref\n        else:\n            # Hierarchical recursion.  Add or get a PBXGroup corresponding to the\n            # outermost path component, and then recurse into it, chopping off that\n            # path component.\n            next_dir = path_split[0]\n            group_ref = self.GetChildByPath(next_dir)\n            if group_ref is not None:\n                assert group_ref.__class__ == PBXGroup\n            else:\n                group_ref = PBXGroup({\"path\": next_dir})\n                self.AppendChild(group_ref)\n            return group_ref.AddOrGetFileByPath(\n                posixpath.sep.join(path_split[1:]), hierarchical\n            )\n\n    def AddOrGetVariantGroupByNameAndPath(self, name, path):\n        \"\"\"Returns an existing or new PBXVariantGroup for name and path.\n\n        If a PBXVariantGroup identified by the name and path arguments is already\n        present as a child of this object, it is returned.  Otherwise, a new\n        PBXVariantGroup with the correct properties is created, added as a child,\n        and returned.\n\n        This method will generally be called by AddOrGetFileByPath, which knows\n        when to create a variant group based on the structure of the pathnames\n        passed to it.\n        \"\"\"\n\n        key = (name, path)\n        if key in self._variant_children_by_name_and_path:\n            variant_group_ref = self._variant_children_by_name_and_path[key]\n            assert variant_group_ref.__class__ == PBXVariantGroup\n            return variant_group_ref\n\n        variant_group_properties = {\"name\": name}\n        if path is not None:\n            variant_group_properties[\"path\"] = path\n        variant_group_ref = PBXVariantGroup(variant_group_properties)\n        self.AppendChild(variant_group_ref)\n\n        return variant_group_ref\n\n    def TakeOverOnlyChild(self, recurse=False):\n        \"\"\"If this PBXGroup has only one child and it's also a PBXGroup, take\n        it over by making all of its children this object's children.\n\n        This function will continue to take over only children when those children\n        are groups.  If there are three PBXGroups representing a, b, and c, with\n        c inside b and b inside a, and a and b have no other children, this will\n        result in a taking over both b and c, forming a PBXGroup for a/b/c.\n\n        If recurse is True, this function will recurse into children and ask them\n        to collapse themselves by taking over only children as well.  Assuming\n        an example hierarchy with files at a/b/c/d1, a/b/c/d2, and a/b/c/d3/e/f\n        (d1, d2, and f are files, the rest are groups), recursion will result in\n        a group for a/b/c containing a group for d3/e.\n        \"\"\"\n\n        # At this stage, check that child class types are PBXGroup exactly,\n        # instead of using isinstance.  The only subclass of PBXGroup,\n        # PBXVariantGroup, should not participate in reparenting in the same way:\n        # reparenting by merging different object types would be wrong.\n        while (\n            len(self._properties[\"children\"]) == 1\n            and self._properties[\"children\"][0].__class__ == PBXGroup\n        ):\n            # Loop to take over the innermost only-child group possible.\n\n            child = self._properties[\"children\"][0]\n\n            # Assume the child's properties, including its children.  Save a copy\n            # of this object's old properties, because they'll still be needed.\n            # This object retains its existing id and parent attributes.\n            old_properties = self._properties\n            self._properties = child._properties\n            self._children_by_path = child._children_by_path\n\n            if (\n                \"sourceTree\" not in self._properties\n                or self._properties[\"sourceTree\"] == \"<group>\"\n            ):\n                # The child was relative to its parent.  Fix up the path.  Note that\n                # children with a sourceTree other than \"<group>\" are not relative to\n                # their parents, so no path fix-up is needed in that case.\n                if \"path\" in old_properties:\n                    if \"path\" in self._properties:\n                        # Both the original parent and child have paths set.\n                        self._properties[\"path\"] = posixpath.join(\n                            old_properties[\"path\"], self._properties[\"path\"]\n                        )\n                    else:\n                        # Only the original parent has a path, use it.\n                        self._properties[\"path\"] = old_properties[\"path\"]\n                if \"sourceTree\" in old_properties:\n                    # The original parent had a sourceTree set, use it.\n                    self._properties[\"sourceTree\"] = old_properties[\"sourceTree\"]\n\n            # If the original parent had a name set, keep using it.  If the original\n            # parent didn't have a name but the child did, let the child's name\n            # live on.  If the name attribute seems unnecessary now, get rid of it.\n            if \"name\" in old_properties and old_properties[\"name\"] not in (\n                None,\n                self.Name(),\n            ):\n                self._properties[\"name\"] = old_properties[\"name\"]\n            if (\n                \"name\" in self._properties\n                and \"path\" in self._properties\n                and self._properties[\"name\"] == self._properties[\"path\"]\n            ):\n                del self._properties[\"name\"]\n\n            # Notify all children of their new parent.\n            for child in self._properties[\"children\"]:\n                child.parent = self\n\n        # If asked to recurse, recurse.\n        if recurse:\n            for child in self._properties[\"children\"]:\n                if child.__class__ == PBXGroup:\n                    child.TakeOverOnlyChild(recurse)\n\n    def SortGroup(self):\n        self._properties[\"children\"] = sorted(\n            self._properties[\"children\"], key=cmp_to_key(lambda x, y: x.Compare(y))\n        )\n\n        # Recurse.\n        for child in self._properties[\"children\"]:\n            if isinstance(child, PBXGroup):\n                child.SortGroup()\n\n\nclass XCFileLikeElement(XCHierarchicalElement):\n    # Abstract base for objects that can be used as the fileRef property of\n    # PBXBuildFile.\n\n    def PathHashables(self):\n        # A PBXBuildFile that refers to this object will call this method to\n        # obtain additional hashables specific to this XCFileLikeElement.  Don't\n        # just use this object's hashables, they're not specific and unique enough\n        # on their own (without access to the parent hashables.)  Instead, provide\n        # hashables that identify this object by path by getting its hashables as\n        # well as the hashables of ancestor XCHierarchicalElement objects.\n\n        hashables = []\n        xche = self\n        while isinstance(xche, XCHierarchicalElement):\n            xche_hashables = xche.Hashables()\n            for index, xche_hashable in enumerate(xche_hashables):\n                hashables.insert(index, xche_hashable)\n            xche = xche.parent\n        return hashables\n\n\nclass XCContainerPortal(XCObject):\n    # Abstract base for objects that can be used as the containerPortal property\n    # of PBXContainerItemProxy.\n    pass\n\n\nclass XCRemoteObject(XCObject):\n    # Abstract base for objects that can be used as the remoteGlobalIDString\n    # property of PBXContainerItemProxy.\n    pass\n\n\nclass PBXFileReference(XCFileLikeElement, XCContainerPortal, XCRemoteObject):\n    _schema = XCFileLikeElement._schema.copy()\n    _schema.update(\n        {\n            \"explicitFileType\": [0, str, 0, 0],\n            \"lastKnownFileType\": [0, str, 0, 0],\n            \"name\": [0, str, 0, 0],\n            \"path\": [0, str, 0, 1],\n        }\n    )\n\n    # Weird output rules for PBXFileReference.\n    _should_print_single_line = True\n    # super\n    _encode_transforms = XCFileLikeElement._alternate_encode_transforms\n\n    def __init__(self, properties=None, id=None, parent=None):\n        # super\n        XCFileLikeElement.__init__(self, properties, id, parent)\n        if \"path\" in self._properties and self._properties[\"path\"].endswith(\"/\"):\n            self._properties[\"path\"] = self._properties[\"path\"][:-1]\n            is_dir = True\n        else:\n            is_dir = False\n\n        if (\n            \"path\" in self._properties\n            and \"lastKnownFileType\" not in self._properties\n            and \"explicitFileType\" not in self._properties\n        ):\n            # TODO(mark): This is the replacement for a replacement for a quick hack.\n            # It is no longer incredibly sucky, but this list needs to be extended.\n            extension_map = {\n                \"a\": \"archive.ar\",\n                \"app\": \"wrapper.application\",\n                \"bdic\": \"file\",\n                \"bundle\": \"wrapper.cfbundle\",\n                \"c\": \"sourcecode.c.c\",\n                \"cc\": \"sourcecode.cpp.cpp\",\n                \"cpp\": \"sourcecode.cpp.cpp\",\n                \"css\": \"text.css\",\n                \"cxx\": \"sourcecode.cpp.cpp\",\n                \"dart\": \"sourcecode\",\n                \"dylib\": \"compiled.mach-o.dylib\",\n                \"framework\": \"wrapper.framework\",\n                \"gyp\": \"sourcecode\",\n                \"gypi\": \"sourcecode\",\n                \"h\": \"sourcecode.c.h\",\n                \"hxx\": \"sourcecode.cpp.h\",\n                \"icns\": \"image.icns\",\n                \"java\": \"sourcecode.java\",\n                \"js\": \"sourcecode.javascript\",\n                \"kext\": \"wrapper.kext\",\n                \"m\": \"sourcecode.c.objc\",\n                \"mm\": \"sourcecode.cpp.objcpp\",\n                \"nib\": \"wrapper.nib\",\n                \"o\": \"compiled.mach-o.objfile\",\n                \"pdf\": \"image.pdf\",\n                \"pl\": \"text.script.perl\",\n                \"plist\": \"text.plist.xml\",\n                \"pm\": \"text.script.perl\",\n                \"png\": \"image.png\",\n                \"py\": \"text.script.python\",\n                \"r\": \"sourcecode.rez\",\n                \"rez\": \"sourcecode.rez\",\n                \"s\": \"sourcecode.asm\",\n                \"storyboard\": \"file.storyboard\",\n                \"strings\": \"text.plist.strings\",\n                \"swift\": \"sourcecode.swift\",\n                \"ttf\": \"file\",\n                \"xcassets\": \"folder.assetcatalog\",\n                \"xcconfig\": \"text.xcconfig\",\n                \"xcdatamodel\": \"wrapper.xcdatamodel\",\n                \"xcdatamodeld\": \"wrapper.xcdatamodeld\",\n                \"xib\": \"file.xib\",\n                \"y\": \"sourcecode.yacc\",\n            }\n\n            prop_map = {\n                \"dart\": \"explicitFileType\",\n                \"gyp\": \"explicitFileType\",\n                \"gypi\": \"explicitFileType\",\n            }\n\n            if is_dir:\n                file_type = \"folder\"\n                prop_name = \"lastKnownFileType\"\n            else:\n                basename = posixpath.basename(self._properties[\"path\"])\n                (_root, ext) = posixpath.splitext(basename)\n                # Check the map using a lowercase extension.\n                # TODO(mark): Maybe it should try with the original case first and fall\n                # back to lowercase, in case there are any instances where case\n                # matters.  There currently aren't.\n                if ext != \"\":\n                    ext = ext[1:].lower()\n\n                # TODO(mark): \"text\" is the default value, but \"file\" is appropriate\n                # for unrecognized files not containing text.  Xcode seems to choose\n                # based on content.\n                file_type = extension_map.get(ext, \"text\")\n                prop_name = prop_map.get(ext, \"lastKnownFileType\")\n\n            self._properties[prop_name] = file_type\n\n\nclass PBXVariantGroup(PBXGroup, XCFileLikeElement):\n    \"\"\"PBXVariantGroup is used by Xcode to represent localizations.\"\"\"\n\n    # No additions to the schema relative to PBXGroup.\n\n\n# PBXReferenceProxy is also an XCFileLikeElement subclass.  It is defined below\n# because it uses PBXContainerItemProxy, defined below.\n\n\nclass XCBuildConfiguration(XCObject):\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"baseConfigurationReference\": [0, PBXFileReference, 0, 0],\n            \"buildSettings\": [0, dict, 0, 1, {}],\n            \"name\": [0, str, 0, 1],\n        }\n    )\n\n    def HasBuildSetting(self, key):\n        return key in self._properties[\"buildSettings\"]\n\n    def GetBuildSetting(self, key):\n        return self._properties[\"buildSettings\"][key]\n\n    def SetBuildSetting(self, key, value):\n        # TODO(mark): If a list, copy?\n        self._properties[\"buildSettings\"][key] = value\n\n    def AppendBuildSetting(self, key, value):\n        if key not in self._properties[\"buildSettings\"]:\n            self._properties[\"buildSettings\"][key] = []\n        self._properties[\"buildSettings\"][key].append(value)\n\n    def DelBuildSetting(self, key):\n        if key in self._properties[\"buildSettings\"]:\n            del self._properties[\"buildSettings\"][key]\n\n    def SetBaseConfiguration(self, value):\n        self._properties[\"baseConfigurationReference\"] = value\n\n\nclass XCConfigurationList(XCObject):\n    # _configs is the default list of configurations.\n    _configs = [\n        XCBuildConfiguration({\"name\": \"Debug\"}),\n        XCBuildConfiguration({\"name\": \"Release\"}),\n    ]\n\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"buildConfigurations\": [1, XCBuildConfiguration, 1, 1, _configs],\n            \"defaultConfigurationIsVisible\": [0, int, 0, 1, 1],\n            \"defaultConfigurationName\": [0, str, 0, 1, \"Release\"],\n        }\n    )\n\n    def Name(self):\n        return (\n            \"Build configuration list for \"\n            + self.parent.__class__.__name__\n            + ' \"'\n            + self.parent.Name()\n            + '\"'\n        )\n\n    def ConfigurationNamed(self, name):\n        \"\"\"Convenience accessor to obtain an XCBuildConfiguration by name.\"\"\"\n        for configuration in self._properties[\"buildConfigurations\"]:\n            if configuration._properties[\"name\"] == name:\n                return configuration\n\n        raise KeyError(name)\n\n    def DefaultConfiguration(self):\n        \"\"\"Convenience accessor to obtain the default XCBuildConfiguration.\"\"\"\n        return self.ConfigurationNamed(self._properties[\"defaultConfigurationName\"])\n\n    def HasBuildSetting(self, key):\n        \"\"\"Determines the state of a build setting in all XCBuildConfiguration\n        child objects.\n\n        If all child objects have key in their build settings, and the value is the\n        same in all child objects, returns 1.\n\n        If no child objects have the key in their build settings, returns 0.\n\n        If some, but not all, child objects have the key in their build settings,\n        or if any children have different values for the key, returns -1.\n        \"\"\"\n\n        has = None\n        value = None\n        for configuration in self._properties[\"buildConfigurations\"]:\n            configuration_has = configuration.HasBuildSetting(key)\n            if has is None:\n                has = configuration_has\n            elif has != configuration_has:\n                return -1\n\n            if configuration_has:\n                configuration_value = configuration.GetBuildSetting(key)\n                if value is None:\n                    value = configuration_value\n                elif value != configuration_value:\n                    return -1\n\n        if not has:\n            return 0\n\n        return 1\n\n    def GetBuildSetting(self, key):\n        \"\"\"Gets the build setting for key.\n\n        All child XCConfiguration objects must have the same value set for the\n        setting, or a ValueError will be raised.\n        \"\"\"\n\n        # TODO(mark): This is wrong for build settings that are lists.  The list\n        # contents should be compared (and a list copy returned?)\n\n        value = None\n        for configuration in self._properties[\"buildConfigurations\"]:\n            configuration_value = configuration.GetBuildSetting(key)\n            if value is None:\n                value = configuration_value\n            elif value != configuration_value:\n                raise ValueError(\"Variant values for \" + key)\n\n        return value\n\n    def SetBuildSetting(self, key, value):\n        \"\"\"Sets the build setting for key to value in all child\n        XCBuildConfiguration objects.\n        \"\"\"\n\n        for configuration in self._properties[\"buildConfigurations\"]:\n            configuration.SetBuildSetting(key, value)\n\n    def AppendBuildSetting(self, key, value):\n        \"\"\"Appends value to the build setting for key, which is treated as a list,\n        in all child XCBuildConfiguration objects.\n        \"\"\"\n\n        for configuration in self._properties[\"buildConfigurations\"]:\n            configuration.AppendBuildSetting(key, value)\n\n    def DelBuildSetting(self, key):\n        \"\"\"Deletes the build setting key from all child XCBuildConfiguration\n        objects.\n        \"\"\"\n\n        for configuration in self._properties[\"buildConfigurations\"]:\n            configuration.DelBuildSetting(key)\n\n    def SetBaseConfiguration(self, value):\n        \"\"\"Sets the build configuration in all child XCBuildConfiguration objects.\"\"\"\n\n        for configuration in self._properties[\"buildConfigurations\"]:\n            configuration.SetBaseConfiguration(value)\n\n\nclass PBXBuildFile(XCObject):\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"fileRef\": [0, XCFileLikeElement, 0, 1],\n            \"settings\": [0, str, 0, 0],  # hack, it's a dict\n        }\n    )\n\n    # Weird output rules for PBXBuildFile.\n    _should_print_single_line = True\n    _encode_transforms = XCObject._alternate_encode_transforms\n\n    def Name(self):\n        # Example: \"main.cc in Sources\"\n        return self._properties[\"fileRef\"].Name() + \" in \" + self.parent.Name()\n\n    def Hashables(self):\n        # super\n        hashables = XCObject.Hashables(self)\n\n        # It is not sufficient to just rely on Name() to get the\n        # XCFileLikeElement's name, because that is not a complete pathname.\n        # PathHashables returns hashables unique enough that no two\n        # PBXBuildFiles should wind up with the same set of hashables, unless\n        # someone adds the same file multiple times to the same target.  That\n        # would be considered invalid anyway.\n        hashables.extend(self._properties[\"fileRef\"].PathHashables())\n\n        return hashables\n\n\nclass XCBuildPhase(XCObject):\n    \"\"\"Abstract base for build phase classes.  Not represented in a project\n    file.\n\n    Attributes:\n      _files_by_path: A dict mapping each path of a child in the files list by\n        path (keys) to the corresponding PBXBuildFile children (values).\n      _files_by_xcfilelikeelement: A dict mapping each XCFileLikeElement (keys)\n        to the corresponding PBXBuildFile children (values).\n    \"\"\"\n\n    # TODO(mark): Some build phase types, like PBXShellScriptBuildPhase, don't\n    # actually have a \"files\" list.  XCBuildPhase should not have \"files\" but\n    # another abstract subclass of it should provide this, and concrete build\n    # phase types that do have \"files\" lists should be derived from that new\n    # abstract subclass.  XCBuildPhase should only provide buildActionMask and\n    # runOnlyForDeploymentPostprocessing, and not files or the various\n    # file-related methods and attributes.\n\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"buildActionMask\": [0, int, 0, 1, 0x7FFFFFFF],\n            \"files\": [1, PBXBuildFile, 1, 1, []],\n            \"runOnlyForDeploymentPostprocessing\": [0, int, 0, 1, 0],\n        }\n    )\n\n    def __init__(self, properties=None, id=None, parent=None):\n        # super\n        XCObject.__init__(self, properties, id, parent)\n\n        self._files_by_path = {}\n        self._files_by_xcfilelikeelement = {}\n        for pbxbuildfile in self._properties.get(\"files\", []):\n            self._AddBuildFileToDicts(pbxbuildfile)\n\n    def FileGroup(self, path):\n        # Subclasses must override this by returning a two-element tuple.  The\n        # first item in the tuple should be the PBXGroup to which \"path\" should be\n        # added, either as a child or deeper descendant.  The second item should\n        # be a boolean indicating whether files should be added into hierarchical\n        # groups or one single flat group.\n        raise NotImplementedError(self.__class__.__name__ + \" must implement FileGroup\")\n\n    def _AddPathToDict(self, pbxbuildfile, path):\n        \"\"\"Adds path to the dict tracking paths belonging to this build phase.\n\n        If the path is already a member of this build phase, raises an exception.\n        \"\"\"\n\n        if path in self._files_by_path:\n            raise ValueError(\"Found multiple build files with path \" + path)\n        self._files_by_path[path] = pbxbuildfile\n\n    def _AddBuildFileToDicts(self, pbxbuildfile, path=None):\n        \"\"\"Maintains the _files_by_path and _files_by_xcfilelikeelement dicts.\n\n        If path is specified, then it is the path that is being added to the\n        phase, and pbxbuildfile must contain either a PBXFileReference directly\n        referencing that path, or it must contain a PBXVariantGroup that itself\n        contains a PBXFileReference referencing the path.\n\n        If path is not specified, either the PBXFileReference's path or the paths\n        of all children of the PBXVariantGroup are taken as being added to the\n        phase.\n\n        If the path is already present in the phase, raises an exception.\n\n        If the PBXFileReference or PBXVariantGroup referenced by pbxbuildfile\n        are already present in the phase, referenced by a different PBXBuildFile\n        object, raises an exception.  This does not raise an exception when\n        a PBXFileReference or PBXVariantGroup reappear and are referenced by the\n        same PBXBuildFile that has already introduced them, because in the case\n        of PBXVariantGroup objects, they may correspond to multiple paths that are\n        not all added simultaneously.  When this situation occurs, the path needs\n        to be added to _files_by_path, but nothing needs to change in\n        _files_by_xcfilelikeelement, and the caller should have avoided adding\n        the PBXBuildFile if it is already present in the list of children.\n        \"\"\"\n\n        xcfilelikeelement = pbxbuildfile._properties[\"fileRef\"]\n\n        paths = []\n        if path is not None:\n            # It's best when the caller provides the path.\n            if isinstance(xcfilelikeelement, PBXVariantGroup):\n                paths.append(path)\n        # If the caller didn't provide a path, there can be either multiple\n        # paths (PBXVariantGroup) or one.\n        elif isinstance(xcfilelikeelement, PBXVariantGroup):\n            for variant in xcfilelikeelement._properties[\"children\"]:\n                paths.append(variant.FullPath())\n        else:\n            paths.append(xcfilelikeelement.FullPath())\n\n        # Add the paths first, because if something's going to raise, the\n        # messages provided by _AddPathToDict are more useful owing to its\n        # having access to a real pathname and not just an object's Name().\n        for a_path in paths:\n            self._AddPathToDict(pbxbuildfile, a_path)\n\n        # If another PBXBuildFile references this XCFileLikeElement, there's a\n        # problem.\n        if (\n            xcfilelikeelement in self._files_by_xcfilelikeelement\n            and self._files_by_xcfilelikeelement[xcfilelikeelement] != pbxbuildfile\n        ):\n            raise ValueError(\n                \"Found multiple build files for \" + xcfilelikeelement.Name()\n            )\n        self._files_by_xcfilelikeelement[xcfilelikeelement] = pbxbuildfile\n\n    def AppendBuildFile(self, pbxbuildfile, path=None):\n        # Callers should use this instead of calling\n        # AppendProperty('files', pbxbuildfile) directly because this function\n        # maintains the object's dicts.  Better yet, callers can just call AddFile\n        # with a pathname and not worry about building their own PBXBuildFile\n        # objects.\n        self.AppendProperty(\"files\", pbxbuildfile)\n        self._AddBuildFileToDicts(pbxbuildfile, path)\n\n    def AddFile(self, path, settings=None):\n        (file_group, hierarchical) = self.FileGroup(path)\n        file_ref = file_group.AddOrGetFileByPath(path, hierarchical)\n\n        if file_ref in self._files_by_xcfilelikeelement and isinstance(\n            file_ref, PBXVariantGroup\n        ):\n            # There's already a PBXBuildFile in this phase corresponding to the\n            # PBXVariantGroup.  path just provides a new variant that belongs to\n            # the group.  Add the path to the dict.\n            pbxbuildfile = self._files_by_xcfilelikeelement[file_ref]\n            self._AddBuildFileToDicts(pbxbuildfile, path)\n        else:\n            # Add a new PBXBuildFile to get file_ref into the phase.\n            if settings is None:\n                pbxbuildfile = PBXBuildFile({\"fileRef\": file_ref})\n            else:\n                pbxbuildfile = PBXBuildFile({\"fileRef\": file_ref, \"settings\": settings})\n            self.AppendBuildFile(pbxbuildfile, path)\n\n\nclass PBXHeadersBuildPhase(XCBuildPhase):\n    # No additions to the schema relative to XCBuildPhase.\n\n    def Name(self):\n        return \"Headers\"\n\n    def FileGroup(self, path):\n        return self.PBXProjectAncestor().RootGroupForPath(path)\n\n\nclass PBXResourcesBuildPhase(XCBuildPhase):\n    # No additions to the schema relative to XCBuildPhase.\n\n    def Name(self):\n        return \"Resources\"\n\n    def FileGroup(self, path):\n        return self.PBXProjectAncestor().RootGroupForPath(path)\n\n\nclass PBXSourcesBuildPhase(XCBuildPhase):\n    # No additions to the schema relative to XCBuildPhase.\n\n    def Name(self):\n        return \"Sources\"\n\n    def FileGroup(self, path):\n        return self.PBXProjectAncestor().RootGroupForPath(path)\n\n\nclass PBXFrameworksBuildPhase(XCBuildPhase):\n    # No additions to the schema relative to XCBuildPhase.\n\n    def Name(self):\n        return \"Frameworks\"\n\n    def FileGroup(self, path):\n        (_root, ext) = posixpath.splitext(path)\n        if ext != \"\":\n            ext = ext[1:].lower()\n        if ext == \"o\":\n            # .o files are added to Xcode Frameworks phases, but conceptually aren't\n            # frameworks, they're more like sources or intermediates. Redirect them\n            # to show up in one of those other groups.\n            return self.PBXProjectAncestor().RootGroupForPath(path)\n        else:\n            return (self.PBXProjectAncestor().FrameworksGroup(), False)\n\n\nclass PBXShellScriptBuildPhase(XCBuildPhase):\n    _schema = XCBuildPhase._schema.copy()\n    _schema.update(\n        {\n            \"inputPaths\": [1, str, 0, 1, []],\n            \"name\": [0, str, 0, 0],\n            \"outputPaths\": [1, str, 0, 1, []],\n            \"shellPath\": [0, str, 0, 1, \"/bin/sh\"],\n            \"shellScript\": [0, str, 0, 1],\n            \"showEnvVarsInLog\": [0, int, 0, 0],\n        }\n    )\n\n    def Name(self):\n        if \"name\" in self._properties:\n            return self._properties[\"name\"]\n\n        return \"ShellScript\"\n\n\nclass PBXCopyFilesBuildPhase(XCBuildPhase):\n    _schema = XCBuildPhase._schema.copy()\n    _schema.update(\n        {\n            \"dstPath\": [0, str, 0, 1],\n            \"dstSubfolderSpec\": [0, int, 0, 1],\n            \"name\": [0, str, 0, 0],\n        }\n    )\n\n    # path_tree_re matches \"$(DIR)/path\", \"$(DIR)/$(DIR2)/path\" or just \"$(DIR)\".\n    # Match group 1 is \"DIR\", group 3 is \"path\" or \"$(DIR2\") or \"$(DIR2)/path\"\n    # or None. If group 3 is \"path\", group 4 will be None otherwise group 4 is\n    # \"DIR2\" and group 6 is \"path\".\n    path_tree_re = re.compile(r\"^\\$\\((.*?)\\)(/(\\$\\((.*?)\\)(/(.*)|)|(.*)|)|)$\")\n\n    # path_tree_{first,second}_to_subfolder map names of Xcode variables to the\n    # associated dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase\n    # object.\n    path_tree_first_to_subfolder = {\n        # Types that can be chosen via the Xcode UI.\n        \"BUILT_PRODUCTS_DIR\": 16,  # Products Directory\n        \"BUILT_FRAMEWORKS_DIR\": 10,  # Not an official Xcode macro.\n        # Existed before support for the\n        # names below was added. Maps to\n        # \"Frameworks\".\n    }\n\n    path_tree_second_to_subfolder = {\n        \"WRAPPER_NAME\": 1,  # Wrapper\n        # Although Xcode's friendly name is \"Executables\", the destination\n        # is demonstrably the value of the build setting\n        # EXECUTABLE_FOLDER_PATH not EXECUTABLES_FOLDER_PATH.\n        \"EXECUTABLE_FOLDER_PATH\": 6,  # Executables.\n        \"UNLOCALIZED_RESOURCES_FOLDER_PATH\": 7,  # Resources\n        \"JAVA_FOLDER_PATH\": 15,  # Java Resources\n        \"FRAMEWORKS_FOLDER_PATH\": 10,  # Frameworks\n        \"SHARED_FRAMEWORKS_FOLDER_PATH\": 11,  # Shared Frameworks\n        \"SHARED_SUPPORT_FOLDER_PATH\": 12,  # Shared Support\n        \"PLUGINS_FOLDER_PATH\": 13,  # PlugIns\n        # For XPC Services, Xcode sets both dstPath and dstSubfolderSpec.\n        # Note that it re-uses the BUILT_PRODUCTS_DIR value for\n        # dstSubfolderSpec. dstPath is set below.\n        \"XPCSERVICES_FOLDER_PATH\": 16,  # XPC Services.\n    }\n\n    def Name(self):\n        if \"name\" in self._properties:\n            return self._properties[\"name\"]\n\n        return \"CopyFiles\"\n\n    def FileGroup(self, path):\n        return self.PBXProjectAncestor().RootGroupForPath(path)\n\n    def SetDestination(self, path):\n        \"\"\"Set the dstSubfolderSpec and dstPath properties from path.\n\n        path may be specified in the same notation used for XCHierarchicalElements,\n        specifically, \"$(DIR)/path\".\n        \"\"\"\n\n        if path_tree_match := self.path_tree_re.search(path):\n            path_tree = path_tree_match.group(1)\n            if path_tree in self.path_tree_first_to_subfolder:\n                subfolder = self.path_tree_first_to_subfolder[path_tree]\n                relative_path = path_tree_match.group(3)\n                if relative_path is None:\n                    relative_path = \"\"\n\n                if subfolder == 16 and path_tree_match.group(4) is not None:\n                    # BUILT_PRODUCTS_DIR (16) is the first element in a path whose\n                    # second element is possibly one of the variable names in\n                    # path_tree_second_to_subfolder. Xcode sets the values of all these\n                    # variables to relative paths so .gyp files must prefix them with\n                    # BUILT_PRODUCTS_DIR, e.g.\n                    # $(BUILT_PRODUCTS_DIR)/$(PLUGINS_FOLDER_PATH). Then\n                    # xcode_emulation.py can export these variables with the same values\n                    # as Xcode yet make & ninja files can determine the absolute path\n                    # to the target. Xcode uses the dstSubfolderSpec value set here\n                    # to determine the full path.\n                    #\n                    # An alternative of xcode_emulation.py setting the values to\n                    # absolute paths when exporting these variables has been\n                    # ruled out because then the values would be different\n                    # depending on the build tool.\n                    #\n                    # Another alternative is to invent new names for the variables used\n                    # to match to the subfolder indices in the second table. .gyp files\n                    # then will not need to prepend $(BUILT_PRODUCTS_DIR) because\n                    # xcode_emulation.py can set the values of those variables to\n                    # the absolute paths when exporting. This is possibly the thinking\n                    # behind BUILT_FRAMEWORKS_DIR which is used in exactly this manner.\n                    #\n                    # Requiring prepending BUILT_PRODUCTS_DIR has been chosen because\n                    # this same way could be used to specify destinations in .gyp files\n                    # that pre-date this addition to GYP. However they would only work\n                    # with the Xcode generator.\n                    # The previous version of xcode_emulation.py\n                    # does not export these variables. Such files will get the benefit\n                    # of the Xcode UI showing the proper destination name simply by\n                    # regenerating the projects with this version of GYP.\n                    path_tree = path_tree_match.group(4)\n                    relative_path = path_tree_match.group(6)\n                    separator = \"/\"\n\n                    if path_tree in self.path_tree_second_to_subfolder:\n                        subfolder = self.path_tree_second_to_subfolder[path_tree]\n                        if relative_path is None:\n                            relative_path = \"\"\n                            separator = \"\"\n                        if path_tree == \"XPCSERVICES_FOLDER_PATH\":\n                            relative_path = (\n                                \"$(CONTENTS_FOLDER_PATH)/XPCServices\"\n                                + separator\n                                + relative_path\n                            )\n                    else:\n                        # subfolder = 16 from above\n                        # The second element of the path is an unrecognized variable.\n                        # Include it and any remaining elements in relative_path.\n                        relative_path = path_tree_match.group(3)\n\n            else:\n                # The path starts with an unrecognized Xcode variable\n                # name like $(SRCROOT).  Xcode will still handle this\n                # as an \"absolute path\" that starts with the variable.\n                subfolder = 0\n                relative_path = path\n        elif path.startswith(\"/\"):\n            # Special case.  Absolute paths are in dstSubfolderSpec 0.\n            subfolder = 0\n            relative_path = path[1:]\n        else:\n            raise ValueError(f\"Can't use path {path} in a {self.__class__.__name__}\")\n\n        self._properties[\"dstPath\"] = relative_path\n        self._properties[\"dstSubfolderSpec\"] = subfolder\n\n\nclass PBXBuildRule(XCObject):\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"compilerSpec\": [0, str, 0, 1],\n            \"filePatterns\": [0, str, 0, 0],\n            \"fileType\": [0, str, 0, 1],\n            \"isEditable\": [0, int, 0, 1, 1],\n            \"outputFiles\": [1, str, 0, 1, []],\n            \"script\": [0, str, 0, 0],\n        }\n    )\n\n    def Name(self):\n        # Not very inspired, but it's what Xcode uses.\n        return self.__class__.__name__\n\n    def Hashables(self):\n        # super\n        hashables = XCObject.Hashables(self)\n\n        # Use the hashables of the weak objects that this object refers to.\n        hashables.append(self._properties[\"fileType\"])\n        if \"filePatterns\" in self._properties:\n            hashables.append(self._properties[\"filePatterns\"])\n        return hashables\n\n\nclass PBXContainerItemProxy(XCObject):\n    # When referencing an item in this project file, containerPortal is the\n    # PBXProject root object of this project file.  When referencing an item in\n    # another project file, containerPortal is a PBXFileReference identifying\n    # the other project file.\n    #\n    # When serving as a proxy to an XCTarget (in this project file or another),\n    # proxyType is 1.  When serving as a proxy to a PBXFileReference (in another\n    # project file), proxyType is 2.  Type 2 is used for references to the\n    # producs of the other project file's targets.\n    #\n    # Xcode is weird about remoteGlobalIDString.  Usually, it's printed without\n    # a comment, indicating that it's tracked internally simply as a string, but\n    # sometimes it's printed with a comment (usually when the object is initially\n    # created), indicating that it's tracked as a project file object at least\n    # sometimes.  This module always tracks it as an object, but contains a hack\n    # to prevent it from printing the comment in the project file output.  See\n    # _XCKVPrint.\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"containerPortal\": [0, XCContainerPortal, 0, 1],\n            \"proxyType\": [0, int, 0, 1],\n            \"remoteGlobalIDString\": [0, XCRemoteObject, 0, 1],\n            \"remoteInfo\": [0, str, 0, 1],\n        }\n    )\n\n    def __repr__(self):\n        props = self._properties\n        name = \"{}.gyp:{}\".format(props[\"containerPortal\"].Name(), props[\"remoteInfo\"])\n        return f\"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>\"\n\n    def Name(self):\n        # Admittedly not the best name, but it's what Xcode uses.\n        return self.__class__.__name__\n\n    def Hashables(self):\n        # super\n        hashables = XCObject.Hashables(self)\n\n        # Use the hashables of the weak objects that this object refers to.\n        hashables.extend(self._properties[\"containerPortal\"].Hashables())\n        hashables.extend(self._properties[\"remoteGlobalIDString\"].Hashables())\n        return hashables\n\n\nclass PBXTargetDependency(XCObject):\n    # The \"target\" property accepts an XCTarget object, and obviously not\n    # NoneType.  But XCTarget is defined below, so it can't be put into the\n    # schema yet.  The definition of PBXTargetDependency can't be moved below\n    # XCTarget because XCTarget's own schema references PBXTargetDependency.\n    # Python doesn't deal well with this circular relationship, and doesn't have\n    # a real way to do forward declarations.  To work around, the type of\n    # the \"target\" property is reset below, after XCTarget is defined.\n    #\n    # At least one of \"name\" and \"target\" is required.\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"name\": [0, str, 0, 0],\n            \"target\": [0, None.__class__, 0, 0],\n            \"targetProxy\": [0, PBXContainerItemProxy, 1, 1],\n        }\n    )\n\n    def __repr__(self):\n        name = self._properties.get(\"name\") or self._properties[\"target\"].Name()\n        return f\"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>\"\n\n    def Name(self):\n        # Admittedly not the best name, but it's what Xcode uses.\n        return self.__class__.__name__\n\n    def Hashables(self):\n        # super\n        hashables = XCObject.Hashables(self)\n\n        # Use the hashables of the weak objects that this object refers to.\n        hashables.extend(self._properties[\"targetProxy\"].Hashables())\n        return hashables\n\n\nclass PBXReferenceProxy(XCFileLikeElement):\n    _schema = XCFileLikeElement._schema.copy()\n    _schema.update(\n        {\n            \"fileType\": [0, str, 0, 1],\n            \"path\": [0, str, 0, 1],\n            \"remoteRef\": [0, PBXContainerItemProxy, 1, 1],\n        }\n    )\n\n\nclass XCTarget(XCRemoteObject):\n    # An XCTarget is really just an XCObject, the XCRemoteObject thing is just\n    # to allow PBXProject to be used in the remoteGlobalIDString property of\n    # PBXContainerItemProxy.\n    #\n    # Setting a \"name\" property at instantiation may also affect \"productName\",\n    # which may in turn affect the \"PRODUCT_NAME\" build setting in children of\n    # \"buildConfigurationList\".  See __init__ below.\n    _schema = XCRemoteObject._schema.copy()\n    _schema.update(\n        {\n            \"buildConfigurationList\": [\n                0,\n                XCConfigurationList,\n                1,\n                1,\n                XCConfigurationList(),\n            ],\n            \"buildPhases\": [1, XCBuildPhase, 1, 1, []],\n            \"dependencies\": [1, PBXTargetDependency, 1, 1, []],\n            \"name\": [0, str, 0, 1],\n            \"productName\": [0, str, 0, 1],\n        }\n    )\n\n    def __init__(\n        self,\n        properties=None,\n        id=None,\n        parent=None,\n        force_outdir=None,\n        force_prefix=None,\n        force_extension=None,\n    ):\n        # super\n        XCRemoteObject.__init__(self, properties, id, parent)\n\n        # Set up additional defaults not expressed in the schema.  If a \"name\"\n        # property was supplied, set \"productName\" if it is not present.  Also set\n        # the \"PRODUCT_NAME\" build setting in each configuration, but only if\n        # the setting is not present in any build configuration.\n        if \"name\" in self._properties and \"productName\" not in self._properties:\n            self.SetProperty(\"productName\", self._properties[\"name\"])\n\n        if \"productName\" in self._properties:\n            if \"buildConfigurationList\" in self._properties:\n                configs = self._properties[\"buildConfigurationList\"]\n                if configs.HasBuildSetting(\"PRODUCT_NAME\") == 0:\n                    configs.SetBuildSetting(\n                        \"PRODUCT_NAME\", self._properties[\"productName\"]\n                    )\n\n    def AddDependency(self, other):\n        pbxproject = self.PBXProjectAncestor()\n        other_pbxproject = other.PBXProjectAncestor()\n        if pbxproject == other_pbxproject:\n            # Add a dependency to another target in the same project file.\n            container = PBXContainerItemProxy(\n                {\n                    \"containerPortal\": pbxproject,\n                    \"proxyType\": 1,\n                    \"remoteGlobalIDString\": other,\n                    \"remoteInfo\": other.Name(),\n                }\n            )\n            dependency = PBXTargetDependency(\n                {\"target\": other, \"targetProxy\": container}\n            )\n            self.AppendProperty(\"dependencies\", dependency)\n        else:\n            # Add a dependency to a target in a different project file.\n            other_project_ref = pbxproject.AddOrGetProjectReference(other_pbxproject)[1]\n            container = PBXContainerItemProxy(\n                {\n                    \"containerPortal\": other_project_ref,\n                    \"proxyType\": 1,\n                    \"remoteGlobalIDString\": other,\n                    \"remoteInfo\": other.Name(),\n                }\n            )\n            dependency = PBXTargetDependency(\n                {\"name\": other.Name(), \"targetProxy\": container}\n            )\n            self.AppendProperty(\"dependencies\", dependency)\n\n    # Proxy all of these through to the build configuration list.\n\n    def ConfigurationNamed(self, name):\n        return self._properties[\"buildConfigurationList\"].ConfigurationNamed(name)\n\n    def DefaultConfiguration(self):\n        return self._properties[\"buildConfigurationList\"].DefaultConfiguration()\n\n    def HasBuildSetting(self, key):\n        return self._properties[\"buildConfigurationList\"].HasBuildSetting(key)\n\n    def GetBuildSetting(self, key):\n        return self._properties[\"buildConfigurationList\"].GetBuildSetting(key)\n\n    def SetBuildSetting(self, key, value):\n        return self._properties[\"buildConfigurationList\"].SetBuildSetting(key, value)\n\n    def AppendBuildSetting(self, key, value):\n        return self._properties[\"buildConfigurationList\"].AppendBuildSetting(key, value)\n\n    def DelBuildSetting(self, key):\n        return self._properties[\"buildConfigurationList\"].DelBuildSetting(key)\n\n\n# Redefine the type of the \"target\" property.  See PBXTargetDependency._schema\n# above.\nPBXTargetDependency._schema[\"target\"][1] = XCTarget\n\n\nclass PBXNativeTarget(XCTarget):\n    # buildPhases is overridden in the schema to be able to set defaults.\n    #\n    # NOTE: Contrary to most objects, it is advisable to set parent when\n    # constructing PBXNativeTarget.  A parent of an XCTarget must be a PBXProject\n    # object.  A parent reference is required for a PBXNativeTarget during\n    # construction to be able to set up the target defaults for productReference,\n    # because a PBXBuildFile object must be created for the target and it must\n    # be added to the PBXProject's mainGroup hierarchy.\n    _schema = XCTarget._schema.copy()\n    _schema.update(\n        {\n            \"buildPhases\": [\n                1,\n                XCBuildPhase,\n                1,\n                1,\n                [PBXSourcesBuildPhase(), PBXFrameworksBuildPhase()],\n            ],\n            \"buildRules\": [1, PBXBuildRule, 1, 1, []],\n            \"productReference\": [0, PBXFileReference, 0, 1],\n            \"productType\": [0, str, 0, 1],\n        }\n    )\n\n    # Mapping from Xcode product-types to settings.  The settings are:\n    #  filetype : used for explicitFileType in the project file\n    #  prefix : the prefix for the file name\n    #  suffix : the suffix for the file name\n    _product_filetypes = {\n        \"com.apple.product-type.application\": [\"wrapper.application\", \"\", \".app\"],\n        \"com.apple.product-type.application.watchapp\": [\n            \"wrapper.application\",\n            \"\",\n            \".app\",\n        ],\n        \"com.apple.product-type.watchkit-extension\": [\n            \"wrapper.app-extension\",\n            \"\",\n            \".appex\",\n        ],\n        \"com.apple.product-type.app-extension\": [\"wrapper.app-extension\", \"\", \".appex\"],\n        \"com.apple.product-type.bundle\": [\"wrapper.cfbundle\", \"\", \".bundle\"],\n        \"com.apple.product-type.framework\": [\"wrapper.framework\", \"\", \".framework\"],\n        \"com.apple.product-type.library.dynamic\": [\n            \"compiled.mach-o.dylib\",\n            \"lib\",\n            \".dylib\",\n        ],\n        \"com.apple.product-type.library.static\": [\"archive.ar\", \"lib\", \".a\"],\n        \"com.apple.product-type.tool\": [\"compiled.mach-o.executable\", \"\", \"\"],\n        \"com.apple.product-type.bundle.unit-test\": [\"wrapper.cfbundle\", \"\", \".xctest\"],\n        \"com.apple.product-type.bundle.ui-testing\": [\"wrapper.cfbundle\", \"\", \".xctest\"],\n        \"com.googlecode.gyp.xcode.bundle\": [\"compiled.mach-o.dylib\", \"\", \".so\"],\n        \"com.apple.product-type.kernel-extension\": [\"wrapper.kext\", \"\", \".kext\"],\n    }\n\n    def __init__(\n        self,\n        properties=None,\n        id=None,\n        parent=None,\n        force_outdir=None,\n        force_prefix=None,\n        force_extension=None,\n    ):\n        # super\n        XCTarget.__init__(self, properties, id, parent)\n\n        if (\n            \"productName\" in self._properties\n            and \"productType\" in self._properties\n            and \"productReference\" not in self._properties\n            and self._properties[\"productType\"] in self._product_filetypes\n        ):\n            products_group = None\n            pbxproject = self.PBXProjectAncestor()\n            if pbxproject is not None:\n                products_group = pbxproject.ProductsGroup()\n\n            if products_group is not None:\n                (filetype, prefix, suffix) = self._product_filetypes[\n                    self._properties[\"productType\"]\n                ]\n                # Xcode does not have a distinct type for loadable modules that are\n                # pure BSD targets (not in a bundle wrapper). GYP allows such modules\n                # to be specified by setting a target type to loadable_module without\n                # having mac_bundle set. These are mapped to the pseudo-product type\n                # com.googlecode.gyp.xcode.bundle.\n                #\n                # By picking up this special type and converting it to a dynamic\n                # library (com.apple.product-type.library.dynamic) with fix-ups,\n                # single-file loadable modules can be produced.\n                #\n                # MACH_O_TYPE is changed to mh_bundle to produce the proper file type\n                # (as opposed to mh_dylib). In order for linking to succeed,\n                # DYLIB_CURRENT_VERSION and DYLIB_COMPATIBILITY_VERSION must be\n                # cleared. They are meaningless for type mh_bundle.\n                #\n                # Finally, the .so extension is forcibly applied over the default\n                # (.dylib), unless another forced extension is already selected.\n                # .dylib is plainly wrong, and .bundle is used by loadable_modules in\n                # bundle wrappers (com.apple.product-type.bundle). .so seems an odd\n                # choice because it's used as the extension on many other systems that\n                # don't distinguish between linkable shared libraries and non-linkable\n                # loadable modules, but there's precedent: Python loadable modules on\n                # Mac OS X use an .so extension.\n                if self._properties[\"productType\"] == \"com.googlecode.gyp.xcode.bundle\":\n                    self._properties[\"productType\"] = (\n                        \"com.apple.product-type.library.dynamic\"\n                    )\n                    self.SetBuildSetting(\"MACH_O_TYPE\", \"mh_bundle\")\n                    self.SetBuildSetting(\"DYLIB_CURRENT_VERSION\", \"\")\n                    self.SetBuildSetting(\"DYLIB_COMPATIBILITY_VERSION\", \"\")\n                    if force_extension is None:\n                        force_extension = suffix[1:]\n\n                if (\n                    self._properties[\"productType\"]\n                    in {\n                        \"com.apple.product-type-bundle.unit.test\",\n                        \"com.apple.product-type-bundle.ui-testing\",\n                    }\n                ) and force_extension is None:\n                    force_extension = suffix[1:]\n\n                if force_extension is not None:\n                    # If it's a wrapper (bundle), set WRAPPER_EXTENSION.\n                    # Extension override.\n                    suffix = \".\" + force_extension\n                    if filetype.startswith(\"wrapper.\"):\n                        self.SetBuildSetting(\"WRAPPER_EXTENSION\", force_extension)\n                    else:\n                        self.SetBuildSetting(\"EXECUTABLE_EXTENSION\", force_extension)\n\n                    if filetype.startswith(\"compiled.mach-o.executable\"):\n                        product_name = self._properties[\"productName\"]\n                        product_name += suffix\n                        suffix = \"\"\n                        self.SetProperty(\"productName\", product_name)\n                        self.SetBuildSetting(\"PRODUCT_NAME\", product_name)\n\n                # Xcode handles most prefixes based on the target type, however there\n                # are exceptions.  If a \"BSD Dynamic Library\" target is added in the\n                # Xcode UI, Xcode sets EXECUTABLE_PREFIX.  This check duplicates that\n                # behavior.\n                if force_prefix is not None:\n                    prefix = force_prefix\n                if filetype.startswith(\"wrapper.\"):\n                    self.SetBuildSetting(\"WRAPPER_PREFIX\", prefix)\n                else:\n                    self.SetBuildSetting(\"EXECUTABLE_PREFIX\", prefix)\n\n                if force_outdir is not None:\n                    self.SetBuildSetting(\"TARGET_BUILD_DIR\", force_outdir)\n\n                # TODO(tvl): Remove the below hack.\n                #    http://code.google.com/p/gyp/issues/detail?id=122\n\n                # Some targets include the prefix in the target_name.  These targets\n                # really should just add a product_name setting that doesn't include\n                # the prefix.  For example:\n                #  target_name = 'libevent', product_name = 'event'\n                # This check cleans up for them.\n                product_name = self._properties[\"productName\"]\n                prefix_len = len(prefix)\n                if prefix_len and (product_name[:prefix_len] == prefix):\n                    product_name = product_name[prefix_len:]\n                    self.SetProperty(\"productName\", product_name)\n                    self.SetBuildSetting(\"PRODUCT_NAME\", product_name)\n\n                ref_props = {\n                    \"explicitFileType\": filetype,\n                    \"includeInIndex\": 0,\n                    \"path\": prefix + product_name + suffix,\n                    \"sourceTree\": \"BUILT_PRODUCTS_DIR\",\n                }\n                file_ref = PBXFileReference(ref_props)\n                products_group.AppendChild(file_ref)\n                self.SetProperty(\"productReference\", file_ref)\n\n    def GetBuildPhaseByType(self, type):\n        if \"buildPhases\" not in self._properties:\n            return None\n\n        the_phase = None\n        for phase in self._properties[\"buildPhases\"]:\n            if isinstance(phase, type):\n                # Some phases may be present in multiples in a well-formed project file,\n                # but phases like PBXSourcesBuildPhase may only be present singly, and\n                # this function is intended as an aid to GetBuildPhaseByType.  Loop\n                # over the entire list of phases and assert if more than one of the\n                # desired type is found.\n                assert the_phase is None\n                the_phase = phase\n\n        return the_phase\n\n    def HeadersPhase(self):\n        headers_phase = self.GetBuildPhaseByType(PBXHeadersBuildPhase)\n        if headers_phase is None:\n            headers_phase = PBXHeadersBuildPhase()\n\n            # The headers phase should come before the resources, sources, and\n            # frameworks phases, if any.\n            insert_at = len(self._properties[\"buildPhases\"])\n            for index, phase in enumerate(self._properties[\"buildPhases\"]):\n                if isinstance(\n                    phase,\n                    (\n                        PBXResourcesBuildPhase,\n                        PBXSourcesBuildPhase,\n                        PBXFrameworksBuildPhase,\n                    ),\n                ):\n                    insert_at = index\n                    break\n\n            self._properties[\"buildPhases\"].insert(insert_at, headers_phase)\n            headers_phase.parent = self\n\n        return headers_phase\n\n    def ResourcesPhase(self):\n        resources_phase = self.GetBuildPhaseByType(PBXResourcesBuildPhase)\n        if resources_phase is None:\n            resources_phase = PBXResourcesBuildPhase()\n\n            # The resources phase should come before the sources and frameworks\n            # phases, if any.\n            insert_at = len(self._properties[\"buildPhases\"])\n            for index, phase in enumerate(self._properties[\"buildPhases\"]):\n                if isinstance(phase, (PBXSourcesBuildPhase, PBXFrameworksBuildPhase)):\n                    insert_at = index\n                    break\n\n            self._properties[\"buildPhases\"].insert(insert_at, resources_phase)\n            resources_phase.parent = self\n\n        return resources_phase\n\n    def SourcesPhase(self):\n        sources_phase = self.GetBuildPhaseByType(PBXSourcesBuildPhase)\n        if sources_phase is None:\n            sources_phase = PBXSourcesBuildPhase()\n            self.AppendProperty(\"buildPhases\", sources_phase)\n\n        return sources_phase\n\n    def FrameworksPhase(self):\n        frameworks_phase = self.GetBuildPhaseByType(PBXFrameworksBuildPhase)\n        if frameworks_phase is None:\n            frameworks_phase = PBXFrameworksBuildPhase()\n            self.AppendProperty(\"buildPhases\", frameworks_phase)\n\n        return frameworks_phase\n\n    def AddDependency(self, other):\n        # super\n        XCTarget.AddDependency(self, other)\n\n        static_library_type = \"com.apple.product-type.library.static\"\n        shared_library_type = \"com.apple.product-type.library.dynamic\"\n        framework_type = \"com.apple.product-type.framework\"\n        if (\n            isinstance(other, PBXNativeTarget)\n            and \"productType\" in self._properties\n            and self._properties[\"productType\"] != static_library_type\n            and \"productType\" in other._properties\n            and (\n                other._properties[\"productType\"] == static_library_type\n                or (\n                    (\n                        other._properties[\"productType\"]\n                        in {shared_library_type, framework_type}\n                    )\n                    and (\n                        (not other.HasBuildSetting(\"MACH_O_TYPE\"))\n                        or other.GetBuildSetting(\"MACH_O_TYPE\") != \"mh_bundle\"\n                    )\n                )\n            )\n        ):\n            file_ref = other.GetProperty(\"productReference\")\n\n            pbxproject = self.PBXProjectAncestor()\n            other_pbxproject = other.PBXProjectAncestor()\n            if pbxproject != other_pbxproject:\n                other_project_product_group = pbxproject.AddOrGetProjectReference(\n                    other_pbxproject\n                )[0]\n                file_ref = other_project_product_group.GetChildByRemoteObject(file_ref)\n\n            self.FrameworksPhase().AppendProperty(\n                \"files\", PBXBuildFile({\"fileRef\": file_ref})\n            )\n\n\nclass PBXAggregateTarget(XCTarget):\n    pass\n\n\nclass PBXProject(XCContainerPortal):\n    # A PBXProject is really just an XCObject, the XCContainerPortal thing is\n    # just to allow PBXProject to be used in the containerPortal property of\n    # PBXContainerItemProxy.\n    \"\"\"\n\n    Attributes:\n      path: \"sample.xcodeproj\".  TODO(mark) Document me!\n      _other_pbxprojects: A dictionary, keyed by other PBXProject objects.  Each\n                          value is a reference to the dict in the\n                          projectReferences list associated with the keyed\n                          PBXProject.\n    \"\"\"\n\n    _schema = XCContainerPortal._schema.copy()\n    _schema.update(\n        {\n            \"attributes\": [0, dict, 0, 0],\n            \"buildConfigurationList\": [\n                0,\n                XCConfigurationList,\n                1,\n                1,\n                XCConfigurationList(),\n            ],\n            \"compatibilityVersion\": [0, str, 0, 1, \"Xcode 3.2\"],\n            \"hasScannedForEncodings\": [0, int, 0, 1, 1],\n            \"mainGroup\": [0, PBXGroup, 1, 1, PBXGroup()],\n            \"projectDirPath\": [0, str, 0, 1, \"\"],\n            \"projectReferences\": [1, dict, 0, 0],\n            \"projectRoot\": [0, str, 0, 1, \"\"],\n            \"targets\": [1, XCTarget, 1, 1, []],\n        }\n    )\n\n    def __init__(self, properties=None, id=None, parent=None, path=None):\n        self.path = path\n        self._other_pbxprojects = {}\n        # super\n        XCContainerPortal.__init__(self, properties, id, parent)\n\n    def Name(self):\n        name = self.path\n        if name[-10:] == \".xcodeproj\":\n            name = name[:-10]\n        return posixpath.basename(name)\n\n    def Path(self):\n        return self.path\n\n    def Comment(self):\n        return \"Project object\"\n\n    def Children(self):\n        # super\n        children = XCContainerPortal.Children(self)\n\n        # Add children that the schema doesn't know about.  Maybe there's a more\n        # elegant way around this, but this is the only case where we need to own\n        # objects in a dictionary (that is itself in a list), and three lines for\n        # a one-off isn't that big a deal.\n        if \"projectReferences\" in self._properties:\n            for reference in self._properties[\"projectReferences\"]:\n                children.append(reference[\"ProductGroup\"])\n\n        return children\n\n    def PBXProjectAncestor(self):\n        return self\n\n    def _GroupByName(self, name):\n        if \"mainGroup\" not in self._properties:\n            self.SetProperty(\"mainGroup\", PBXGroup())\n\n        main_group = self._properties[\"mainGroup\"]\n        group = main_group.GetChildByName(name)\n        if group is None:\n            group = PBXGroup({\"name\": name})\n            main_group.AppendChild(group)\n\n        return group\n\n    # SourceGroup and ProductsGroup are created by default in Xcode's own\n    # templates.\n    def SourceGroup(self):\n        return self._GroupByName(\"Source\")\n\n    def ProductsGroup(self):\n        return self._GroupByName(\"Products\")\n\n    # IntermediatesGroup is used to collect source-like files that are generated\n    # by rules or script phases and are placed in intermediate directories such\n    # as DerivedSources.\n    def IntermediatesGroup(self):\n        return self._GroupByName(\"Intermediates\")\n\n    # FrameworksGroup and ProjectsGroup are top-level groups used to collect\n    # frameworks and projects.\n    def FrameworksGroup(self):\n        return self._GroupByName(\"Frameworks\")\n\n    def ProjectsGroup(self):\n        return self._GroupByName(\"Projects\")\n\n    def RootGroupForPath(self, path):\n        \"\"\"Returns a PBXGroup child of this object to which path should be added.\n\n        This method is intended to choose between SourceGroup and\n        IntermediatesGroup on the basis of whether path is present in a source\n        directory or an intermediates directory.  For the purposes of this\n        determination, any path located within a derived file directory such as\n        PROJECT_DERIVED_FILE_DIR is treated as being in an intermediates\n        directory.\n\n        The returned value is a two-element tuple.  The first element is the\n        PBXGroup, and the second element specifies whether that group should be\n        organized hierarchically (True) or as a single flat list (False).\n        \"\"\"\n\n        # TODO(mark): make this a class variable and bind to self on call?\n        # Also, this list is nowhere near exhaustive.\n        # INTERMEDIATE_DIR and SHARED_INTERMEDIATE_DIR are used by\n        # gyp.generator.xcode.  There should probably be some way for that module\n        # to push the names in, rather than having to hard-code them here.\n        source_tree_groups = {\n            \"DERIVED_FILE_DIR\": (self.IntermediatesGroup, True),\n            \"INTERMEDIATE_DIR\": (self.IntermediatesGroup, True),\n            \"PROJECT_DERIVED_FILE_DIR\": (self.IntermediatesGroup, True),\n            \"SHARED_INTERMEDIATE_DIR\": (self.IntermediatesGroup, True),\n        }\n\n        (source_tree, path) = SourceTreeAndPathFromPath(path)\n        if source_tree is not None and source_tree in source_tree_groups:\n            (group_func, hierarchical) = source_tree_groups[source_tree]\n            group = group_func()\n            return (group, hierarchical)\n\n        # TODO(mark): make additional choices based on file extension.\n\n        return (self.SourceGroup(), True)\n\n    def AddOrGetFileInRootGroup(self, path):\n        \"\"\"Returns a PBXFileReference corresponding to path in the correct group\n        according to RootGroupForPath's heuristics.\n\n        If an existing PBXFileReference for path exists, it will be returned.\n        Otherwise, one will be created and returned.\n        \"\"\"\n\n        (group, hierarchical) = self.RootGroupForPath(path)\n        return group.AddOrGetFileByPath(path, hierarchical)\n\n    def RootGroupsTakeOverOnlyChildren(self, recurse=False):\n        \"\"\"Calls TakeOverOnlyChild for all groups in the main group.\"\"\"\n\n        for group in self._properties[\"mainGroup\"]._properties[\"children\"]:\n            if isinstance(group, PBXGroup):\n                group.TakeOverOnlyChild(recurse)\n\n    def SortGroups(self):\n        # Sort the children of the mainGroup (like \"Source\" and \"Products\")\n        # according to their defined order.\n        self._properties[\"mainGroup\"]._properties[\"children\"] = sorted(\n            self._properties[\"mainGroup\"]._properties[\"children\"],\n            key=cmp_to_key(lambda x, y: x.CompareRootGroup(y)),\n        )\n\n        # Sort everything else by putting group before files, and going\n        # alphabetically by name within sections of groups and files.  SortGroup\n        # is recursive.\n        for group in self._properties[\"mainGroup\"]._properties[\"children\"]:\n            if not isinstance(group, PBXGroup):\n                continue\n\n            if group.Name() == \"Products\":\n                # The Products group is a special case.  Instead of sorting\n                # alphabetically, sort things in the order of the targets that\n                # produce the products.  To do this, just build up a new list of\n                # products based on the targets.\n                products = []\n                for target in self._properties[\"targets\"]:\n                    if not isinstance(target, PBXNativeTarget):\n                        continue\n                    product = target._properties[\"productReference\"]\n                    # Make sure that the product is already in the products group.\n                    assert product in group._properties[\"children\"]\n                    products.append(product)\n\n                # Make sure that this process doesn't miss anything that was already\n                # in the products group.\n                assert len(products) == len(group._properties[\"children\"])\n                group._properties[\"children\"] = products\n            else:\n                group.SortGroup()\n\n    def AddOrGetProjectReference(self, other_pbxproject):\n        \"\"\"Add a reference to another project file (via PBXProject object) to this\n        one.\n\n        Returns [ProductGroup, ProjectRef].  ProductGroup is a PBXGroup object in\n        this project file that contains a PBXReferenceProxy object for each\n        product of each PBXNativeTarget in the other project file.  ProjectRef is\n        a PBXFileReference to the other project file.\n\n        If this project file already references the other project file, the\n        existing ProductGroup and ProjectRef are returned.  The ProductGroup will\n        still be updated if necessary.\n        \"\"\"\n\n        if \"projectReferences\" not in self._properties:\n            self._properties[\"projectReferences\"] = []\n\n        product_group = None\n        project_ref = None\n\n        if other_pbxproject not in self._other_pbxprojects:\n            # This project file isn't yet linked to the other one.  Establish the\n            # link.\n            product_group = PBXGroup({\"name\": \"Products\"})\n\n            # ProductGroup is strong.\n            product_group.parent = self\n\n            # There's nothing unique about this PBXGroup, and if left alone, it will\n            # wind up with the same set of hashables as all other PBXGroup objects\n            # owned by the projectReferences list.  Add the hashables of the\n            # remote PBXProject that it's related to.\n            product_group._hashables.extend(other_pbxproject.Hashables())\n\n            # The other project reports its path as relative to the same directory\n            # that this project's path is relative to.  The other project's path\n            # is not necessarily already relative to this project.  Figure out the\n            # pathname that this project needs to use to refer to the other one.\n            this_path = posixpath.dirname(self.Path())\n            projectDirPath = self.GetProperty(\"projectDirPath\")\n            if projectDirPath:\n                if posixpath.isabs(projectDirPath[0]):\n                    this_path = projectDirPath\n                else:\n                    this_path = posixpath.join(this_path, projectDirPath)\n            other_path = gyp.common.RelativePath(other_pbxproject.Path(), this_path)\n\n            # ProjectRef is weak (it's owned by the mainGroup hierarchy).\n            project_ref = PBXFileReference(\n                {\n                    \"lastKnownFileType\": \"wrapper.pb-project\",\n                    \"path\": other_path,\n                    \"sourceTree\": \"SOURCE_ROOT\",\n                }\n            )\n            self.ProjectsGroup().AppendChild(project_ref)\n\n            ref_dict = {\"ProductGroup\": product_group, \"ProjectRef\": project_ref}\n            self._other_pbxprojects[other_pbxproject] = ref_dict\n            self.AppendProperty(\"projectReferences\", ref_dict)\n\n            # Xcode seems to sort this list case-insensitively\n            self._properties[\"projectReferences\"] = sorted(\n                self._properties[\"projectReferences\"],\n                key=lambda x: x[\"ProjectRef\"].Name().lower(),\n            )\n        else:\n            # The link already exists.  Pull out the relevant data.\n            project_ref_dict = self._other_pbxprojects[other_pbxproject]\n            product_group = project_ref_dict[\"ProductGroup\"]\n            project_ref = project_ref_dict[\"ProjectRef\"]\n\n        self._SetUpProductReferences(other_pbxproject, product_group, project_ref)\n\n        inherit_unique_symroot = self._AllSymrootsUnique(other_pbxproject, False)\n        targets = other_pbxproject.GetProperty(\"targets\")\n        if all(self._AllSymrootsUnique(t, inherit_unique_symroot) for t in targets):\n            dir_path = project_ref._properties[\"path\"]\n            product_group._hashables.extend(dir_path)\n\n        return [product_group, project_ref]\n\n    def _AllSymrootsUnique(self, target, inherit_unique_symroot):\n        # Returns True if all configurations have a unique 'SYMROOT' attribute.\n        # The value of inherit_unique_symroot decides, if a configuration is assumed\n        # to inherit a unique 'SYMROOT' attribute from its parent, if it doesn't\n        # define an explicit value for 'SYMROOT'.\n        symroots = self._DefinedSymroots(target)\n        for s in self._DefinedSymroots(target):\n            if (s is not None and not self._IsUniqueSymrootForTarget(s)) or (\n                s is None and not inherit_unique_symroot\n            ):\n                return False\n        return True if symroots else inherit_unique_symroot\n\n    def _DefinedSymroots(self, target):\n        # Returns all values for the 'SYMROOT' attribute defined in all\n        # configurations for this target. If any configuration doesn't define the\n        # 'SYMROOT' attribute, None is added to the returned set. If all\n        # configurations don't define the 'SYMROOT' attribute, an empty set is\n        # returned.\n        config_list = target.GetProperty(\"buildConfigurationList\")\n        symroots = set()\n        for config in config_list.GetProperty(\"buildConfigurations\"):\n            setting = config.GetProperty(\"buildSettings\")\n            if \"SYMROOT\" in setting:\n                symroots.add(setting[\"SYMROOT\"])\n            else:\n                symroots.add(None)\n        if len(symroots) == 1 and None in symroots:\n            return set()\n        return symroots\n\n    def _IsUniqueSymrootForTarget(self, symroot):\n        # This method returns True if all configurations in target contain a\n        # 'SYMROOT' attribute that is unique for the given target. A value is\n        # unique, if the Xcode macro '$SRCROOT' appears in it in any form.\n        uniquifier = [\"$SRCROOT\", \"$(SRCROOT)\"]\n        if any(x in symroot for x in uniquifier):\n            return True\n        return False\n\n    def _SetUpProductReferences(self, other_pbxproject, product_group, project_ref):\n        # TODO(mark): This only adds references to products in other_pbxproject\n        # when they don't exist in this pbxproject.  Perhaps it should also\n        # remove references from this pbxproject that are no longer present in\n        # other_pbxproject.  Perhaps it should update various properties if they\n        # change.\n        for target in other_pbxproject._properties[\"targets\"]:\n            if not isinstance(target, PBXNativeTarget):\n                continue\n\n            other_fileref = target._properties[\"productReference\"]\n            if product_group.GetChildByRemoteObject(other_fileref) is None:\n                # Xcode sets remoteInfo to the name of the target and not the name\n                # of its product, despite this proxy being a reference to the product.\n                container_item = PBXContainerItemProxy(\n                    {\n                        \"containerPortal\": project_ref,\n                        \"proxyType\": 2,\n                        \"remoteGlobalIDString\": other_fileref,\n                        \"remoteInfo\": target.Name(),\n                    }\n                )\n                # TODO(mark): Does sourceTree get copied straight over from the other\n                # project?  Can the other project ever have lastKnownFileType here\n                # instead of explicitFileType?  (Use it if so?)  Can path ever be\n                # unset?  (I don't think so.)  Can other_fileref have name set, and\n                # does it impact the PBXReferenceProxy if so?  These are the questions\n                # that perhaps will be answered one day.\n                reference_proxy = PBXReferenceProxy(\n                    {\n                        \"fileType\": other_fileref._properties[\"explicitFileType\"],\n                        \"path\": other_fileref._properties[\"path\"],\n                        \"sourceTree\": other_fileref._properties[\"sourceTree\"],\n                        \"remoteRef\": container_item,\n                    }\n                )\n\n                product_group.AppendChild(reference_proxy)\n\n    def SortRemoteProductReferences(self):\n        # For each remote project file, sort the associated ProductGroup in the\n        # same order that the targets are sorted in the remote project file.  This\n        # is the sort order used by Xcode.\n\n        def CompareProducts(x, y, remote_products):\n            # x and y are PBXReferenceProxy objects.  Go through their associated\n            # PBXContainerItem to get the remote PBXFileReference, which will be\n            # present in the remote_products list.\n            x_remote = x._properties[\"remoteRef\"]._properties[\"remoteGlobalIDString\"]\n            y_remote = y._properties[\"remoteRef\"]._properties[\"remoteGlobalIDString\"]\n            x_index = remote_products.index(x_remote)\n            y_index = remote_products.index(y_remote)\n\n            # Use the order of each remote PBXFileReference in remote_products to\n            # determine the sort order.\n            return cmp(x_index, y_index)\n\n        for other_pbxproject, ref_dict in self._other_pbxprojects.items():\n            # Build up a list of products in the remote project file, ordered the\n            # same as the targets that produce them.\n            remote_products = []\n            for target in other_pbxproject._properties[\"targets\"]:\n                if not isinstance(target, PBXNativeTarget):\n                    continue\n                remote_products.append(target._properties[\"productReference\"])\n\n            # Sort the PBXReferenceProxy children according to the list of remote\n            # products.\n            product_group = ref_dict[\"ProductGroup\"]\n            product_group._properties[\"children\"] = sorted(\n                product_group._properties[\"children\"],\n                key=cmp_to_key(\n                    lambda x, y, rp=remote_products: CompareProducts(x, y, rp)\n                ),\n            )\n\n\nclass XCProjectFile(XCObject):\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"archiveVersion\": [0, int, 0, 1, 1],\n            \"classes\": [0, dict, 0, 1, {}],\n            \"objectVersion\": [0, int, 0, 1, 46],\n            \"rootObject\": [0, PBXProject, 1, 1],\n        }\n    )\n\n    def ComputeIDs(self, recursive=True, overwrite=True, hash=None):\n        # Although XCProjectFile is implemented here as an XCObject, it's not a\n        # proper object in the Xcode sense, and it certainly doesn't have its own\n        # ID.  Pass through an attempt to update IDs to the real root object.\n        if recursive:\n            self._properties[\"rootObject\"].ComputeIDs(recursive, overwrite, hash)\n\n    def Print(self, file=sys.stdout):\n        self.VerifyHasRequiredProperties()\n\n        # Add the special \"objects\" property, which will be caught and handled\n        # separately during printing.  This structure allows a fairly standard\n        # loop do the normal printing.\n        self._properties[\"objects\"] = {}\n        self._XCPrint(file, 0, \"// !$*UTF8*$!\\n\")\n        if self._should_print_single_line:\n            self._XCPrint(file, 0, \"{ \")\n        else:\n            self._XCPrint(file, 0, \"{\\n\")\n        for property, value in sorted(self._properties.items()):\n            if property == \"objects\":\n                self._PrintObjects(file)\n            else:\n                self._XCKVPrint(file, 1, property, value)\n        self._XCPrint(file, 0, \"}\\n\")\n        del self._properties[\"objects\"]\n\n    def _PrintObjects(self, file):\n        if self._should_print_single_line:\n            self._XCPrint(file, 0, \"objects = {\")\n        else:\n            self._XCPrint(file, 1, \"objects = {\\n\")\n\n        objects_by_class = {}\n        for object in self.Descendants():\n            if object == self:\n                continue\n            class_name = object.__class__.__name__\n            if class_name not in objects_by_class:\n                objects_by_class[class_name] = []\n            objects_by_class[class_name].append(object)\n\n        for class_name in sorted(objects_by_class):\n            self._XCPrint(file, 0, \"\\n\")\n            self._XCPrint(file, 0, \"/* Begin \" + class_name + \" section */\\n\")\n            for object in sorted(objects_by_class[class_name], key=attrgetter(\"id\")):\n                object.Print(file)\n            self._XCPrint(file, 0, \"/* End \" + class_name + \" section */\\n\")\n\n        if self._should_print_single_line:\n            self._XCPrint(file, 0, \"}; \")\n        else:\n            self._XCPrint(file, 1, \"};\\n\")\n"
  },
  {
    "path": "gyp/pylib/gyp/xml_fix.py",
    "content": "# Copyright (c) 2011 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Applies a fix to CR LF TAB handling in xml.dom.\n\nFixes this: http://code.google.com/p/chromium/issues/detail?id=76293\nWorking around this: http://bugs.python.org/issue5752\nTODO(bradnelson): Consider dropping this when we drop XP support.\n\"\"\"\n\nimport xml.dom.minidom\n\n\ndef _Replacement_write_data(writer, data, is_attrib=False):\n    \"\"\"Writes datachars to writer.\"\"\"\n    data = data.replace(\"&\", \"&amp;\").replace(\"<\", \"&lt;\")\n    data = data.replace('\"', \"&quot;\").replace(\">\", \"&gt;\")\n    if is_attrib:\n        data = data.replace(\"\\r\", \"&#xD;\").replace(\"\\n\", \"&#xA;\").replace(\"\\t\", \"&#x9;\")\n    writer.write(data)\n\n\ndef _Replacement_writexml(self, writer, indent=\"\", addindent=\"\", newl=\"\"):\n    # indent = current indentation\n    # addindent = indentation to add to higher levels\n    # newl = newline string\n    writer.write(indent + \"<\" + self.tagName)\n\n    attrs = self._get_attributes()\n    a_names = sorted(attrs.keys())\n\n    for a_name in a_names:\n        writer.write(' %s=\"' % a_name)\n        _Replacement_write_data(writer, attrs[a_name].value, is_attrib=True)\n        writer.write('\"')\n    if self.childNodes:\n        writer.write(\">%s\" % newl)\n        for node in self.childNodes:\n            node.writexml(writer, indent + addindent, addindent, newl)\n        writer.write(f\"{indent}</{self.tagName}>{newl}\")\n    else:\n        writer.write(\"/>%s\" % newl)\n\n\nclass XmlFix:\n    \"\"\"Object to manage temporary patching of xml.dom.minidom.\"\"\"\n\n    def __init__(self):\n        # Preserve current xml.dom.minidom functions.\n        self.write_data = xml.dom.minidom._write_data\n        self.writexml = xml.dom.minidom.Element.writexml\n        # Inject replacement versions of a function and a method.\n        xml.dom.minidom._write_data = _Replacement_write_data\n        xml.dom.minidom.Element.writexml = _Replacement_writexml\n\n    def Cleanup(self):\n        if self.write_data:\n            xml.dom.minidom._write_data = self.write_data\n            xml.dom.minidom.Element.writexml = self.writexml\n            self.write_data = None\n\n    def __del__(self):\n        self.Cleanup()\n"
  },
  {
    "path": "gyp/pylib/packaging/LICENSE",
    "content": "This software is made available under the terms of *either* of the licenses\nfound in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made\nunder the terms of *both* these licenses.\n"
  },
  {
    "path": "gyp/pylib/packaging/LICENSE.APACHE",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n"
  },
  {
    "path": "gyp/pylib/packaging/LICENSE.BSD",
    "content": "Copyright (c) Donald Stufft and individual contributors.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n    1. Redistributions of source code must retain the above copyright notice,\n       this list of conditions and the following disclaimer.\n\n    2. Redistributions in binary form must reproduce the above copyright\n       notice, this list of conditions and the following disclaimer in the\n       documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "gyp/pylib/packaging/__init__.py",
    "content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\n__title__ = \"packaging\"\n__summary__ = \"Core utilities for Python packages\"\n__uri__ = \"https://github.com/pypa/packaging\"\n\n__version__ = \"23.3.dev0\"\n\n__author__ = \"Donald Stufft and individual contributors\"\n__email__ = \"donald@stufft.io\"\n\n__license__ = \"BSD-2-Clause or Apache-2.0\"\n__copyright__ = \"2014 %s\" % __author__\n"
  },
  {
    "path": "gyp/pylib/packaging/_elffile.py",
    "content": "\"\"\"\nELF file parser.\n\nThis provides a class ``ELFFile`` that parses an ELF executable in a similar\ninterface to ``ZipFile``. Only the read interface is implemented.\n\nBased on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca\nELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html\n\"\"\"\n\nimport enum\nimport os\nimport struct\nfrom typing import IO, Optional, Tuple\n\n\nclass ELFInvalid(ValueError):\n    pass\n\n\nclass EIClass(enum.IntEnum):\n    C32 = 1\n    C64 = 2\n\n\nclass EIData(enum.IntEnum):\n    Lsb = 1\n    Msb = 2\n\n\nclass EMachine(enum.IntEnum):\n    I386 = 3\n    S390 = 22\n    Arm = 40\n    X8664 = 62\n    AArc64 = 183\n\n\nclass ELFFile:\n    \"\"\"\n    Representation of an ELF executable.\n    \"\"\"\n\n    def __init__(self, f: IO[bytes]) -> None:\n        self._f = f\n\n        try:\n            ident = self._read(\"16B\")\n        except struct.error:\n            raise ELFInvalid(\"unable to parse identification\")\n        if (magic := bytes(ident[:4])) != b\"\\x7fELF\":\n            raise ELFInvalid(f\"invalid magic: {magic!r}\")\n\n        self.capacity = ident[4]  # Format for program header (bitness).\n        self.encoding = ident[5]  # Data structure encoding (endianness).\n\n        try:\n            # e_fmt: Format for program header.\n            # p_fmt: Format for section header.\n            # p_idx: Indexes to find p_type, p_offset, and p_filesz.\n            e_fmt, self._p_fmt, self._p_idx = {\n                (1, 1): (\"<HHIIIIIHHH\", \"<IIIIIIII\", (0, 1, 4)),  # 32-bit LSB.\n                (1, 2): (\">HHIIIIIHHH\", \">IIIIIIII\", (0, 1, 4)),  # 32-bit MSB.\n                (2, 1): (\"<HHIQQQIHHH\", \"<IIQQQQQQ\", (0, 2, 5)),  # 64-bit LSB.\n                (2, 2): (\">HHIQQQIHHH\", \">IIQQQQQQ\", (0, 2, 5)),  # 64-bit MSB.\n            }[(self.capacity, self.encoding)]\n        except KeyError:\n            raise ELFInvalid(\n                f\"unrecognized capacity ({self.capacity}) or \"\n                f\"encoding ({self.encoding})\"\n            )\n\n        try:\n            (\n                _,\n                self.machine,  # Architecture type.\n                _,\n                _,\n                self._e_phoff,  # Offset of program header.\n                _,\n                self.flags,  # Processor-specific flags.\n                _,\n                self._e_phentsize,  # Size of section.\n                self._e_phnum,  # Number of sections.\n            ) = self._read(e_fmt)\n        except struct.error as e:\n            raise ELFInvalid(\"unable to parse machine and section information\") from e\n\n    def _read(self, fmt: str) -> Tuple[int, ...]:\n        return struct.unpack(fmt, self._f.read(struct.calcsize(fmt)))\n\n    @property\n    def interpreter(self) -> Optional[str]:\n        \"\"\"\n        The path recorded in the ``PT_INTERP`` section header.\n        \"\"\"\n        for index in range(self._e_phnum):\n            self._f.seek(self._e_phoff + self._e_phentsize * index)\n            try:\n                data = self._read(self._p_fmt)\n            except struct.error:\n                continue\n            if data[self._p_idx[0]] != 3:  # Not PT_INTERP.\n                continue\n            self._f.seek(data[self._p_idx[1]])\n            return os.fsdecode(self._f.read(data[self._p_idx[2]])).strip(\"\\0\")\n        return None\n"
  },
  {
    "path": "gyp/pylib/packaging/_manylinux.py",
    "content": "import collections\nimport contextlib\nimport functools\nimport os\nimport re\nimport sys\nimport warnings\nfrom typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple\n\nfrom ._elffile import EIClass, EIData, ELFFile, EMachine\n\nEF_ARM_ABIMASK = 0xFF000000\nEF_ARM_ABI_VER5 = 0x05000000\nEF_ARM_ABI_FLOAT_HARD = 0x00000400\n\n\n# `os.PathLike` not a generic type until Python 3.9, so sticking with `str`\n# as the type for `path` until then.\n@contextlib.contextmanager\ndef _parse_elf(path: str) -> Generator[Optional[ELFFile], None, None]:\n    try:\n        with open(path, \"rb\") as f:\n            yield ELFFile(f)\n    except (OSError, TypeError, ValueError):\n        yield None\n\n\ndef _is_linux_armhf(executable: str) -> bool:\n    # hard-float ABI can be detected from the ELF header of the running\n    # process\n    # https://static.docs.arm.com/ihi0044/g/aaelf32.pdf\n    with _parse_elf(executable) as f:\n        return (\n            f is not None\n            and f.capacity == EIClass.C32\n            and f.encoding == EIData.Lsb\n            and f.machine == EMachine.Arm\n            and f.flags & EF_ARM_ABIMASK == EF_ARM_ABI_VER5\n            and f.flags & EF_ARM_ABI_FLOAT_HARD == EF_ARM_ABI_FLOAT_HARD\n        )\n\n\ndef _is_linux_i686(executable: str) -> bool:\n    with _parse_elf(executable) as f:\n        return (\n            f is not None\n            and f.capacity == EIClass.C32\n            and f.encoding == EIData.Lsb\n            and f.machine == EMachine.I386\n        )\n\n\ndef _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool:\n    if \"armv7l\" in archs:\n        return _is_linux_armhf(executable)\n    if \"i686\" in archs:\n        return _is_linux_i686(executable)\n    allowed_archs = {\"x86_64\", \"aarch64\", \"ppc64\", \"ppc64le\", \"s390x\", \"loongarch64\"}\n    return any(arch in allowed_archs for arch in archs)\n\n\n# If glibc ever changes its major version, we need to know what the last\n# minor version was, so we can build the complete list of all versions.\n# For now, guess what the highest minor version might be, assume it will\n# be 50 for testing. Once this actually happens, update the dictionary\n# with the actual value.\n_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50)\n\n\nclass _GLibCVersion(NamedTuple):\n    major: int\n    minor: int\n\n\ndef _glibc_version_string_confstr() -> Optional[str]:\n    \"\"\"\n    Primary implementation of glibc_version_string using os.confstr.\n    \"\"\"\n    # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely\n    # to be broken or missing. This strategy is used in the standard library\n    # platform module.\n    # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183\n    try:\n        # Should be a string like \"glibc 2.17\".\n        version_string: str = getattr(os, \"confstr\")(\"CS_GNU_LIBC_VERSION\")\n        assert version_string is not None\n        _, version = version_string.rsplit()\n    except (AssertionError, AttributeError, OSError, ValueError):\n        # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...\n        return None\n    return version\n\n\ndef _glibc_version_string_ctypes() -> Optional[str]:\n    \"\"\"\n    Fallback implementation of glibc_version_string using ctypes.\n    \"\"\"\n    try:\n        import ctypes\n    except ImportError:\n        return None\n\n    # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen\n    # manpage says, \"If filename is NULL, then the returned handle is for the\n    # main program\". This way we can let the linker do the work to figure out\n    # which libc our process is actually using.\n    #\n    # We must also handle the special case where the executable is not a\n    # dynamically linked executable. This can occur when using musl libc,\n    # for example. In this situation, dlopen() will error, leading to an\n    # OSError. Interestingly, at least in the case of musl, there is no\n    # errno set on the OSError. The single string argument used to construct\n    # OSError comes from libc itself and is therefore not portable to\n    # hard code here. In any case, failure to call dlopen() means we\n    # can proceed, so we bail on our attempt.\n    try:\n        process_namespace = ctypes.CDLL(None)\n    except OSError:\n        return None\n\n    try:\n        gnu_get_libc_version = process_namespace.gnu_get_libc_version\n    except AttributeError:\n        # Symbol doesn't exist -> therefore, we are not linked to\n        # glibc.\n        return None\n\n    # Call gnu_get_libc_version, which returns a string like \"2.5\"\n    gnu_get_libc_version.restype = ctypes.c_char_p\n    version_str: str = gnu_get_libc_version()\n    # py2 / py3 compatibility:\n    if not isinstance(version_str, str):\n        version_str = version_str.decode(\"ascii\")\n\n    return version_str\n\n\ndef _glibc_version_string() -> Optional[str]:\n    \"\"\"Returns glibc version string, or None if not using glibc.\"\"\"\n    return _glibc_version_string_confstr() or _glibc_version_string_ctypes()\n\n\ndef _parse_glibc_version(version_str: str) -> Tuple[int, int]:\n    \"\"\"Parse glibc version.\n\n    We use a regexp instead of str.split because we want to discard any\n    random junk that might come after the minor version -- this might happen\n    in patched/forked versions of glibc (e.g. Linaro's version of glibc\n    uses version strings like \"2.20-2014.11\"). See gh-3588.\n    \"\"\"\n    m = re.match(r\"(?P<major>[0-9]+)\\.(?P<minor>[0-9]+)\", version_str)\n    if not m:\n        warnings.warn(\n            f\"Expected glibc version with 2 components major.minor,\"\n            f\" got: {version_str}\",\n            RuntimeWarning,\n        )\n        return -1, -1\n    return int(m.group(\"major\")), int(m.group(\"minor\"))\n\n\n@functools.lru_cache()\ndef _get_glibc_version() -> Tuple[int, int]:\n    version_str = _glibc_version_string()\n    if version_str is None:\n        return (-1, -1)\n    return _parse_glibc_version(version_str)\n\n\n# From PEP 513, PEP 600\ndef _is_compatible(arch: str, version: _GLibCVersion) -> bool:\n    sys_glibc = _get_glibc_version()\n    if sys_glibc < version:\n        return False\n    # Check for presence of _manylinux module.\n    try:\n        import _manylinux  # noqa\n    except ImportError:\n        return True\n    if hasattr(_manylinux, \"manylinux_compatible\"):\n        result = _manylinux.manylinux_compatible(version[0], version[1], arch)\n        if result is not None:\n            return bool(result)\n        return True\n    if version == _GLibCVersion(2, 5):\n        if hasattr(_manylinux, \"manylinux1_compatible\"):\n            return bool(_manylinux.manylinux1_compatible)\n    if version == _GLibCVersion(2, 12):\n        if hasattr(_manylinux, \"manylinux2010_compatible\"):\n            return bool(_manylinux.manylinux2010_compatible)\n    if version == _GLibCVersion(2, 17):\n        if hasattr(_manylinux, \"manylinux2014_compatible\"):\n            return bool(_manylinux.manylinux2014_compatible)\n    return True\n\n\n_LEGACY_MANYLINUX_MAP = {\n    # CentOS 7 w/ glibc 2.17 (PEP 599)\n    (2, 17): \"manylinux2014\",\n    # CentOS 6 w/ glibc 2.12 (PEP 571)\n    (2, 12): \"manylinux2010\",\n    # CentOS 5 w/ glibc 2.5 (PEP 513)\n    (2, 5): \"manylinux1\",\n}\n\n\ndef platform_tags(archs: Sequence[str]) -> Iterator[str]:\n    \"\"\"Generate manylinux tags compatible to the current platform.\n\n    :param archs: Sequence of compatible architectures.\n        The first one shall be the closest to the actual architecture and be the part of\n        platform tag after the ``linux_`` prefix, e.g. ``x86_64``.\n        The ``linux_`` prefix is assumed as a prerequisite for the current platform to\n        be manylinux-compatible.\n\n    :returns: An iterator of compatible manylinux tags.\n    \"\"\"\n    if not _have_compatible_abi(sys.executable, archs):\n        return\n    # Oldest glibc to be supported regardless of architecture is (2, 17).\n    too_old_glibc2 = _GLibCVersion(2, 16)\n    if set(archs) & {\"x86_64\", \"i686\"}:\n        # On x86/i686 also oldest glibc to be supported is (2, 5).\n        too_old_glibc2 = _GLibCVersion(2, 4)\n    current_glibc = _GLibCVersion(*_get_glibc_version())\n    glibc_max_list = [current_glibc]\n    # We can assume compatibility across glibc major versions.\n    # https://sourceware.org/bugzilla/show_bug.cgi?id=24636\n    #\n    # Build a list of maximum glibc versions so that we can\n    # output the canonical list of all glibc from current_glibc\n    # down to too_old_glibc2, including all intermediary versions.\n    for glibc_major in range(current_glibc.major - 1, 1, -1):\n        glibc_minor = _LAST_GLIBC_MINOR[glibc_major]\n        glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor))\n    for arch in archs:\n        for glibc_max in glibc_max_list:\n            if glibc_max.major == too_old_glibc2.major:\n                min_minor = too_old_glibc2.minor\n            else:\n                # For other glibc major versions oldest supported is (x, 0).\n                min_minor = -1\n            for glibc_minor in range(glibc_max.minor, min_minor, -1):\n                glibc_version = _GLibCVersion(glibc_max.major, glibc_minor)\n                tag = \"manylinux_{}_{}\".format(*glibc_version)\n                if _is_compatible(arch, glibc_version):\n                    yield f\"{tag}_{arch}\"\n                # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags.\n                if glibc_version in _LEGACY_MANYLINUX_MAP:\n                    legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version]\n                    if _is_compatible(arch, glibc_version):\n                        yield f\"{legacy_tag}_{arch}\"\n"
  },
  {
    "path": "gyp/pylib/packaging/_musllinux.py",
    "content": "\"\"\"PEP 656 support.\n\nThis module implements logic to detect if the currently running Python is\nlinked against musl, and what musl version is used.\n\"\"\"\n\nimport functools\nimport re\nimport subprocess\nimport sys\nfrom typing import Iterator, NamedTuple, Optional, Sequence\n\nfrom ._elffile import ELFFile\n\n\nclass _MuslVersion(NamedTuple):\n    major: int\n    minor: int\n\n\ndef _parse_musl_version(output: str) -> Optional[_MuslVersion]:\n    lines = [n for n in (n.strip() for n in output.splitlines()) if n]\n    if len(lines) < 2 or lines[0][:4] != \"musl\":\n        return None\n    m = re.match(r\"Version (\\d+)\\.(\\d+)\", lines[1])\n    if not m:\n        return None\n    return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2)))\n\n\n@functools.lru_cache()\ndef _get_musl_version(executable: str) -> Optional[_MuslVersion]:\n    \"\"\"Detect currently-running musl runtime version.\n\n    This is done by checking the specified executable's dynamic linking\n    information, and invoking the loader to parse its output for a version\n    string. If the loader is musl, the output would be something like::\n\n        musl libc (x86_64)\n        Version 1.2.2\n        Dynamic Program Loader\n    \"\"\"\n    try:\n        with open(executable, \"rb\") as f:\n            ld = ELFFile(f).interpreter\n    except (OSError, TypeError, ValueError):\n        return None\n    if ld is None or \"musl\" not in ld:\n        return None\n    proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True)\n    return _parse_musl_version(proc.stderr)\n\n\ndef platform_tags(archs: Sequence[str]) -> Iterator[str]:\n    \"\"\"Generate musllinux tags compatible to the current platform.\n\n    :param archs: Sequence of compatible architectures.\n        The first one shall be the closest to the actual architecture and be the part of\n        platform tag after the ``linux_`` prefix, e.g. ``x86_64``.\n        The ``linux_`` prefix is assumed as a prerequisite for the current platform to\n        be musllinux-compatible.\n\n    :returns: An iterator of compatible musllinux tags.\n    \"\"\"\n    sys_musl = _get_musl_version(sys.executable)\n    if sys_musl is None:  # Python not dynamically linked against musl.\n        return\n    for arch in archs:\n        for minor in range(sys_musl.minor, -1, -1):\n            yield f\"musllinux_{sys_musl.major}_{minor}_{arch}\"\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    import sysconfig\n\n    plat = sysconfig.get_platform()\n    assert plat.startswith(\"linux-\"), \"not linux\"\n\n    print(\"plat:\", plat)\n    print(\"musl:\", _get_musl_version(sys.executable))\n    print(\"tags:\", end=\" \")\n    for t in platform_tags(re.sub(r\"[.-]\", \"_\", plat.split(\"-\", 1)[-1])):\n        print(t, end=\"\\n      \")\n"
  },
  {
    "path": "gyp/pylib/packaging/_parser.py",
    "content": "\"\"\"Handwritten parser of dependency specifiers.\n\nThe docstring for each __parse_* function contains ENBF-inspired grammar representing\nthe implementation.\n\"\"\"\n\nimport ast\nfrom typing import Any, List, NamedTuple, Optional, Tuple, Union\n\nfrom ._tokenizer import DEFAULT_RULES, Tokenizer\n\n\nclass Node:\n    def __init__(self, value: str) -> None:\n        self.value = value\n\n    def __str__(self) -> str:\n        return self.value\n\n    def __repr__(self) -> str:\n        return f\"<{self.__class__.__name__}('{self}')>\"\n\n    def serialize(self) -> str:\n        raise NotImplementedError\n\n\nclass Variable(Node):\n    def serialize(self) -> str:\n        return str(self)\n\n\nclass Value(Node):\n    def serialize(self) -> str:\n        return f'\"{self}\"'\n\n\nclass Op(Node):\n    def serialize(self) -> str:\n        return str(self)\n\n\nMarkerVar = Union[Variable, Value]\nMarkerItem = Tuple[MarkerVar, Op, MarkerVar]\n# MarkerAtom = Union[MarkerItem, List[\"MarkerAtom\"]]\n# MarkerList = List[Union[\"MarkerList\", MarkerAtom, str]]\n# mypy does not support recursive type definition\n# https://github.com/python/mypy/issues/731\nMarkerAtom = Any\nMarkerList = List[Any]\n\n\nclass ParsedRequirement(NamedTuple):\n    name: str\n    url: str\n    extras: List[str]\n    specifier: str\n    marker: Optional[MarkerList]\n\n\n# --------------------------------------------------------------------------------------\n# Recursive descent parser for dependency specifier\n# --------------------------------------------------------------------------------------\ndef parse_requirement(source: str) -> ParsedRequirement:\n    return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))\n\n\ndef _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement:\n    \"\"\"\n    requirement = WS? IDENTIFIER WS? extras WS? requirement_details\n    \"\"\"\n    tokenizer.consume(\"WS\")\n\n    name_token = tokenizer.expect(\n        \"IDENTIFIER\", expected=\"package name at the start of dependency specifier\"\n    )\n    name = name_token.text\n    tokenizer.consume(\"WS\")\n\n    extras = _parse_extras(tokenizer)\n    tokenizer.consume(\"WS\")\n\n    url, specifier, marker = _parse_requirement_details(tokenizer)\n    tokenizer.expect(\"END\", expected=\"end of dependency specifier\")\n\n    return ParsedRequirement(name, url, extras, specifier, marker)\n\n\ndef _parse_requirement_details(\n    tokenizer: Tokenizer,\n) -> Tuple[str, str, Optional[MarkerList]]:\n    \"\"\"\n    requirement_details = AT URL (WS requirement_marker?)?\n                        | specifier WS? (requirement_marker)?\n    \"\"\"\n\n    specifier = \"\"\n    url = \"\"\n    marker = None\n\n    if tokenizer.check(\"AT\"):\n        tokenizer.read()\n        tokenizer.consume(\"WS\")\n\n        url_start = tokenizer.position\n        url = tokenizer.expect(\"URL\", expected=\"URL after @\").text\n        if tokenizer.check(\"END\", peek=True):\n            return (url, specifier, marker)\n\n        tokenizer.expect(\"WS\", expected=\"whitespace after URL\")\n\n        # The input might end after whitespace.\n        if tokenizer.check(\"END\", peek=True):\n            return (url, specifier, marker)\n\n        marker = _parse_requirement_marker(\n            tokenizer, span_start=url_start, after=\"URL and whitespace\"\n        )\n    else:\n        specifier_start = tokenizer.position\n        specifier = _parse_specifier(tokenizer)\n        tokenizer.consume(\"WS\")\n\n        if tokenizer.check(\"END\", peek=True):\n            return (url, specifier, marker)\n\n        marker = _parse_requirement_marker(\n            tokenizer,\n            span_start=specifier_start,\n            after=(\n                \"version specifier\"\n                if specifier\n                else \"name and no valid version specifier\"\n            ),\n        )\n\n    return (url, specifier, marker)\n\n\ndef _parse_requirement_marker(\n    tokenizer: Tokenizer, *, span_start: int, after: str\n) -> MarkerList:\n    \"\"\"\n    requirement_marker = SEMICOLON marker WS?\n    \"\"\"\n\n    if not tokenizer.check(\"SEMICOLON\"):\n        tokenizer.raise_syntax_error(\n            f\"Expected end or semicolon (after {after})\",\n            span_start=span_start,\n        )\n    tokenizer.read()\n\n    marker = _parse_marker(tokenizer)\n    tokenizer.consume(\"WS\")\n\n    return marker\n\n\ndef _parse_extras(tokenizer: Tokenizer) -> List[str]:\n    \"\"\"\n    extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)?\n    \"\"\"\n    if not tokenizer.check(\"LEFT_BRACKET\", peek=True):\n        return []\n\n    with tokenizer.enclosing_tokens(\n        \"LEFT_BRACKET\",\n        \"RIGHT_BRACKET\",\n        around=\"extras\",\n    ):\n        tokenizer.consume(\"WS\")\n        extras = _parse_extras_list(tokenizer)\n        tokenizer.consume(\"WS\")\n\n    return extras\n\n\ndef _parse_extras_list(tokenizer: Tokenizer) -> List[str]:\n    \"\"\"\n    extras_list = identifier (wsp* ',' wsp* identifier)*\n    \"\"\"\n    extras: List[str] = []\n\n    if not tokenizer.check(\"IDENTIFIER\"):\n        return extras\n\n    extras.append(tokenizer.read().text)\n\n    while True:\n        tokenizer.consume(\"WS\")\n        if tokenizer.check(\"IDENTIFIER\", peek=True):\n            tokenizer.raise_syntax_error(\"Expected comma between extra names\")\n        elif not tokenizer.check(\"COMMA\"):\n            break\n\n        tokenizer.read()\n        tokenizer.consume(\"WS\")\n\n        extra_token = tokenizer.expect(\"IDENTIFIER\", expected=\"extra name after comma\")\n        extras.append(extra_token.text)\n\n    return extras\n\n\ndef _parse_specifier(tokenizer: Tokenizer) -> str:\n    \"\"\"\n    specifier = LEFT_PARENTHESIS WS? version_many WS? RIGHT_PARENTHESIS\n              | WS? version_many WS?\n    \"\"\"\n    with tokenizer.enclosing_tokens(\n        \"LEFT_PARENTHESIS\",\n        \"RIGHT_PARENTHESIS\",\n        around=\"version specifier\",\n    ):\n        tokenizer.consume(\"WS\")\n        parsed_specifiers = _parse_version_many(tokenizer)\n        tokenizer.consume(\"WS\")\n\n    return parsed_specifiers\n\n\ndef _parse_version_many(tokenizer: Tokenizer) -> str:\n    \"\"\"\n    version_many = (SPECIFIER (WS? COMMA WS? SPECIFIER)*)?\n    \"\"\"\n    parsed_specifiers = \"\"\n    while tokenizer.check(\"SPECIFIER\"):\n        span_start = tokenizer.position\n        parsed_specifiers += tokenizer.read().text\n        if tokenizer.check(\"VERSION_PREFIX_TRAIL\", peek=True):\n            tokenizer.raise_syntax_error(\n                \".* suffix can only be used with `==` or `!=` operators\",\n                span_start=span_start,\n                span_end=tokenizer.position + 1,\n            )\n        if tokenizer.check(\"VERSION_LOCAL_LABEL_TRAIL\", peek=True):\n            tokenizer.raise_syntax_error(\n                \"Local version label can only be used with `==` or `!=` operators\",\n                span_start=span_start,\n                span_end=tokenizer.position,\n            )\n        tokenizer.consume(\"WS\")\n        if not tokenizer.check(\"COMMA\"):\n            break\n        parsed_specifiers += tokenizer.read().text\n        tokenizer.consume(\"WS\")\n\n    return parsed_specifiers\n\n\n# --------------------------------------------------------------------------------------\n# Recursive descent parser for marker expression\n# --------------------------------------------------------------------------------------\ndef parse_marker(source: str) -> MarkerList:\n    return _parse_full_marker(Tokenizer(source, rules=DEFAULT_RULES))\n\n\ndef _parse_full_marker(tokenizer: Tokenizer) -> MarkerList:\n    retval = _parse_marker(tokenizer)\n    tokenizer.expect(\"END\", expected=\"end of marker expression\")\n    return retval\n\n\ndef _parse_marker(tokenizer: Tokenizer) -> MarkerList:\n    \"\"\"\n    marker = marker_atom (BOOLOP marker_atom)+\n    \"\"\"\n    expression = [_parse_marker_atom(tokenizer)]\n    while tokenizer.check(\"BOOLOP\"):\n        token = tokenizer.read()\n        expr_right = _parse_marker_atom(tokenizer)\n        expression.extend((token.text, expr_right))\n    return expression\n\n\ndef _parse_marker_atom(tokenizer: Tokenizer) -> MarkerAtom:\n    \"\"\"\n    marker_atom = WS? LEFT_PARENTHESIS WS? marker WS? RIGHT_PARENTHESIS WS?\n                | WS? marker_item WS?\n    \"\"\"\n\n    tokenizer.consume(\"WS\")\n    if tokenizer.check(\"LEFT_PARENTHESIS\", peek=True):\n        with tokenizer.enclosing_tokens(\n            \"LEFT_PARENTHESIS\",\n            \"RIGHT_PARENTHESIS\",\n            around=\"marker expression\",\n        ):\n            tokenizer.consume(\"WS\")\n            marker: MarkerAtom = _parse_marker(tokenizer)\n            tokenizer.consume(\"WS\")\n    else:\n        marker = _parse_marker_item(tokenizer)\n    tokenizer.consume(\"WS\")\n    return marker\n\n\ndef _parse_marker_item(tokenizer: Tokenizer) -> MarkerItem:\n    \"\"\"\n    marker_item = WS? marker_var WS? marker_op WS? marker_var WS?\n    \"\"\"\n    tokenizer.consume(\"WS\")\n    marker_var_left = _parse_marker_var(tokenizer)\n    tokenizer.consume(\"WS\")\n    marker_op = _parse_marker_op(tokenizer)\n    tokenizer.consume(\"WS\")\n    marker_var_right = _parse_marker_var(tokenizer)\n    tokenizer.consume(\"WS\")\n    return (marker_var_left, marker_op, marker_var_right)\n\n\ndef _parse_marker_var(tokenizer: Tokenizer) -> MarkerVar:\n    \"\"\"\n    marker_var = VARIABLE | QUOTED_STRING\n    \"\"\"\n    if tokenizer.check(\"VARIABLE\"):\n        return process_env_var(tokenizer.read().text.replace(\".\", \"_\"))\n    elif tokenizer.check(\"QUOTED_STRING\"):\n        return process_python_str(tokenizer.read().text)\n    else:\n        tokenizer.raise_syntax_error(\n            message=\"Expected a marker variable or quoted string\"\n        )\n\n\ndef process_env_var(env_var: str) -> Variable:\n    if (\n        env_var == \"platform_python_implementation\"\n        or env_var == \"python_implementation\"\n    ):\n        return Variable(\"platform_python_implementation\")\n    else:\n        return Variable(env_var)\n\n\ndef process_python_str(python_str: str) -> Value:\n    value = ast.literal_eval(python_str)\n    return Value(str(value))\n\n\ndef _parse_marker_op(tokenizer: Tokenizer) -> Op:\n    \"\"\"\n    marker_op = IN | NOT IN | OP\n    \"\"\"\n    if tokenizer.check(\"IN\"):\n        tokenizer.read()\n        return Op(\"in\")\n    elif tokenizer.check(\"NOT\"):\n        tokenizer.read()\n        tokenizer.expect(\"WS\", expected=\"whitespace after 'not'\")\n        tokenizer.expect(\"IN\", expected=\"'in' after 'not'\")\n        return Op(\"not in\")\n    elif tokenizer.check(\"OP\"):\n        return Op(tokenizer.read().text)\n    else:\n        return tokenizer.raise_syntax_error(\n            \"Expected marker operator, one of \"\n            \"<=, <, !=, ==, >=, >, ~=, ===, in, not in\"\n        )\n"
  },
  {
    "path": "gyp/pylib/packaging/_structures.py",
    "content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\n\nclass InfinityType:\n    def __repr__(self) -> str:\n        return \"Infinity\"\n\n    def __hash__(self) -> int:\n        return hash(repr(self))\n\n    def __lt__(self, other: object) -> bool:\n        return False\n\n    def __le__(self, other: object) -> bool:\n        return False\n\n    def __eq__(self, other: object) -> bool:\n        return isinstance(other, self.__class__)\n\n    def __gt__(self, other: object) -> bool:\n        return True\n\n    def __ge__(self, other: object) -> bool:\n        return True\n\n    def __neg__(self: object) -> \"NegativeInfinityType\":\n        return NegativeInfinity\n\n\nInfinity = InfinityType()\n\n\nclass NegativeInfinityType:\n    def __repr__(self) -> str:\n        return \"-Infinity\"\n\n    def __hash__(self) -> int:\n        return hash(repr(self))\n\n    def __lt__(self, other: object) -> bool:\n        return True\n\n    def __le__(self, other: object) -> bool:\n        return True\n\n    def __eq__(self, other: object) -> bool:\n        return isinstance(other, self.__class__)\n\n    def __gt__(self, other: object) -> bool:\n        return False\n\n    def __ge__(self, other: object) -> bool:\n        return False\n\n    def __neg__(self: object) -> InfinityType:\n        return Infinity\n\n\nNegativeInfinity = NegativeInfinityType()\n"
  },
  {
    "path": "gyp/pylib/packaging/_tokenizer.py",
    "content": "import contextlib\nimport re\nfrom dataclasses import dataclass\nfrom typing import Dict, Iterator, NoReturn, Optional, Tuple, Union\n\nfrom .specifiers import Specifier\n\n\n@dataclass\nclass Token:\n    name: str\n    text: str\n    position: int\n\n\nclass ParserSyntaxError(Exception):\n    \"\"\"The provided source text could not be parsed correctly.\"\"\"\n\n    def __init__(\n        self,\n        message: str,\n        *,\n        source: str,\n        span: Tuple[int, int],\n    ) -> None:\n        self.span = span\n        self.message = message\n        self.source = source\n\n        super().__init__()\n\n    def __str__(self) -> str:\n        marker = \" \" * self.span[0] + \"~\" * (self.span[1] - self.span[0]) + \"^\"\n        return \"\\n    \".join([self.message, self.source, marker])\n\n\nDEFAULT_RULES: \"Dict[str, Union[str, re.Pattern[str]]]\" = {\n    \"LEFT_PARENTHESIS\": r\"\\(\",\n    \"RIGHT_PARENTHESIS\": r\"\\)\",\n    \"LEFT_BRACKET\": r\"\\[\",\n    \"RIGHT_BRACKET\": r\"\\]\",\n    \"SEMICOLON\": r\";\",\n    \"COMMA\": r\",\",\n    \"QUOTED_STRING\": re.compile(\n        r\"\"\"\n            (\n                ('[^']*')\n                |\n                (\"[^\"]*\")\n            )\n        \"\"\",\n        re.VERBOSE,\n    ),\n    \"OP\": r\"(===|==|~=|!=|<=|>=|<|>)\",\n    \"BOOLOP\": r\"\\b(or|and)\\b\",\n    \"IN\": r\"\\bin\\b\",\n    \"NOT\": r\"\\bnot\\b\",\n    \"VARIABLE\": re.compile(\n        r\"\"\"\n            \\b(\n                python_version\n                |python_full_version\n                |os[._]name\n                |sys[._]platform\n                |platform_(release|system)\n                |platform[._](version|machine|python_implementation)\n                |python_implementation\n                |implementation_(name|version)\n                |extra\n            )\\b\n        \"\"\",\n        re.VERBOSE,\n    ),\n    \"SPECIFIER\": re.compile(\n        Specifier._operator_regex_str + Specifier._version_regex_str,\n        re.VERBOSE | re.IGNORECASE,\n    ),\n    \"AT\": r\"\\@\",\n    \"URL\": r\"[^ \\t]+\",\n    \"IDENTIFIER\": r\"\\b[a-zA-Z0-9][a-zA-Z0-9._-]*\\b\",\n    \"VERSION_PREFIX_TRAIL\": r\"\\.\\*\",\n    \"VERSION_LOCAL_LABEL_TRAIL\": r\"\\+[a-z0-9]+(?:[-_\\.][a-z0-9]+)*\",\n    \"WS\": r\"[ \\t]+\",\n    \"END\": r\"$\",\n}\n\n\nclass Tokenizer:\n    \"\"\"Context-sensitive token parsing.\n\n    Provides methods to examine the input stream to check whether the next token\n    matches.\n    \"\"\"\n\n    def __init__(\n        self,\n        source: str,\n        *,\n        rules: \"Dict[str, Union[str, re.Pattern[str]]]\",\n    ) -> None:\n        self.source = source\n        self.rules: Dict[str, re.Pattern[str]] = {\n            name: re.compile(pattern) for name, pattern in rules.items()\n        }\n        self.next_token: Optional[Token] = None\n        self.position = 0\n\n    def consume(self, name: str) -> None:\n        \"\"\"Move beyond provided token name, if at current position.\"\"\"\n        if self.check(name):\n            self.read()\n\n    def check(self, name: str, *, peek: bool = False) -> bool:\n        \"\"\"Check whether the next token has the provided name.\n\n        By default, if the check succeeds, the token *must* be read before\n        another check. If `peek` is set to `True`, the token is not loaded and\n        would need to be checked again.\n        \"\"\"\n        assert (\n            self.next_token is None\n        ), f\"Cannot check for {name!r}, already have {self.next_token!r}\"\n        assert name in self.rules, f\"Unknown token name: {name!r}\"\n\n        expression = self.rules[name]\n\n        match = expression.match(self.source, self.position)\n        if match is None:\n            return False\n        if not peek:\n            self.next_token = Token(name, match[0], self.position)\n        return True\n\n    def expect(self, name: str, *, expected: str) -> Token:\n        \"\"\"Expect a certain token name next, failing with a syntax error otherwise.\n\n        The token is *not* read.\n        \"\"\"\n        if not self.check(name):\n            raise self.raise_syntax_error(f\"Expected {expected}\")\n        return self.read()\n\n    def read(self) -> Token:\n        \"\"\"Consume the next token and return it.\"\"\"\n        token = self.next_token\n        assert token is not None\n\n        self.position += len(token.text)\n        self.next_token = None\n\n        return token\n\n    def raise_syntax_error(\n        self,\n        message: str,\n        *,\n        span_start: Optional[int] = None,\n        span_end: Optional[int] = None,\n    ) -> NoReturn:\n        \"\"\"Raise ParserSyntaxError at the given position.\"\"\"\n        span = (\n            self.position if span_start is None else span_start,\n            self.position if span_end is None else span_end,\n        )\n        raise ParserSyntaxError(\n            message,\n            source=self.source,\n            span=span,\n        )\n\n    @contextlib.contextmanager\n    def enclosing_tokens(\n        self, open_token: str, close_token: str, *, around: str\n    ) -> Iterator[None]:\n        if self.check(open_token):\n            open_position = self.position\n            self.read()\n        else:\n            open_position = None\n\n        yield\n\n        if open_position is None:\n            return\n\n        if not self.check(close_token):\n            self.raise_syntax_error(\n                f\"Expected matching {close_token} for {open_token}, after {around}\",\n                span_start=open_position,\n            )\n\n        self.read()\n"
  },
  {
    "path": "gyp/pylib/packaging/markers.py",
    "content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nimport operator\nimport os\nimport platform\nimport sys\nfrom typing import Any, Callable, Dict, List, Optional, Tuple, Union\n\nfrom ._parser import (\n    MarkerAtom,\n    MarkerList,\n    Op,\n    Value,\n    Variable,\n    parse_marker as _parse_marker,\n)\nfrom ._tokenizer import ParserSyntaxError\nfrom .specifiers import InvalidSpecifier, Specifier\nfrom .utils import canonicalize_name\n\n__all__ = [\n    \"InvalidMarker\",\n    \"UndefinedComparison\",\n    \"UndefinedEnvironmentName\",\n    \"Marker\",\n    \"default_environment\",\n]\n\nOperator = Callable[[str, str], bool]\n\n\nclass InvalidMarker(ValueError):\n    \"\"\"\n    An invalid marker was found, users should refer to PEP 508.\n    \"\"\"\n\n\nclass UndefinedComparison(ValueError):\n    \"\"\"\n    An invalid operation was attempted on a value that doesn't support it.\n    \"\"\"\n\n\nclass UndefinedEnvironmentName(ValueError):\n    \"\"\"\n    A name was attempted to be used that does not exist inside of the\n    environment.\n    \"\"\"\n\n\ndef _normalize_extra_values(results: Any) -> Any:\n    \"\"\"\n    Normalize extra values.\n    \"\"\"\n    if isinstance(results[0], tuple):\n        lhs, op, rhs = results[0]\n        if isinstance(lhs, Variable) and lhs.value == \"extra\":\n            normalized_extra = canonicalize_name(rhs.value)\n            rhs = Value(normalized_extra)\n        elif isinstance(rhs, Variable) and rhs.value == \"extra\":\n            normalized_extra = canonicalize_name(lhs.value)\n            lhs = Value(normalized_extra)\n        results[0] = lhs, op, rhs\n    return results\n\n\ndef _format_marker(\n    marker: Union[List[str], MarkerAtom, str], first: Optional[bool] = True\n) -> str:\n\n    assert isinstance(marker, (list, tuple, str))\n\n    # Sometimes we have a structure like [[...]] which is a single item list\n    # where the single item is itself it's own list. In that case we want skip\n    # the rest of this function so that we don't get extraneous () on the\n    # outside.\n    if (\n        isinstance(marker, list)\n        and len(marker) == 1\n        and isinstance(marker[0], (list, tuple))\n    ):\n        return _format_marker(marker[0])\n\n    if isinstance(marker, list):\n        inner = (_format_marker(m, first=False) for m in marker)\n        if first:\n            return \" \".join(inner)\n        else:\n            return \"(\" + \" \".join(inner) + \")\"\n    elif isinstance(marker, tuple):\n        return \" \".join([m.serialize() for m in marker])\n    else:\n        return marker\n\n\n_operators: Dict[str, Operator] = {\n    \"in\": lambda lhs, rhs: lhs in rhs,\n    \"not in\": lambda lhs, rhs: lhs not in rhs,\n    \"<\": operator.lt,\n    \"<=\": operator.le,\n    \"==\": operator.eq,\n    \"!=\": operator.ne,\n    \">=\": operator.ge,\n    \">\": operator.gt,\n}\n\n\ndef _eval_op(lhs: str, op: Op, rhs: str) -> bool:\n    try:\n        spec = Specifier(\"\".join([op.serialize(), rhs]))\n    except InvalidSpecifier:\n        pass\n    else:\n        return spec.contains(lhs, prereleases=True)\n\n    oper: Optional[Operator] = _operators.get(op.serialize())\n    if oper is None:\n        raise UndefinedComparison(f\"Undefined {op!r} on {lhs!r} and {rhs!r}.\")\n\n    return oper(lhs, rhs)\n\n\ndef _normalize(*values: str, key: str) -> Tuple[str, ...]:\n    # PEP 685 – Comparison of extra names for optional distribution dependencies\n    # https://peps.python.org/pep-0685/\n    # > When comparing extra names, tools MUST normalize the names being\n    # > compared using the semantics outlined in PEP 503 for names\n    if key == \"extra\":\n        return tuple(canonicalize_name(v) for v in values)\n\n    # other environment markers don't have such standards\n    return values\n\n\ndef _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool:\n    groups: List[List[bool]] = [[]]\n\n    for marker in markers:\n        assert isinstance(marker, (list, tuple, str))\n\n        if isinstance(marker, list):\n            groups[-1].append(_evaluate_markers(marker, environment))\n        elif isinstance(marker, tuple):\n            lhs, op, rhs = marker\n\n            if isinstance(lhs, Variable):\n                environment_key = lhs.value\n                lhs_value = environment[environment_key]\n                rhs_value = rhs.value\n            else:\n                lhs_value = lhs.value\n                environment_key = rhs.value\n                rhs_value = environment[environment_key]\n\n            lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key)\n            groups[-1].append(_eval_op(lhs_value, op, rhs_value))\n        else:\n            assert marker in [\"and\", \"or\"]\n            if marker == \"or\":\n                groups.append([])\n\n    return any(all(item) for item in groups)\n\n\ndef format_full_version(info: \"sys._version_info\") -> str:\n    version = \"{0.major}.{0.minor}.{0.micro}\".format(info)\n    if (kind := info.releaselevel) != \"final\":\n        version += kind[0] + str(info.serial)\n    return version\n\n\ndef default_environment() -> Dict[str, str]:\n    iver = format_full_version(sys.implementation.version)\n    implementation_name = sys.implementation.name\n    return {\n        \"implementation_name\": implementation_name,\n        \"implementation_version\": iver,\n        \"os_name\": os.name,\n        \"platform_machine\": platform.machine(),\n        \"platform_release\": platform.release(),\n        \"platform_system\": platform.system(),\n        \"platform_version\": platform.version(),\n        \"python_full_version\": platform.python_version(),\n        \"platform_python_implementation\": platform.python_implementation(),\n        \"python_version\": \".\".join(platform.python_version_tuple()[:2]),\n        \"sys_platform\": sys.platform,\n    }\n\n\nclass Marker:\n    def __init__(self, marker: str) -> None:\n        # Note: We create a Marker object without calling this constructor in\n        #       packaging.requirements.Requirement. If any additional logic is\n        #       added here, make sure to mirror/adapt Requirement.\n        try:\n            self._markers = _normalize_extra_values(_parse_marker(marker))\n            # The attribute `_markers` can be described in terms of a recursive type:\n            # MarkerList = List[Union[Tuple[Node, ...], str, MarkerList]]\n            #\n            # For example, the following expression:\n            # python_version > \"3.6\" or (python_version == \"3.6\" and os_name == \"unix\")\n            #\n            # is parsed into:\n            # [\n            #     (<Variable('python_version')>, <Op('>')>, <Value('3.6')>),\n            #     'and',\n            #     [\n            #         (<Variable('python_version')>, <Op('==')>, <Value('3.6')>),\n            #         'or',\n            #         (<Variable('os_name')>, <Op('==')>, <Value('unix')>)\n            #     ]\n            # ]\n        except ParserSyntaxError as e:\n            raise InvalidMarker(str(e)) from e\n\n    def __str__(self) -> str:\n        return _format_marker(self._markers)\n\n    def __repr__(self) -> str:\n        return f\"<Marker('{self}')>\"\n\n    def __hash__(self) -> int:\n        return hash((self.__class__.__name__, str(self)))\n\n    def __eq__(self, other: Any) -> bool:\n        if not isinstance(other, Marker):\n            return NotImplemented\n\n        return str(self) == str(other)\n\n    def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool:\n        \"\"\"Evaluate a marker.\n\n        Return the boolean from evaluating the given marker against the\n        environment. environment is an optional argument to override all or\n        part of the determined environment.\n\n        The environment is determined from the current Python process.\n        \"\"\"\n        current_environment = default_environment()\n        current_environment[\"extra\"] = \"\"\n        if environment is not None:\n            current_environment.update(environment)\n            # The API used to allow setting extra to None. We need to handle this\n            # case for backwards compatibility.\n            if current_environment[\"extra\"] is None:\n                current_environment[\"extra\"] = \"\"\n\n        return _evaluate_markers(self._markers, current_environment)\n"
  },
  {
    "path": "gyp/pylib/packaging/metadata.py",
    "content": "import email.feedparser\nimport email.header\nimport email.message\nimport email.parser\nimport email.policy\nimport sys\nimport typing\nfrom typing import (\n    Any,\n    Callable,\n    Dict,\n    Generic,\n    List,\n    Optional,\n    Tuple,\n    Type,\n    Union,\n    cast,\n)\n\nfrom . import requirements, specifiers, utils, version as version_module\n\nT = typing.TypeVar(\"T\")\nif sys.version_info[:2] >= (3, 8):  # pragma: no cover\n    from typing import Literal, TypedDict\nelse:  # pragma: no cover\n    if typing.TYPE_CHECKING:\n        from typing_extensions import Literal, TypedDict\n    else:\n        try:\n            from typing_extensions import Literal, TypedDict\n        except ImportError:\n\n            class Literal:\n                def __init_subclass__(*_args, **_kwargs):\n                    pass\n\n            class TypedDict:\n                def __init_subclass__(*_args, **_kwargs):\n                    pass\n\n\ntry:\n    ExceptionGroup\nexcept NameError:  # pragma: no cover\n\n    class ExceptionGroup(Exception):  # noqa: N818\n        \"\"\"A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11.\n\n        If :external:exc:`ExceptionGroup` is already defined by Python itself,\n        that version is used instead.\n        \"\"\"\n\n        message: str\n        exceptions: List[Exception]\n\n        def __init__(self, message: str, exceptions: List[Exception]) -> None:\n            self.message = message\n            self.exceptions = exceptions\n\n        def __repr__(self) -> str:\n            return f\"{self.__class__.__name__}({self.message!r}, {self.exceptions!r})\"\n\nelse:  # pragma: no cover\n    ExceptionGroup = ExceptionGroup\n\n\nclass InvalidMetadata(ValueError):\n    \"\"\"A metadata field contains invalid data.\"\"\"\n\n    field: str\n    \"\"\"The name of the field that contains invalid data.\"\"\"\n\n    def __init__(self, field: str, message: str) -> None:\n        self.field = field\n        super().__init__(message)\n\n\n# The RawMetadata class attempts to make as few assumptions about the underlying\n# serialization formats as possible. The idea is that as long as a serialization\n# formats offer some very basic primitives in *some* way then we can support\n# serializing to and from that format.\nclass RawMetadata(TypedDict, total=False):\n    \"\"\"A dictionary of raw core metadata.\n\n    Each field in core metadata maps to a key of this dictionary (when data is\n    provided). The key is lower-case and underscores are used instead of dashes\n    compared to the equivalent core metadata field. Any core metadata field that\n    can be specified multiple times or can hold multiple values in a single\n    field have a key with a plural name. See :class:`Metadata` whose attributes\n    match the keys of this dictionary.\n\n    Core metadata fields that can be specified multiple times are stored as a\n    list or dict depending on which is appropriate for the field. Any fields\n    which hold multiple values in a single field are stored as a list.\n\n    \"\"\"\n\n    # Metadata 1.0 - PEP 241\n    metadata_version: str\n    name: str\n    version: str\n    platforms: List[str]\n    summary: str\n    description: str\n    keywords: List[str]\n    home_page: str\n    author: str\n    author_email: str\n    license: str\n\n    # Metadata 1.1 - PEP 314\n    supported_platforms: List[str]\n    download_url: str\n    classifiers: List[str]\n    requires: List[str]\n    provides: List[str]\n    obsoletes: List[str]\n\n    # Metadata 1.2 - PEP 345\n    maintainer: str\n    maintainer_email: str\n    requires_dist: List[str]\n    provides_dist: List[str]\n    obsoletes_dist: List[str]\n    requires_python: str\n    requires_external: List[str]\n    project_urls: Dict[str, str]\n\n    # Metadata 2.0\n    # PEP 426 attempted to completely revamp the metadata format\n    # but got stuck without ever being able to build consensus on\n    # it and ultimately ended up withdrawn.\n    #\n    # However, a number of tools had started emitting METADATA with\n    # `2.0` Metadata-Version, so for historical reasons, this version\n    # was skipped.\n\n    # Metadata 2.1 - PEP 566\n    description_content_type: str\n    provides_extra: List[str]\n\n    # Metadata 2.2 - PEP 643\n    dynamic: List[str]\n\n    # Metadata 2.3 - PEP 685\n    # No new fields were added in PEP 685, just some edge case were\n    # tightened up to provide better interoperability.\n\n\n_STRING_FIELDS = {\n    \"author\",\n    \"author_email\",\n    \"description\",\n    \"description_content_type\",\n    \"download_url\",\n    \"home_page\",\n    \"license\",\n    \"maintainer\",\n    \"maintainer_email\",\n    \"metadata_version\",\n    \"name\",\n    \"requires_python\",\n    \"summary\",\n    \"version\",\n}\n\n_LIST_FIELDS = {\n    \"classifiers\",\n    \"dynamic\",\n    \"obsoletes\",\n    \"obsoletes_dist\",\n    \"platforms\",\n    \"provides\",\n    \"provides_dist\",\n    \"provides_extra\",\n    \"requires\",\n    \"requires_dist\",\n    \"requires_external\",\n    \"supported_platforms\",\n}\n\n_DICT_FIELDS = {\n    \"project_urls\",\n}\n\n\ndef _parse_keywords(data: str) -> List[str]:\n    \"\"\"Split a string of comma-separate keyboards into a list of keywords.\"\"\"\n    return [k.strip() for k in data.split(\",\")]\n\n\ndef _parse_project_urls(data: List[str]) -> Dict[str, str]:\n    \"\"\"Parse a list of label/URL string pairings separated by a comma.\"\"\"\n    urls = {}\n    for pair in data:\n        # Our logic is slightly tricky here as we want to try and do\n        # *something* reasonable with malformed data.\n        #\n        # The main thing that we have to worry about, is data that does\n        # not have a ',' at all to split the label from the Value. There\n        # isn't a singular right answer here, and we will fail validation\n        # later on (if the caller is validating) so it doesn't *really*\n        # matter, but since the missing value has to be an empty str\n        # and our return value is dict[str, str], if we let the key\n        # be the missing value, then they'd have multiple '' values that\n        # overwrite each other in a accumulating dict.\n        #\n        # The other potential issue is that it's possible to have the\n        # same label multiple times in the metadata, with no solid \"right\"\n        # answer with what to do in that case. As such, we'll do the only\n        # thing we can, which is treat the field as unparsable and add it\n        # to our list of unparsed fields.\n        parts = [p.strip() for p in pair.split(\",\", 1)]\n        parts.extend([\"\"] * (max(0, 2 - len(parts))))  # Ensure 2 items\n\n        # TODO: The spec doesn't say anything about if the keys should be\n        #       considered case sensitive or not... logically they should\n        #       be case-preserving and case-insensitive, but doing that\n        #       would open up more cases where we might have duplicate\n        #       entries.\n        label, url = parts\n        if label in urls:\n            # The label already exists in our set of urls, so this field\n            # is unparsable, and we can just add the whole thing to our\n            # unparsable data and stop processing it.\n            raise KeyError(\"duplicate labels in project urls\")\n        urls[label] = url\n\n    return urls\n\n\ndef _get_payload(msg: email.message.Message, source: Union[bytes, str]) -> str:\n    \"\"\"Get the body of the message.\"\"\"\n    # If our source is a str, then our caller has managed encodings for us,\n    # and we don't need to deal with it.\n    if isinstance(source, str):\n        payload: str = msg.get_payload()\n        return payload\n    # If our source is a bytes, then we're managing the encoding and we need\n    # to deal with it.\n    else:\n        bpayload: bytes = msg.get_payload(decode=True)\n        try:\n            return bpayload.decode(\"utf8\", \"strict\")\n        except UnicodeDecodeError:\n            raise ValueError(\"payload in an invalid encoding\")\n\n\n# The various parse_FORMAT functions here are intended to be as lenient as\n# possible in their parsing, while still returning a correctly typed\n# RawMetadata.\n#\n# To aid in this, we also generally want to do as little touching of the\n# data as possible, except where there are possibly some historic holdovers\n# that make valid data awkward to work with.\n#\n# While this is a lower level, intermediate format than our ``Metadata``\n# class, some light touch ups can make a massive difference in usability.\n\n# Map METADATA fields to RawMetadata.\n_EMAIL_TO_RAW_MAPPING = {\n    \"author\": \"author\",\n    \"author-email\": \"author_email\",\n    \"classifier\": \"classifiers\",\n    \"description\": \"description\",\n    \"description-content-type\": \"description_content_type\",\n    \"download-url\": \"download_url\",\n    \"dynamic\": \"dynamic\",\n    \"home-page\": \"home_page\",\n    \"keywords\": \"keywords\",\n    \"license\": \"license\",\n    \"maintainer\": \"maintainer\",\n    \"maintainer-email\": \"maintainer_email\",\n    \"metadata-version\": \"metadata_version\",\n    \"name\": \"name\",\n    \"obsoletes\": \"obsoletes\",\n    \"obsoletes-dist\": \"obsoletes_dist\",\n    \"platform\": \"platforms\",\n    \"project-url\": \"project_urls\",\n    \"provides\": \"provides\",\n    \"provides-dist\": \"provides_dist\",\n    \"provides-extra\": \"provides_extra\",\n    \"requires\": \"requires\",\n    \"requires-dist\": \"requires_dist\",\n    \"requires-external\": \"requires_external\",\n    \"requires-python\": \"requires_python\",\n    \"summary\": \"summary\",\n    \"supported-platform\": \"supported_platforms\",\n    \"version\": \"version\",\n}\n_RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()}\n\n\ndef parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[str]]]:\n    \"\"\"Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``).\n\n    This function returns a two-item tuple of dicts. The first dict is of\n    recognized fields from the core metadata specification. Fields that can be\n    parsed and translated into Python's built-in types are converted\n    appropriately. All other fields are left as-is. Fields that are allowed to\n    appear multiple times are stored as lists.\n\n    The second dict contains all other fields from the metadata. This includes\n    any unrecognized fields. It also includes any fields which are expected to\n    be parsed into a built-in type but were not formatted appropriately. Finally,\n    any fields that are expected to appear only once but are repeated are\n    included in this dict.\n\n    \"\"\"\n    raw: Dict[str, Union[str, List[str], Dict[str, str]]] = {}\n    unparsed: Dict[str, List[str]] = {}\n\n    if isinstance(data, str):\n        parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data)\n    else:\n        parsed = email.parser.BytesParser(policy=email.policy.compat32).parsebytes(data)\n\n    # We have to wrap parsed.keys() in a set, because in the case of multiple\n    # values for a key (a list), the key will appear multiple times in the\n    # list of keys, but we're avoiding that by using get_all().\n    for name in frozenset(parsed.keys()):\n        # Header names in RFC are case insensitive, so we'll normalize to all\n        # lower case to make comparisons easier.\n        name = name.lower()\n\n        # We use get_all() here, even for fields that aren't multiple use,\n        # because otherwise someone could have e.g. two Name fields, and we\n        # would just silently ignore it rather than doing something about it.\n        headers = parsed.get_all(name) or []\n\n        # The way the email module works when parsing bytes is that it\n        # unconditionally decodes the bytes as ascii using the surrogateescape\n        # handler. When you pull that data back out (such as with get_all() ),\n        # it looks to see if the str has any surrogate escapes, and if it does\n        # it wraps it in a Header object instead of returning the string.\n        #\n        # As such, we'll look for those Header objects, and fix up the encoding.\n        value = []\n        # Flag if we have run into any issues processing the headers, thus\n        # signalling that the data belongs in 'unparsed'.\n        valid_encoding = True\n        for h in headers:\n            # It's unclear if this can return more types than just a Header or\n            # a str, so we'll just assert here to make sure.\n            assert isinstance(h, (email.header.Header, str))\n\n            # If it's a header object, we need to do our little dance to get\n            # the real data out of it. In cases where there is invalid data\n            # we're going to end up with mojibake, but there's no obvious, good\n            # way around that without reimplementing parts of the Header object\n            # ourselves.\n            #\n            # That should be fine since, if mojibacked happens, this key is\n            # going into the unparsed dict anyways.\n            if isinstance(h, email.header.Header):\n                # The Header object stores it's data as chunks, and each chunk\n                # can be independently encoded, so we'll need to check each\n                # of them.\n                chunks: List[Tuple[bytes, Optional[str]]] = []\n                for bin, encoding in email.header.decode_header(h):\n                    try:\n                        bin.decode(\"utf8\", \"strict\")\n                    except UnicodeDecodeError:\n                        # Enable mojibake.\n                        encoding = \"latin1\"\n                        valid_encoding = False\n                    else:\n                        encoding = \"utf8\"\n                    chunks.append((bin, encoding))\n\n                # Turn our chunks back into a Header object, then let that\n                # Header object do the right thing to turn them into a\n                # string for us.\n                value.append(str(email.header.make_header(chunks)))\n            # This is already a string, so just add it.\n            else:\n                value.append(h)\n\n        # We've processed all of our values to get them into a list of str,\n        # but we may have mojibake data, in which case this is an unparsed\n        # field.\n        if not valid_encoding:\n            unparsed[name] = value\n            continue\n\n        raw_name = _EMAIL_TO_RAW_MAPPING.get(name)\n        if raw_name is None:\n            # This is a bit of a weird situation, we've encountered a key that\n            # we don't know what it means, so we don't know whether it's meant\n            # to be a list or not.\n            #\n            # Since we can't really tell one way or another, we'll just leave it\n            # as a list, even though it may be a single item list, because that's\n            # what makes the most sense for email headers.\n            unparsed[name] = value\n            continue\n\n        # If this is one of our string fields, then we'll check to see if our\n        # value is a list of a single item. If it is then we'll assume that\n        # it was emitted as a single string, and unwrap the str from inside\n        # the list.\n        #\n        # If it's any other kind of data, then we haven't the faintest clue\n        # what we should parse it as, and we have to just add it to our list\n        # of unparsed stuff.\n        if raw_name in _STRING_FIELDS and len(value) == 1:\n            raw[raw_name] = value[0]\n        # If this is one of our list of string fields, then we can just assign\n        # the value, since email *only* has strings, and our get_all() call\n        # above ensures that this is a list.\n        elif raw_name in _LIST_FIELDS:\n            raw[raw_name] = value\n        # Special Case: Keywords\n        # The keywords field is implemented in the metadata spec as a str,\n        # but it conceptually is a list of strings, and is serialized using\n        # \", \".join(keywords), so we'll do some light data massaging to turn\n        # this into what it logically is.\n        elif raw_name == \"keywords\" and len(value) == 1:\n            raw[raw_name] = _parse_keywords(value[0])\n        # Special Case: Project-URL\n        # The project urls is implemented in the metadata spec as a list of\n        # specially-formatted strings that represent a key and a value, which\n        # is fundamentally a mapping, however the email format doesn't support\n        # mappings in a sane way, so it was crammed into a list of strings\n        # instead.\n        #\n        # We will do a little light data massaging to turn this into a map as\n        # it logically should be.\n        elif raw_name == \"project_urls\":\n            try:\n                raw[raw_name] = _parse_project_urls(value)\n            except KeyError:\n                unparsed[name] = value\n        # Nothing that we've done has managed to parse this, so it'll just\n        # throw it in our unparsable data and move on.\n        else:\n            unparsed[name] = value\n\n    # We need to support getting the Description from the message payload in\n    # addition to getting it from the the headers. This does mean, though, there\n    # is the possibility of it being set both ways, in which case we put both\n    # in 'unparsed' since we don't know which is right.\n    try:\n        payload = _get_payload(parsed, data)\n    except ValueError:\n        unparsed.setdefault(\"description\", []).append(\n            parsed.get_payload(decode=isinstance(data, bytes))\n        )\n    else:\n        if payload:\n            # Check to see if we've already got a description, if so then both\n            # it, and this body move to unparsable.\n            if \"description\" in raw:\n                description_header = cast(str, raw.pop(\"description\"))\n                unparsed.setdefault(\"description\", []).extend(\n                    [description_header, payload]\n                )\n            elif \"description\" in unparsed:\n                unparsed[\"description\"].append(payload)\n            else:\n                raw[\"description\"] = payload\n\n    # We need to cast our `raw` to a metadata, because a TypedDict only support\n    # literal key names, but we're computing our key names on purpose, but the\n    # way this function is implemented, our `TypedDict` can only have valid key\n    # names.\n    return cast(RawMetadata, raw), unparsed\n\n\n_NOT_FOUND = object()\n\n\n# Keep the two values in sync.\n_VALID_METADATA_VERSIONS = [\"1.0\", \"1.1\", \"1.2\", \"2.1\", \"2.2\", \"2.3\"]\n_MetadataVersion = Literal[\"1.0\", \"1.1\", \"1.2\", \"2.1\", \"2.2\", \"2.3\"]\n\n_REQUIRED_ATTRS = frozenset([\"metadata_version\", \"name\", \"version\"])\n\n\nclass _Validator(Generic[T]):\n    \"\"\"Validate a metadata field.\n\n    All _process_*() methods correspond to a core metadata field. The method is\n    called with the field's raw value. If the raw value is valid it is returned\n    in its \"enriched\" form (e.g. ``version.Version`` for the ``Version`` field).\n    If the raw value is invalid, :exc:`InvalidMetadata` is raised (with a cause\n    as appropriate).\n    \"\"\"\n\n    name: str\n    raw_name: str\n    added: _MetadataVersion\n\n    def __init__(\n        self,\n        *,\n        added: _MetadataVersion = \"1.0\",\n    ) -> None:\n        self.added = added\n\n    def __set_name__(self, _owner: \"Metadata\", name: str) -> None:\n        self.name = name\n        self.raw_name = _RAW_TO_EMAIL_MAPPING[name]\n\n    def __get__(self, instance: \"Metadata\", _owner: Type[\"Metadata\"]) -> T:\n        # With Python 3.8, the caching can be replaced with functools.cached_property().\n        # No need to check the cache as attribute lookup will resolve into the\n        # instance's __dict__ before __get__ is called.\n        cache = instance.__dict__\n        value = instance._raw.get(self.name)\n\n        # To make the _process_* methods easier, we'll check if the value is None\n        # and if this field is NOT a required attribute, and if both of those\n        # things are true, we'll skip the the converter. This will mean that the\n        # converters never have to deal with the None union.\n        if self.name in _REQUIRED_ATTRS or value is not None:\n            try:\n                converter: Callable[[Any], T] = getattr(self, f\"_process_{self.name}\")\n            except AttributeError:\n                pass\n            else:\n                value = converter(value)\n\n        cache[self.name] = value\n        try:\n            del instance._raw[self.name]  # type: ignore[misc]\n        except KeyError:\n            pass\n\n        return cast(T, value)\n\n    def _invalid_metadata(\n        self, msg: str, cause: Optional[Exception] = None\n    ) -> InvalidMetadata:\n        exc = InvalidMetadata(\n            self.raw_name, msg.format_map({\"field\": repr(self.raw_name)})\n        )\n        exc.__cause__ = cause\n        return exc\n\n    def _process_metadata_version(self, value: str) -> _MetadataVersion:\n        # Implicitly makes Metadata-Version required.\n        if value not in _VALID_METADATA_VERSIONS:\n            raise self._invalid_metadata(f\"{value!r} is not a valid metadata version\")\n        return cast(_MetadataVersion, value)\n\n    def _process_name(self, value: str) -> str:\n        if not value:\n            raise self._invalid_metadata(\"{field} is a required field\")\n        # Validate the name as a side-effect.\n        try:\n            utils.canonicalize_name(value, validate=True)\n        except utils.InvalidName as exc:\n            raise self._invalid_metadata(\n                f\"{value!r} is invalid for {{field}}\", cause=exc\n            )\n        else:\n            return value\n\n    def _process_version(self, value: str) -> version_module.Version:\n        if not value:\n            raise self._invalid_metadata(\"{field} is a required field\")\n        try:\n            return version_module.parse(value)\n        except version_module.InvalidVersion as exc:\n            raise self._invalid_metadata(\n                f\"{value!r} is invalid for {{field}}\", cause=exc\n            )\n\n    def _process_summary(self, value: str) -> str:\n        \"\"\"Check the field contains no newlines.\"\"\"\n        if \"\\n\" in value:\n            raise self._invalid_metadata(\"{field} must be a single line\")\n        return value\n\n    def _process_description_content_type(self, value: str) -> str:\n        content_types = {\"text/plain\", \"text/x-rst\", \"text/markdown\"}\n        message = email.message.EmailMessage()\n        message[\"content-type\"] = value\n\n        content_type, parameters = (\n            # Defaults to `text/plain` if parsing failed.\n            message.get_content_type().lower(),\n            message[\"content-type\"].params,\n        )\n        # Check if content-type is valid or defaulted to `text/plain` and thus was\n        # not parseable.\n        if content_type not in content_types or content_type not in value.lower():\n            raise self._invalid_metadata(\n                f\"{{field}} must be one of {list(content_types)}, not {value!r}\"\n            )\n\n        if (charset := parameters.get(\"charset\", \"UTF-8\")) != \"UTF-8\":\n            raise self._invalid_metadata(\n                f\"{{field}} can only specify the UTF-8 charset, not {list(charset)}\"\n            )\n\n        markdown_variants = {\"GFM\", \"CommonMark\"}\n        variant = parameters.get(\"variant\", \"GFM\")  # Use an acceptable default.\n        if content_type == \"text/markdown\" and variant not in markdown_variants:\n            raise self._invalid_metadata(\n                f\"valid Markdown variants for {{field}} are {list(markdown_variants)}, \"\n                f\"not {variant!r}\",\n            )\n        return value\n\n    def _process_dynamic(self, value: List[str]) -> List[str]:\n        for dynamic_field in map(str.lower, value):\n            if dynamic_field in {\"name\", \"version\", \"metadata-version\"}:\n                raise self._invalid_metadata(\n                    f\"{value!r} is not allowed as a dynamic field\"\n                )\n            elif dynamic_field not in _EMAIL_TO_RAW_MAPPING:\n                raise self._invalid_metadata(f\"{value!r} is not a valid dynamic field\")\n        return list(map(str.lower, value))\n\n    def _process_provides_extra(\n        self,\n        value: List[str],\n    ) -> List[utils.NormalizedName]:\n        normalized_names = []\n        try:\n            for name in value:\n                normalized_names.append(utils.canonicalize_name(name, validate=True))\n        except utils.InvalidName as exc:\n            raise self._invalid_metadata(\n                f\"{name!r} is invalid for {{field}}\", cause=exc\n            )\n        else:\n            return normalized_names\n\n    def _process_requires_python(self, value: str) -> specifiers.SpecifierSet:\n        try:\n            return specifiers.SpecifierSet(value)\n        except specifiers.InvalidSpecifier as exc:\n            raise self._invalid_metadata(\n                f\"{value!r} is invalid for {{field}}\", cause=exc\n            )\n\n    def _process_requires_dist(\n        self,\n        value: List[str],\n    ) -> List[requirements.Requirement]:\n        reqs = []\n        try:\n            for req in value:\n                reqs.append(requirements.Requirement(req))\n        except requirements.InvalidRequirement as exc:\n            raise self._invalid_metadata(f\"{req!r} is invalid for {{field}}\", cause=exc)\n        else:\n            return reqs\n\n\nclass Metadata:\n    \"\"\"Representation of distribution metadata.\n\n    Compared to :class:`RawMetadata`, this class provides objects representing\n    metadata fields instead of only using built-in types. Any invalid metadata\n    will cause :exc:`InvalidMetadata` to be raised (with a\n    :py:attr:`~BaseException.__cause__` attribute as appropriate).\n    \"\"\"\n\n    _raw: RawMetadata\n\n    @classmethod\n    def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> \"Metadata\":\n        \"\"\"Create an instance from :class:`RawMetadata`.\n\n        If *validate* is true, all metadata will be validated. All exceptions\n        related to validation will be gathered and raised as an :class:`ExceptionGroup`.\n        \"\"\"\n        ins = cls()\n        ins._raw = data.copy()  # Mutations occur due to caching enriched values.\n\n        if validate:\n            exceptions: List[Exception] = []\n            try:\n                metadata_version = ins.metadata_version\n                metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version)\n            except InvalidMetadata as metadata_version_exc:\n                exceptions.append(metadata_version_exc)\n                metadata_version = None\n\n            # Make sure to check for the fields that are present, the required\n            # fields (so their absence can be reported).\n            fields_to_check = frozenset(ins._raw) | _REQUIRED_ATTRS\n            # Remove fields that have already been checked.\n            fields_to_check -= {\"metadata_version\"}\n\n            for key in fields_to_check:\n                try:\n                    if metadata_version:\n                        # Can't use getattr() as that triggers descriptor protocol which\n                        # will fail due to no value for the instance argument.\n                        try:\n                            field_metadata_version = cls.__dict__[key].added\n                        except KeyError:\n                            exc = InvalidMetadata(key, f\"unrecognized field: {key!r}\")\n                            exceptions.append(exc)\n                            continue\n                        field_age = _VALID_METADATA_VERSIONS.index(\n                            field_metadata_version\n                        )\n                        if field_age > metadata_age:\n                            field = _RAW_TO_EMAIL_MAPPING[key]\n                            exc = InvalidMetadata(\n                                field,\n                                \"{field} introduced in metadata version \"\n                                \"{field_metadata_version}, not {metadata_version}\",\n                            )\n                            exceptions.append(exc)\n                            continue\n                    getattr(ins, key)\n                except InvalidMetadata as exc:\n                    exceptions.append(exc)\n\n            if exceptions:\n                raise ExceptionGroup(\"invalid metadata\", exceptions)\n\n        return ins\n\n    @classmethod\n    def from_email(\n        cls, data: Union[bytes, str], *, validate: bool = True\n    ) -> \"Metadata\":\n        \"\"\"Parse metadata from email headers.\n\n        If *validate* is true, the metadata will be validated. All exceptions\n        related to validation will be gathered and raised as an :class:`ExceptionGroup`.\n        \"\"\"\n        raw, unparsed = parse_email(data)\n\n        if validate:\n            exceptions: list[Exception] = []\n            for unparsed_key in unparsed:\n                if unparsed_key in _EMAIL_TO_RAW_MAPPING:\n                    message = f\"{unparsed_key!r} has invalid data\"\n                else:\n                    message = f\"unrecognized field: {unparsed_key!r}\"\n                exceptions.append(InvalidMetadata(unparsed_key, message))\n\n            if exceptions:\n                raise ExceptionGroup(\"unparsed\", exceptions)\n\n        try:\n            return cls.from_raw(raw, validate=validate)\n        except ExceptionGroup as exc_group:\n            raise ExceptionGroup(\n                \"invalid or unparsed metadata\", exc_group.exceptions\n            ) from None\n\n    metadata_version: _Validator[_MetadataVersion] = _Validator()\n    \"\"\":external:ref:`core-metadata-metadata-version`\n    (required; validated to be a valid metadata version)\"\"\"\n    name: _Validator[str] = _Validator()\n    \"\"\":external:ref:`core-metadata-name`\n    (required; validated using :func:`~packaging.utils.canonicalize_name` and its\n    *validate* parameter)\"\"\"\n    version: _Validator[version_module.Version] = _Validator()\n    \"\"\":external:ref:`core-metadata-version` (required)\"\"\"\n    dynamic: _Validator[Optional[List[str]]] = _Validator(\n        added=\"2.2\",\n    )\n    \"\"\":external:ref:`core-metadata-dynamic`\n    (validated against core metadata field names and lowercased)\"\"\"\n    platforms: _Validator[Optional[List[str]]] = _Validator()\n    \"\"\":external:ref:`core-metadata-platform`\"\"\"\n    supported_platforms: _Validator[Optional[List[str]]] = _Validator(added=\"1.1\")\n    \"\"\":external:ref:`core-metadata-supported-platform`\"\"\"\n    summary: _Validator[Optional[str]] = _Validator()\n    \"\"\":external:ref:`core-metadata-summary` (validated to contain no newlines)\"\"\"\n    description: _Validator[Optional[str]] = _Validator()  # TODO 2.1: can be in body\n    \"\"\":external:ref:`core-metadata-description`\"\"\"\n    description_content_type: _Validator[Optional[str]] = _Validator(added=\"2.1\")\n    \"\"\":external:ref:`core-metadata-description-content-type` (validated)\"\"\"\n    keywords: _Validator[Optional[List[str]]] = _Validator()\n    \"\"\":external:ref:`core-metadata-keywords`\"\"\"\n    home_page: _Validator[Optional[str]] = _Validator()\n    \"\"\":external:ref:`core-metadata-home-page`\"\"\"\n    download_url: _Validator[Optional[str]] = _Validator(added=\"1.1\")\n    \"\"\":external:ref:`core-metadata-download-url`\"\"\"\n    author: _Validator[Optional[str]] = _Validator()\n    \"\"\":external:ref:`core-metadata-author`\"\"\"\n    author_email: _Validator[Optional[str]] = _Validator()\n    \"\"\":external:ref:`core-metadata-author-email`\"\"\"\n    maintainer: _Validator[Optional[str]] = _Validator(added=\"1.2\")\n    \"\"\":external:ref:`core-metadata-maintainer`\"\"\"\n    maintainer_email: _Validator[Optional[str]] = _Validator(added=\"1.2\")\n    \"\"\":external:ref:`core-metadata-maintainer-email`\"\"\"\n    license: _Validator[Optional[str]] = _Validator()\n    \"\"\":external:ref:`core-metadata-license`\"\"\"\n    classifiers: _Validator[Optional[List[str]]] = _Validator(added=\"1.1\")\n    \"\"\":external:ref:`core-metadata-classifier`\"\"\"\n    requires_dist: _Validator[Optional[List[requirements.Requirement]]] = _Validator(\n        added=\"1.2\"\n    )\n    \"\"\":external:ref:`core-metadata-requires-dist`\"\"\"\n    requires_python: _Validator[Optional[specifiers.SpecifierSet]] = _Validator(\n        added=\"1.2\"\n    )\n    \"\"\":external:ref:`core-metadata-requires-python`\"\"\"\n    # Because `Requires-External` allows for non-PEP 440 version specifiers, we\n    # don't do any processing on the values.\n    requires_external: _Validator[Optional[List[str]]] = _Validator(added=\"1.2\")\n    \"\"\":external:ref:`core-metadata-requires-external`\"\"\"\n    project_urls: _Validator[Optional[Dict[str, str]]] = _Validator(added=\"1.2\")\n    \"\"\":external:ref:`core-metadata-project-url`\"\"\"\n    # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation\n    # regardless of metadata version.\n    provides_extra: _Validator[Optional[List[utils.NormalizedName]]] = _Validator(\n        added=\"2.1\",\n    )\n    \"\"\":external:ref:`core-metadata-provides-extra`\"\"\"\n    provides_dist: _Validator[Optional[List[str]]] = _Validator(added=\"1.2\")\n    \"\"\":external:ref:`core-metadata-provides-dist`\"\"\"\n    obsoletes_dist: _Validator[Optional[List[str]]] = _Validator(added=\"1.2\")\n    \"\"\":external:ref:`core-metadata-obsoletes-dist`\"\"\"\n    requires: _Validator[Optional[List[str]]] = _Validator(added=\"1.1\")\n    \"\"\"``Requires`` (deprecated)\"\"\"\n    provides: _Validator[Optional[List[str]]] = _Validator(added=\"1.1\")\n    \"\"\"``Provides`` (deprecated)\"\"\"\n    obsoletes: _Validator[Optional[List[str]]] = _Validator(added=\"1.1\")\n    \"\"\"``Obsoletes`` (deprecated)\"\"\"\n"
  },
  {
    "path": "gyp/pylib/packaging/py.typed",
    "content": ""
  },
  {
    "path": "gyp/pylib/packaging/requirements.py",
    "content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nfrom typing import Any, Iterator, Optional, Set\n\nfrom ._parser import parse_requirement as _parse_requirement\nfrom ._tokenizer import ParserSyntaxError\nfrom .markers import Marker, _normalize_extra_values\nfrom .specifiers import SpecifierSet\nfrom .utils import canonicalize_name\n\n\nclass InvalidRequirement(ValueError):\n    \"\"\"\n    An invalid requirement was found, users should refer to PEP 508.\n    \"\"\"\n\n\nclass Requirement:\n    \"\"\"Parse a requirement.\n\n    Parse a given requirement string into its parts, such as name, specifier,\n    URL, and extras. Raises InvalidRequirement on a badly-formed requirement\n    string.\n    \"\"\"\n\n    # TODO: Can we test whether something is contained within a requirement?\n    #       If so how do we do that? Do we need to test against the _name_ of\n    #       the thing as well as the version? What about the markers?\n    # TODO: Can we normalize the name and extra name?\n\n    def __init__(self, requirement_string: str) -> None:\n        try:\n            parsed = _parse_requirement(requirement_string)\n        except ParserSyntaxError as e:\n            raise InvalidRequirement(str(e)) from e\n\n        self.name: str = parsed.name\n        self.url: Optional[str] = parsed.url or None\n        self.extras: Set[str] = set(parsed.extras if parsed.extras else [])\n        self.specifier: SpecifierSet = SpecifierSet(parsed.specifier)\n        self.marker: Optional[Marker] = None\n        if parsed.marker is not None:\n            self.marker = Marker.__new__(Marker)\n            self.marker._markers = _normalize_extra_values(parsed.marker)\n\n    def _iter_parts(self, name: str) -> Iterator[str]:\n        yield name\n\n        if self.extras:\n            formatted_extras = \",\".join(sorted(self.extras))\n            yield f\"[{formatted_extras}]\"\n\n        if self.specifier:\n            yield str(self.specifier)\n\n        if self.url:\n            yield f\"@ {self.url}\"\n            if self.marker:\n                yield \" \"\n\n        if self.marker:\n            yield f\"; {self.marker}\"\n\n    def __str__(self) -> str:\n        return \"\".join(self._iter_parts(self.name))\n\n    def __repr__(self) -> str:\n        return f\"<Requirement('{self}')>\"\n\n    def __hash__(self) -> int:\n        return hash(\n            (\n                self.__class__.__name__,\n                *self._iter_parts(canonicalize_name(self.name)),\n            )\n        )\n\n    def __eq__(self, other: Any) -> bool:\n        if not isinstance(other, Requirement):\n            return NotImplemented\n\n        return (\n            canonicalize_name(self.name) == canonicalize_name(other.name)\n            and self.extras == other.extras\n            and self.specifier == other.specifier\n            and self.url == other.url\n            and self.marker == other.marker\n        )\n"
  },
  {
    "path": "gyp/pylib/packaging/specifiers.py",
    "content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\"\"\"\n.. testsetup::\n\n    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier\n    from packaging.version import Version\n\"\"\"\n\nimport abc\nimport itertools\nimport re\nfrom typing import (\n    Callable,\n    Iterable,\n    Iterator,\n    List,\n    Optional,\n    Set,\n    Tuple,\n    TypeVar,\n    Union,\n)\n\nfrom .utils import canonicalize_version\nfrom .version import Version\n\nUnparsedVersion = Union[Version, str]\nUnparsedVersionVar = TypeVar(\"UnparsedVersionVar\", bound=UnparsedVersion)\nCallableOperator = Callable[[Version, str], bool]\n\n\ndef _coerce_version(version: UnparsedVersion) -> Version:\n    if not isinstance(version, Version):\n        version = Version(version)\n    return version\n\n\nclass InvalidSpecifier(ValueError):\n    \"\"\"\n    Raised when attempting to create a :class:`Specifier` with a specifier\n    string that is invalid.\n\n    >>> Specifier(\"lolwat\")\n    Traceback (most recent call last):\n        ...\n    packaging.specifiers.InvalidSpecifier: Invalid specifier: 'lolwat'\n    \"\"\"\n\n\nclass BaseSpecifier(metaclass=abc.ABCMeta):\n    @abc.abstractmethod\n    def __str__(self) -> str:\n        \"\"\"\n        Returns the str representation of this Specifier-like object. This\n        should be representative of the Specifier itself.\n        \"\"\"\n\n    @abc.abstractmethod\n    def __hash__(self) -> int:\n        \"\"\"\n        Returns a hash value for this Specifier-like object.\n        \"\"\"\n\n    @abc.abstractmethod\n    def __eq__(self, other: object) -> bool:\n        \"\"\"\n        Returns a boolean representing whether or not the two Specifier-like\n        objects are equal.\n\n        :param other: The other object to check against.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def prereleases(self) -> Optional[bool]:\n        \"\"\"Whether or not pre-releases as a whole are allowed.\n\n        This can be set to either ``True`` or ``False`` to explicitly enable or disable\n        prereleases or it can be set to ``None`` (the default) to use default semantics.\n        \"\"\"\n\n    @prereleases.setter\n    def prereleases(self, value: bool) -> None:\n        \"\"\"Setter for :attr:`prereleases`.\n\n        :param value: The value to set.\n        \"\"\"\n\n    @abc.abstractmethod\n    def contains(self, item: str, prereleases: Optional[bool] = None) -> bool:\n        \"\"\"\n        Determines if the given item is contained within this specifier.\n        \"\"\"\n\n    @abc.abstractmethod\n    def filter(\n        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None\n    ) -> Iterator[UnparsedVersionVar]:\n        \"\"\"\n        Takes an iterable of items and filters them so that only items which\n        are contained within this specifier are allowed in it.\n        \"\"\"\n\n\nclass Specifier(BaseSpecifier):\n    \"\"\"This class abstracts handling of version specifiers.\n\n    .. tip::\n\n        It is generally not required to instantiate this manually. You should instead\n        prefer to work with :class:`SpecifierSet` instead, which can parse\n        comma-separated version specifiers (which is what package metadata contains).\n    \"\"\"\n\n    _operator_regex_str = r\"\"\"\n        (?P<operator>(~=|==|!=|<=|>=|<|>|===))\n        \"\"\"\n    _version_regex_str = r\"\"\"\n        (?P<version>\n            (?:\n                # The identity operators allow for an escape hatch that will\n                # do an exact string match of the version you wish to install.\n                # This will not be parsed by PEP 440 and we cannot determine\n                # any semantic meaning from it. This operator is discouraged\n                # but included entirely as an escape hatch.\n                (?<====)  # Only match for the identity operator\n                \\s*\n                [^\\s;)]*  # The arbitrary version can be just about anything,\n                          # we match everything except for whitespace, a\n                          # semi-colon for marker support, and a closing paren\n                          # since versions can be enclosed in them.\n            )\n            |\n            (?:\n                # The (non)equality operators allow for wild card and local\n                # versions to be specified so we have to define these two\n                # operators separately to enable that.\n                (?<===|!=)            # Only match for equals and not equals\n\n                \\s*\n                v?\n                (?:[0-9]+!)?          # epoch\n                [0-9]+(?:\\.[0-9]+)*   # release\n\n                # You cannot use a wild card and a pre-release, post-release, a dev or\n                # local version together so group them with a | and make them optional.\n                (?:\n                    \\.\\*  # Wild card syntax of .*\n                    |\n                    (?:                                  # pre release\n                        [-_\\.]?\n                        (alpha|beta|preview|pre|a|b|c|rc)\n                        [-_\\.]?\n                        [0-9]*\n                    )?\n                    (?:                                  # post release\n                        (?:-[0-9]+)|(?:[-_\\.]?(post|rev|r)[-_\\.]?[0-9]*)\n                    )?\n                    (?:[-_\\.]?dev[-_\\.]?[0-9]*)?         # dev release\n                    (?:\\+[a-z0-9]+(?:[-_\\.][a-z0-9]+)*)? # local\n                )?\n            )\n            |\n            (?:\n                # The compatible operator requires at least two digits in the\n                # release segment.\n                (?<=~=)               # Only match for the compatible operator\n\n                \\s*\n                v?\n                (?:[0-9]+!)?          # epoch\n                [0-9]+(?:\\.[0-9]+)+   # release  (We have a + instead of a *)\n                (?:                   # pre release\n                    [-_\\.]?\n                    (alpha|beta|preview|pre|a|b|c|rc)\n                    [-_\\.]?\n                    [0-9]*\n                )?\n                (?:                                   # post release\n                    (?:-[0-9]+)|(?:[-_\\.]?(post|rev|r)[-_\\.]?[0-9]*)\n                )?\n                (?:[-_\\.]?dev[-_\\.]?[0-9]*)?          # dev release\n            )\n            |\n            (?:\n                # All other operators only allow a sub set of what the\n                # (non)equality operators do. Specifically they do not allow\n                # local versions to be specified nor do they allow the prefix\n                # matching wild cards.\n                (?<!==|!=|~=)         # We have special cases for these\n                                      # operators so we want to make sure they\n                                      # don't match here.\n\n                \\s*\n                v?\n                (?:[0-9]+!)?          # epoch\n                [0-9]+(?:\\.[0-9]+)*   # release\n                (?:                   # pre release\n                    [-_\\.]?\n                    (alpha|beta|preview|pre|a|b|c|rc)\n                    [-_\\.]?\n                    [0-9]*\n                )?\n                (?:                                   # post release\n                    (?:-[0-9]+)|(?:[-_\\.]?(post|rev|r)[-_\\.]?[0-9]*)\n                )?\n                (?:[-_\\.]?dev[-_\\.]?[0-9]*)?          # dev release\n            )\n        )\n        \"\"\"\n\n    _regex = re.compile(\n        r\"^\\s*\" + _operator_regex_str + _version_regex_str + r\"\\s*$\",\n        re.VERBOSE | re.IGNORECASE,\n    )\n\n    _operators = {\n        \"~=\": \"compatible\",\n        \"==\": \"equal\",\n        \"!=\": \"not_equal\",\n        \"<=\": \"less_than_equal\",\n        \">=\": \"greater_than_equal\",\n        \"<\": \"less_than\",\n        \">\": \"greater_than\",\n        \"===\": \"arbitrary\",\n    }\n\n    def __init__(self, spec: str = \"\", prereleases: Optional[bool] = None) -> None:\n        \"\"\"Initialize a Specifier instance.\n\n        :param spec:\n            The string representation of a specifier which will be parsed and\n            normalized before use.\n        :param prereleases:\n            This tells the specifier if it should accept prerelease versions if\n            applicable or not. The default of ``None`` will autodetect it from the\n            given specifiers.\n        :raises InvalidSpecifier:\n            If the given specifier is invalid (i.e. bad syntax).\n        \"\"\"\n        match = self._regex.search(spec)\n        if not match:\n            raise InvalidSpecifier(f\"Invalid specifier: '{spec}'\")\n\n        self._spec: Tuple[str, str] = (\n            match.group(\"operator\").strip(),\n            match.group(\"version\").strip(),\n        )\n\n        # Store whether or not this Specifier should accept prereleases\n        self._prereleases = prereleases\n\n    # https://github.com/python/mypy/pull/13475#pullrequestreview-1079784515\n    @property  # type: ignore[override]\n    def prereleases(self) -> bool:\n        # If there is an explicit prereleases set for this, then we'll just\n        # blindly use that.\n        if self._prereleases is not None:\n            return self._prereleases\n\n        # Look at all of our specifiers and determine if they are inclusive\n        # operators, and if they are if they are including an explicit\n        # prerelease.\n        operator, version = self._spec\n        if operator in [\"==\", \">=\", \"<=\", \"~=\", \"===\"]:\n            # The == specifier can include a trailing .*, if it does we\n            # want to remove before parsing.\n            if operator == \"==\" and version.endswith(\".*\"):\n                version = version[:-2]\n\n            # Parse the version, and if it is a pre-release than this\n            # specifier allows pre-releases.\n            if Version(version).is_prerelease:\n                return True\n\n        return False\n\n    @prereleases.setter\n    def prereleases(self, value: bool) -> None:\n        self._prereleases = value\n\n    @property\n    def operator(self) -> str:\n        \"\"\"The operator of this specifier.\n\n        >>> Specifier(\"==1.2.3\").operator\n        '=='\n        \"\"\"\n        return self._spec[0]\n\n    @property\n    def version(self) -> str:\n        \"\"\"The version of this specifier.\n\n        >>> Specifier(\"==1.2.3\").version\n        '1.2.3'\n        \"\"\"\n        return self._spec[1]\n\n    def __repr__(self) -> str:\n        \"\"\"A representation of the Specifier that shows all internal state.\n\n        >>> Specifier('>=1.0.0')\n        <Specifier('>=1.0.0')>\n        >>> Specifier('>=1.0.0', prereleases=False)\n        <Specifier('>=1.0.0', prereleases=False)>\n        >>> Specifier('>=1.0.0', prereleases=True)\n        <Specifier('>=1.0.0', prereleases=True)>\n        \"\"\"\n        pre = (\n            f\", prereleases={self.prereleases!r}\"\n            if self._prereleases is not None\n            else \"\"\n        )\n\n        return f\"<{self.__class__.__name__}({str(self)!r}{pre})>\"\n\n    def __str__(self) -> str:\n        \"\"\"A string representation of the Specifier that can be round-tripped.\n\n        >>> str(Specifier('>=1.0.0'))\n        '>=1.0.0'\n        >>> str(Specifier('>=1.0.0', prereleases=False))\n        '>=1.0.0'\n        \"\"\"\n        return \"{}{}\".format(*self._spec)\n\n    @property\n    def _canonical_spec(self) -> Tuple[str, str]:\n        canonical_version = canonicalize_version(\n            self._spec[1],\n            strip_trailing_zero=(self._spec[0] != \"~=\"),\n        )\n        return self._spec[0], canonical_version\n\n    def __hash__(self) -> int:\n        return hash(self._canonical_spec)\n\n    def __eq__(self, other: object) -> bool:\n        \"\"\"Whether or not the two Specifier-like objects are equal.\n\n        :param other: The other object to check against.\n\n        The value of :attr:`prereleases` is ignored.\n\n        >>> Specifier(\"==1.2.3\") == Specifier(\"== 1.2.3.0\")\n        True\n        >>> (Specifier(\"==1.2.3\", prereleases=False) ==\n        ...  Specifier(\"==1.2.3\", prereleases=True))\n        True\n        >>> Specifier(\"==1.2.3\") == \"==1.2.3\"\n        True\n        >>> Specifier(\"==1.2.3\") == Specifier(\"==1.2.4\")\n        False\n        >>> Specifier(\"==1.2.3\") == Specifier(\"~=1.2.3\")\n        False\n        \"\"\"\n        if isinstance(other, str):\n            try:\n                other = self.__class__(str(other))\n            except InvalidSpecifier:\n                return NotImplemented\n        elif not isinstance(other, self.__class__):\n            return NotImplemented\n\n        return self._canonical_spec == other._canonical_spec\n\n    def _get_operator(self, op: str) -> CallableOperator:\n        operator_callable: CallableOperator = getattr(\n            self, f\"_compare_{self._operators[op]}\"\n        )\n        return operator_callable\n\n    def _compare_compatible(self, prospective: Version, spec: str) -> bool:\n\n        # Compatible releases have an equivalent combination of >= and ==. That\n        # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to\n        # implement this in terms of the other specifiers instead of\n        # implementing it ourselves. The only thing we need to do is construct\n        # the other specifiers.\n\n        # We want everything but the last item in the version, but we want to\n        # ignore suffix segments.\n        prefix = _version_join(\n            list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1]\n        )\n\n        # Add the prefix notation to the end of our string\n        prefix += \".*\"\n\n        return self._get_operator(\">=\")(prospective, spec) and self._get_operator(\"==\")(\n            prospective, prefix\n        )\n\n    def _compare_equal(self, prospective: Version, spec: str) -> bool:\n\n        # We need special logic to handle prefix matching\n        if spec.endswith(\".*\"):\n            # In the case of prefix matching we want to ignore local segment.\n            normalized_prospective = canonicalize_version(\n                prospective.public, strip_trailing_zero=False\n            )\n            # Get the normalized version string ignoring the trailing .*\n            normalized_spec = canonicalize_version(spec[:-2], strip_trailing_zero=False)\n            # Split the spec out by bangs and dots, and pretend that there is\n            # an implicit dot in between a release segment and a pre-release segment.\n            split_spec = _version_split(normalized_spec)\n\n            # Split the prospective version out by bangs and dots, and pretend\n            # that there is an implicit dot in between a release segment and\n            # a pre-release segment.\n            split_prospective = _version_split(normalized_prospective)\n\n            # 0-pad the prospective version before shortening it to get the correct\n            # shortened version.\n            padded_prospective, _ = _pad_version(split_prospective, split_spec)\n\n            # Shorten the prospective version to be the same length as the spec\n            # so that we can determine if the specifier is a prefix of the\n            # prospective version or not.\n            shortened_prospective = padded_prospective[: len(split_spec)]\n\n            return shortened_prospective == split_spec\n        else:\n            # Convert our spec string into a Version\n            spec_version = Version(spec)\n\n            # If the specifier does not have a local segment, then we want to\n            # act as if the prospective version also does not have a local\n            # segment.\n            if not spec_version.local:\n                prospective = Version(prospective.public)\n\n            return prospective == spec_version\n\n    def _compare_not_equal(self, prospective: Version, spec: str) -> bool:\n        return not self._compare_equal(prospective, spec)\n\n    def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool:\n\n        # NB: Local version identifiers are NOT permitted in the version\n        # specifier, so local version labels can be universally removed from\n        # the prospective version.\n        return Version(prospective.public) <= Version(spec)\n\n    def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool:\n\n        # NB: Local version identifiers are NOT permitted in the version\n        # specifier, so local version labels can be universally removed from\n        # the prospective version.\n        return Version(prospective.public) >= Version(spec)\n\n    def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:\n\n        # Convert our spec to a Version instance, since we'll want to work with\n        # it as a version.\n        spec = Version(spec_str)\n\n        # Check to see if the prospective version is less than the spec\n        # version. If it's not we can short circuit and just return False now\n        # instead of doing extra unneeded work.\n        if not prospective < spec:\n            return False\n\n        # This special case is here so that, unless the specifier itself\n        # includes is a pre-release version, that we do not accept pre-release\n        # versions for the version mentioned in the specifier (e.g. <3.1 should\n        # not match 3.1.dev0, but should match 3.0.dev0).\n        if not spec.is_prerelease and prospective.is_prerelease:\n            if Version(prospective.base_version) == Version(spec.base_version):\n                return False\n\n        # If we've gotten to here, it means that prospective version is both\n        # less than the spec version *and* it's not a pre-release of the same\n        # version in the spec.\n        return True\n\n    def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool:\n\n        # Convert our spec to a Version instance, since we'll want to work with\n        # it as a version.\n        spec = Version(spec_str)\n\n        # Check to see if the prospective version is greater than the spec\n        # version. If it's not we can short circuit and just return False now\n        # instead of doing extra unneeded work.\n        if not prospective > spec:\n            return False\n\n        # This special case is here so that, unless the specifier itself\n        # includes is a post-release version, that we do not accept\n        # post-release versions for the version mentioned in the specifier\n        # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0).\n        if not spec.is_postrelease and prospective.is_postrelease:\n            if Version(prospective.base_version) == Version(spec.base_version):\n                return False\n\n        # Ensure that we do not allow a local version of the version mentioned\n        # in the specifier, which is technically greater than, to match.\n        if prospective.local is not None:\n            if Version(prospective.base_version) == Version(spec.base_version):\n                return False\n\n        # If we've gotten to here, it means that prospective version is both\n        # greater than the spec version *and* it's not a pre-release of the\n        # same version in the spec.\n        return True\n\n    def _compare_arbitrary(self, prospective: Version, spec: str) -> bool:\n        return str(prospective).lower() == str(spec).lower()\n\n    def __contains__(self, item: Union[str, Version]) -> bool:\n        \"\"\"Return whether or not the item is contained in this specifier.\n\n        :param item: The item to check for.\n\n        This is used for the ``in`` operator and behaves the same as\n        :meth:`contains` with no ``prereleases`` argument passed.\n\n        >>> \"1.2.3\" in Specifier(\">=1.2.3\")\n        True\n        >>> Version(\"1.2.3\") in Specifier(\">=1.2.3\")\n        True\n        >>> \"1.0.0\" in Specifier(\">=1.2.3\")\n        False\n        >>> \"1.3.0a1\" in Specifier(\">=1.2.3\")\n        False\n        >>> \"1.3.0a1\" in Specifier(\">=1.2.3\", prereleases=True)\n        True\n        \"\"\"\n        return self.contains(item)\n\n    def contains(\n        self, item: UnparsedVersion, prereleases: Optional[bool] = None\n    ) -> bool:\n        \"\"\"Return whether or not the item is contained in this specifier.\n\n        :param item:\n            The item to check for, which can be a version string or a\n            :class:`Version` instance.\n        :param prereleases:\n            Whether or not to match prereleases with this Specifier. If set to\n            ``None`` (the default), it uses :attr:`prereleases` to determine\n            whether or not prereleases are allowed.\n\n        >>> Specifier(\">=1.2.3\").contains(\"1.2.3\")\n        True\n        >>> Specifier(\">=1.2.3\").contains(Version(\"1.2.3\"))\n        True\n        >>> Specifier(\">=1.2.3\").contains(\"1.0.0\")\n        False\n        >>> Specifier(\">=1.2.3\").contains(\"1.3.0a1\")\n        False\n        >>> Specifier(\">=1.2.3\", prereleases=True).contains(\"1.3.0a1\")\n        True\n        >>> Specifier(\">=1.2.3\").contains(\"1.3.0a1\", prereleases=True)\n        True\n        \"\"\"\n\n        # Determine if prereleases are to be allowed or not.\n        if prereleases is None:\n            prereleases = self.prereleases\n\n        # Normalize item to a Version, this allows us to have a shortcut for\n        # \"2.0\" in Specifier(\">=2\")\n        normalized_item = _coerce_version(item)\n\n        # Determine if we should be supporting prereleases in this specifier\n        # or not, if we do not support prereleases than we can short circuit\n        # logic if this version is a prereleases.\n        if normalized_item.is_prerelease and not prereleases:\n            return False\n\n        # Actually do the comparison to determine if this item is contained\n        # within this Specifier or not.\n        operator_callable: CallableOperator = self._get_operator(self.operator)\n        return operator_callable(normalized_item, self.version)\n\n    def filter(\n        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None\n    ) -> Iterator[UnparsedVersionVar]:\n        \"\"\"Filter items in the given iterable, that match the specifier.\n\n        :param iterable:\n            An iterable that can contain version strings and :class:`Version` instances.\n            The items in the iterable will be filtered according to the specifier.\n        :param prereleases:\n            Whether or not to allow prereleases in the returned iterator. If set to\n            ``None`` (the default), it will be intelligently decide whether to allow\n            prereleases or not (based on the :attr:`prereleases` attribute, and\n            whether the only versions matching are prereleases).\n\n        This method is smarter than just ``filter(Specifier().contains, [...])``\n        because it implements the rule from :pep:`440` that a prerelease item\n        SHOULD be accepted if no other versions match the given specifier.\n\n        >>> list(Specifier(\">=1.2.3\").filter([\"1.2\", \"1.3\", \"1.5a1\"]))\n        ['1.3']\n        >>> list(Specifier(\">=1.2.3\").filter([\"1.2\", \"1.2.3\", \"1.3\", Version(\"1.4\")]))\n        ['1.2.3', '1.3', <Version('1.4')>]\n        >>> list(Specifier(\">=1.2.3\").filter([\"1.2\", \"1.5a1\"]))\n        ['1.5a1']\n        >>> list(Specifier(\">=1.2.3\").filter([\"1.3\", \"1.5a1\"], prereleases=True))\n        ['1.3', '1.5a1']\n        >>> list(Specifier(\">=1.2.3\", prereleases=True).filter([\"1.3\", \"1.5a1\"]))\n        ['1.3', '1.5a1']\n        \"\"\"\n\n        yielded = False\n        found_prereleases = []\n\n        kw = {\"prereleases\": prereleases if prereleases is not None else True}\n\n        # Attempt to iterate over all the values in the iterable and if any of\n        # them match, yield them.\n        for version in iterable:\n            parsed_version = _coerce_version(version)\n\n            if self.contains(parsed_version, **kw):\n                # If our version is a prerelease, and we were not set to allow\n                # prereleases, then we'll store it for later in case nothing\n                # else matches this specifier.\n                if parsed_version.is_prerelease and not (\n                    prereleases or self.prereleases\n                ):\n                    found_prereleases.append(version)\n                # Either this is not a prerelease, or we should have been\n                # accepting prereleases from the beginning.\n                else:\n                    yielded = True\n                    yield version\n\n        # Now that we've iterated over everything, determine if we've yielded\n        # any values, and if we have not and we have any prereleases stored up\n        # then we will go ahead and yield the prereleases.\n        if not yielded and found_prereleases:\n            for version in found_prereleases:\n                yield version\n\n\n_prefix_regex = re.compile(r\"^([0-9]+)((?:a|b|c|rc)[0-9]+)$\")\n\n\ndef _version_split(version: str) -> List[str]:\n    \"\"\"Split version into components.\n\n    The split components are intended for version comparison. The logic does\n    not attempt to retain the original version string, so joining the\n    components back with :func:`_version_join` may not produce the original\n    version string.\n    \"\"\"\n    result: List[str] = []\n\n    epoch, _, rest = version.rpartition(\"!\")\n    result.append(epoch or \"0\")\n\n    for item in rest.split(\".\"):\n        match = _prefix_regex.search(item)\n        if match:\n            result.extend(match.groups())\n        else:\n            result.append(item)\n    return result\n\n\ndef _version_join(components: List[str]) -> str:\n    \"\"\"Join split version components into a version string.\n\n    This function assumes the input came from :func:`_version_split`, where the\n    first component must be the epoch (either empty or numeric), and all other\n    components numeric.\n    \"\"\"\n    epoch, *rest = components\n    return f\"{epoch}!{'.'.join(rest)}\"\n\n\ndef _is_not_suffix(segment: str) -> bool:\n    return not any(\n        segment.startswith(prefix) for prefix in (\"dev\", \"a\", \"b\", \"rc\", \"post\")\n    )\n\n\ndef _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str]]:\n    left_split, right_split = [], []\n\n    # Get the release segment of our versions\n    left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))\n    right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))\n\n    # Get the rest of our versions\n    left_split.append(left[len(left_split[0]) :])\n    right_split.append(right[len(right_split[0]) :])\n\n    # Insert our padding\n    left_split.insert(1, [\"0\"] * max(0, len(right_split[0]) - len(left_split[0])))\n    right_split.insert(1, [\"0\"] * max(0, len(left_split[0]) - len(right_split[0])))\n\n    return (list(itertools.chain(*left_split)), list(itertools.chain(*right_split)))\n\n\nclass SpecifierSet(BaseSpecifier):\n    \"\"\"This class abstracts handling of a set of version specifiers.\n\n    It can be passed a single specifier (``>=3.0``), a comma-separated list of\n    specifiers (``>=3.0,!=3.1``), or no specifier at all.\n    \"\"\"\n\n    def __init__(\n        self, specifiers: str = \"\", prereleases: Optional[bool] = None\n    ) -> None:\n        \"\"\"Initialize a SpecifierSet instance.\n\n        :param specifiers:\n            The string representation of a specifier or a comma-separated list of\n            specifiers which will be parsed and normalized before use.\n        :param prereleases:\n            This tells the SpecifierSet if it should accept prerelease versions if\n            applicable or not. The default of ``None`` will autodetect it from the\n            given specifiers.\n\n        :raises InvalidSpecifier:\n            If the given ``specifiers`` are not parseable than this exception will be\n            raised.\n        \"\"\"\n\n        # Split on `,` to break each individual specifier into it's own item, and\n        # strip each item to remove leading/trailing whitespace.\n        split_specifiers = [s.strip() for s in specifiers.split(\",\") if s.strip()]\n\n        # Parsed each individual specifier, attempting first to make it a\n        # Specifier.\n        parsed: Set[Specifier] = set()\n        for specifier in split_specifiers:\n            parsed.add(Specifier(specifier))\n\n        # Turn our parsed specifiers into a frozen set and save them for later.\n        self._specs = frozenset(parsed)\n\n        # Store our prereleases value so we can use it later to determine if\n        # we accept prereleases or not.\n        self._prereleases = prereleases\n\n    @property\n    def prereleases(self) -> Optional[bool]:\n        # If we have been given an explicit prerelease modifier, then we'll\n        # pass that through here.\n        if self._prereleases is not None:\n            return self._prereleases\n\n        # If we don't have any specifiers, and we don't have a forced value,\n        # then we'll just return None since we don't know if this should have\n        # pre-releases or not.\n        if not self._specs:\n            return None\n\n        # Otherwise we'll see if any of the given specifiers accept\n        # prereleases, if any of them do we'll return True, otherwise False.\n        return any(s.prereleases for s in self._specs)\n\n    @prereleases.setter\n    def prereleases(self, value: bool) -> None:\n        self._prereleases = value\n\n    def __repr__(self) -> str:\n        \"\"\"A representation of the specifier set that shows all internal state.\n\n        Note that the ordering of the individual specifiers within the set may not\n        match the input string.\n\n        >>> SpecifierSet('>=1.0.0,!=2.0.0')\n        <SpecifierSet('!=2.0.0,>=1.0.0')>\n        >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=False)\n        <SpecifierSet('!=2.0.0,>=1.0.0', prereleases=False)>\n        >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=True)\n        <SpecifierSet('!=2.0.0,>=1.0.0', prereleases=True)>\n        \"\"\"\n        pre = (\n            f\", prereleases={self.prereleases!r}\"\n            if self._prereleases is not None\n            else \"\"\n        )\n\n        return f\"<SpecifierSet({str(self)!r}{pre})>\"\n\n    def __str__(self) -> str:\n        \"\"\"A string representation of the specifier set that can be round-tripped.\n\n        Note that the ordering of the individual specifiers within the set may not\n        match the input string.\n\n        >>> str(SpecifierSet(\">=1.0.0,!=1.0.1\"))\n        '!=1.0.1,>=1.0.0'\n        >>> str(SpecifierSet(\">=1.0.0,!=1.0.1\", prereleases=False))\n        '!=1.0.1,>=1.0.0'\n        \"\"\"\n        return \",\".join(sorted(str(s) for s in self._specs))\n\n    def __hash__(self) -> int:\n        return hash(self._specs)\n\n    def __and__(self, other: Union[\"SpecifierSet\", str]) -> \"SpecifierSet\":\n        \"\"\"Return a SpecifierSet which is a combination of the two sets.\n\n        :param other: The other object to combine with.\n\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\") & '<=2.0.0,!=2.0.1'\n        <SpecifierSet('!=1.0.1,!=2.0.1,<=2.0.0,>=1.0.0')>\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\") & SpecifierSet('<=2.0.0,!=2.0.1')\n        <SpecifierSet('!=1.0.1,!=2.0.1,<=2.0.0,>=1.0.0')>\n        \"\"\"\n        if isinstance(other, str):\n            other = SpecifierSet(other)\n        elif not isinstance(other, SpecifierSet):\n            return NotImplemented\n\n        specifier = SpecifierSet()\n        specifier._specs = frozenset(self._specs | other._specs)\n\n        if self._prereleases is None and other._prereleases is not None:\n            specifier._prereleases = other._prereleases\n        elif self._prereleases is not None and other._prereleases is None:\n            specifier._prereleases = self._prereleases\n        elif self._prereleases == other._prereleases:\n            specifier._prereleases = self._prereleases\n        else:\n            raise ValueError(\n                \"Cannot combine SpecifierSets with True and False prerelease \"\n                \"overrides.\"\n            )\n\n        return specifier\n\n    def __eq__(self, other: object) -> bool:\n        \"\"\"Whether or not the two SpecifierSet-like objects are equal.\n\n        :param other: The other object to check against.\n\n        The value of :attr:`prereleases` is ignored.\n\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\") == SpecifierSet(\">=1.0.0,!=1.0.1\")\n        True\n        >>> (SpecifierSet(\">=1.0.0,!=1.0.1\", prereleases=False) ==\n        ...  SpecifierSet(\">=1.0.0,!=1.0.1\", prereleases=True))\n        True\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\") == \">=1.0.0,!=1.0.1\"\n        True\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\") == SpecifierSet(\">=1.0.0\")\n        False\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\") == SpecifierSet(\">=1.0.0,!=1.0.2\")\n        False\n        \"\"\"\n        if isinstance(other, (str, Specifier)):\n            other = SpecifierSet(str(other))\n        elif not isinstance(other, SpecifierSet):\n            return NotImplemented\n\n        return self._specs == other._specs\n\n    def __len__(self) -> int:\n        \"\"\"Returns the number of specifiers in this specifier set.\"\"\"\n        return len(self._specs)\n\n    def __iter__(self) -> Iterator[Specifier]:\n        \"\"\"\n        Returns an iterator over all the underlying :class:`Specifier` instances\n        in this specifier set.\n\n        >>> sorted(SpecifierSet(\">=1.0.0,!=1.0.1\"), key=str)\n        [<Specifier('!=1.0.1')>, <Specifier('>=1.0.0')>]\n        \"\"\"\n        return iter(self._specs)\n\n    def __contains__(self, item: UnparsedVersion) -> bool:\n        \"\"\"Return whether or not the item is contained in this specifier.\n\n        :param item: The item to check for.\n\n        This is used for the ``in`` operator and behaves the same as\n        :meth:`contains` with no ``prereleases`` argument passed.\n\n        >>> \"1.2.3\" in SpecifierSet(\">=1.0.0,!=1.0.1\")\n        True\n        >>> Version(\"1.2.3\") in SpecifierSet(\">=1.0.0,!=1.0.1\")\n        True\n        >>> \"1.0.1\" in SpecifierSet(\">=1.0.0,!=1.0.1\")\n        False\n        >>> \"1.3.0a1\" in SpecifierSet(\">=1.0.0,!=1.0.1\")\n        False\n        >>> \"1.3.0a1\" in SpecifierSet(\">=1.0.0,!=1.0.1\", prereleases=True)\n        True\n        \"\"\"\n        return self.contains(item)\n\n    def contains(\n        self,\n        item: UnparsedVersion,\n        prereleases: Optional[bool] = None,\n        installed: Optional[bool] = None,\n    ) -> bool:\n        \"\"\"Return whether or not the item is contained in this SpecifierSet.\n\n        :param item:\n            The item to check for, which can be a version string or a\n            :class:`Version` instance.\n        :param prereleases:\n            Whether or not to match prereleases with this SpecifierSet. If set to\n            ``None`` (the default), it uses :attr:`prereleases` to determine\n            whether or not prereleases are allowed.\n\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\").contains(\"1.2.3\")\n        True\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\").contains(Version(\"1.2.3\"))\n        True\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\").contains(\"1.0.1\")\n        False\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\").contains(\"1.3.0a1\")\n        False\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\", prereleases=True).contains(\"1.3.0a1\")\n        True\n        >>> SpecifierSet(\">=1.0.0,!=1.0.1\").contains(\"1.3.0a1\", prereleases=True)\n        True\n        \"\"\"\n        # Ensure that our item is a Version instance.\n        if not isinstance(item, Version):\n            item = Version(item)\n\n        # Determine if we're forcing a prerelease or not, if we're not forcing\n        # one for this particular filter call, then we'll use whatever the\n        # SpecifierSet thinks for whether or not we should support prereleases.\n        if prereleases is None:\n            prereleases = self.prereleases\n\n        # We can determine if we're going to allow pre-releases by looking to\n        # see if any of the underlying items supports them. If none of them do\n        # and this item is a pre-release then we do not allow it and we can\n        # short circuit that here.\n        # Note: This means that 1.0.dev1 would not be contained in something\n        #       like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0\n        if not prereleases and item.is_prerelease:\n            return False\n\n        if installed and item.is_prerelease:\n            item = Version(item.base_version)\n\n        # We simply dispatch to the underlying specs here to make sure that the\n        # given version is contained within all of them.\n        # Note: This use of all() here means that an empty set of specifiers\n        #       will always return True, this is an explicit design decision.\n        return all(s.contains(item, prereleases=prereleases) for s in self._specs)\n\n    def filter(\n        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None\n    ) -> Iterator[UnparsedVersionVar]:\n        \"\"\"Filter items in the given iterable, that match the specifiers in this set.\n\n        :param iterable:\n            An iterable that can contain version strings and :class:`Version` instances.\n            The items in the iterable will be filtered according to the specifier.\n        :param prereleases:\n            Whether or not to allow prereleases in the returned iterator. If set to\n            ``None`` (the default), it will be intelligently decide whether to allow\n            prereleases or not (based on the :attr:`prereleases` attribute, and\n            whether the only versions matching are prereleases).\n\n        This method is smarter than just ``filter(SpecifierSet(...).contains, [...])``\n        because it implements the rule from :pep:`440` that a prerelease item\n        SHOULD be accepted if no other versions match the given specifier.\n\n        >>> list(SpecifierSet(\">=1.2.3\").filter([\"1.2\", \"1.3\", \"1.5a1\"]))\n        ['1.3']\n        >>> list(SpecifierSet(\">=1.2.3\").filter([\"1.2\", \"1.3\", Version(\"1.4\")]))\n        ['1.3', <Version('1.4')>]\n        >>> list(SpecifierSet(\">=1.2.3\").filter([\"1.2\", \"1.5a1\"]))\n        []\n        >>> list(SpecifierSet(\">=1.2.3\").filter([\"1.3\", \"1.5a1\"], prereleases=True))\n        ['1.3', '1.5a1']\n        >>> list(SpecifierSet(\">=1.2.3\", prereleases=True).filter([\"1.3\", \"1.5a1\"]))\n        ['1.3', '1.5a1']\n\n        An \"empty\" SpecifierSet will filter items based on the presence of prerelease\n        versions in the set.\n\n        >>> list(SpecifierSet(\"\").filter([\"1.3\", \"1.5a1\"]))\n        ['1.3']\n        >>> list(SpecifierSet(\"\").filter([\"1.5a1\"]))\n        ['1.5a1']\n        >>> list(SpecifierSet(\"\", prereleases=True).filter([\"1.3\", \"1.5a1\"]))\n        ['1.3', '1.5a1']\n        >>> list(SpecifierSet(\"\").filter([\"1.3\", \"1.5a1\"], prereleases=True))\n        ['1.3', '1.5a1']\n        \"\"\"\n        # Determine if we're forcing a prerelease or not, if we're not forcing\n        # one for this particular filter call, then we'll use whatever the\n        # SpecifierSet thinks for whether or not we should support prereleases.\n        if prereleases is None:\n            prereleases = self.prereleases\n\n        # If we have any specifiers, then we want to wrap our iterable in the\n        # filter method for each one, this will act as a logical AND amongst\n        # each specifier.\n        if self._specs:\n            for spec in self._specs:\n                iterable = spec.filter(iterable, prereleases=bool(prereleases))\n            return iter(iterable)\n        # If we do not have any specifiers, then we need to have a rough filter\n        # which will filter out any pre-releases, unless there are no final\n        # releases.\n        else:\n            filtered: List[UnparsedVersionVar] = []\n            found_prereleases: List[UnparsedVersionVar] = []\n\n            for item in iterable:\n                parsed_version = _coerce_version(item)\n\n                # Store any item which is a pre-release for later unless we've\n                # already found a final version or we are accepting prereleases\n                if parsed_version.is_prerelease and not prereleases:\n                    if not filtered:\n                        found_prereleases.append(item)\n                else:\n                    filtered.append(item)\n\n            # If we've found no items except for pre-releases, then we'll go\n            # ahead and use the pre-releases\n            if not filtered and found_prereleases and prereleases is None:\n                return iter(found_prereleases)\n\n            return iter(filtered)\n"
  },
  {
    "path": "gyp/pylib/packaging/tags.py",
    "content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nimport logging\nimport platform\nimport struct\nimport subprocess\nimport sys\nimport sysconfig\nfrom importlib.machinery import EXTENSION_SUFFIXES\nfrom typing import (\n    Dict,\n    FrozenSet,\n    Iterable,\n    Iterator,\n    List,\n    Optional,\n    Sequence,\n    Tuple,\n    Union,\n    cast,\n)\n\nfrom . import _manylinux, _musllinux\n\nlogger = logging.getLogger(__name__)\n\nPythonVersion = Sequence[int]\nMacVersion = Tuple[int, int]\n\nINTERPRETER_SHORT_NAMES: Dict[str, str] = {\n    \"python\": \"py\",  # Generic.\n    \"cpython\": \"cp\",\n    \"pypy\": \"pp\",\n    \"ironpython\": \"ip\",\n    \"jython\": \"jy\",\n}\n\n\n_32_BIT_INTERPRETER = struct.calcsize(\"P\") == 4\n\n\nclass Tag:\n    \"\"\"\n    A representation of the tag triple for a wheel.\n\n    Instances are considered immutable and thus are hashable. Equality checking\n    is also supported.\n    \"\"\"\n\n    __slots__ = [\"_interpreter\", \"_abi\", \"_platform\", \"_hash\"]\n\n    def __init__(self, interpreter: str, abi: str, platform: str) -> None:\n        self._interpreter = interpreter.lower()\n        self._abi = abi.lower()\n        self._platform = platform.lower()\n        # The __hash__ of every single element in a Set[Tag] will be evaluated each time\n        # that a set calls its `.disjoint()` method, which may be called hundreds of\n        # times when scanning a page of links for packages with tags matching that\n        # Set[Tag]. Pre-computing the value here produces significant speedups for\n        # downstream consumers.\n        self._hash = hash((self._interpreter, self._abi, self._platform))\n\n    @property\n    def interpreter(self) -> str:\n        return self._interpreter\n\n    @property\n    def abi(self) -> str:\n        return self._abi\n\n    @property\n    def platform(self) -> str:\n        return self._platform\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, Tag):\n            return NotImplemented\n\n        return (\n            (self._hash == other._hash)  # Short-circuit ASAP for perf reasons.\n            and (self._platform == other._platform)\n            and (self._abi == other._abi)\n            and (self._interpreter == other._interpreter)\n        )\n\n    def __hash__(self) -> int:\n        return self._hash\n\n    def __str__(self) -> str:\n        return f\"{self._interpreter}-{self._abi}-{self._platform}\"\n\n    def __repr__(self) -> str:\n        return f\"<{self} @ {id(self)}>\"\n\n\ndef parse_tag(tag: str) -> FrozenSet[Tag]:\n    \"\"\"\n    Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances.\n\n    Returning a set is required due to the possibility that the tag is a\n    compressed tag set.\n    \"\"\"\n    tags = set()\n    interpreters, abis, platforms = tag.split(\"-\")\n    for interpreter in interpreters.split(\".\"):\n        for abi in abis.split(\".\"):\n            for platform_ in platforms.split(\".\"):\n                tags.add(Tag(interpreter, abi, platform_))\n    return frozenset(tags)\n\n\ndef _get_config_var(name: str, warn: bool = False) -> Union[int, str, None]:\n    value: Union[int, str, None] = sysconfig.get_config_var(name)\n    if value is None and warn:\n        logger.debug(\n            \"Config variable '%s' is unset, Python ABI tag may be incorrect\", name\n        )\n    return value\n\n\ndef _normalize_string(string: str) -> str:\n    return string.replace(\".\", \"_\").replace(\"-\", \"_\").replace(\" \", \"_\")\n\n\ndef _abi3_applies(python_version: PythonVersion) -> bool:\n    \"\"\"\n    Determine if the Python version supports abi3.\n\n    PEP 384 was first implemented in Python 3.2.\n    \"\"\"\n    return len(python_version) > 1 and tuple(python_version) >= (3, 2)\n\n\ndef _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]:\n    py_version = tuple(py_version)  # To allow for version comparison.\n    abis = []\n    version = _version_nodot(py_version[:2])\n    debug = pymalloc = ucs4 = \"\"\n    with_debug = _get_config_var(\"Py_DEBUG\", warn)\n    has_refcount = hasattr(sys, \"gettotalrefcount\")\n    # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled\n    # extension modules is the best option.\n    # https://github.com/pypa/pip/issues/3383#issuecomment-173267692\n    has_ext = \"_d.pyd\" in EXTENSION_SUFFIXES\n    if with_debug or (with_debug is None and (has_refcount or has_ext)):\n        debug = \"d\"\n    if py_version < (3, 8):\n        with_pymalloc = _get_config_var(\"WITH_PYMALLOC\", warn)\n        if with_pymalloc or with_pymalloc is None:\n            pymalloc = \"m\"\n        if py_version < (3, 3):\n            unicode_size = _get_config_var(\"Py_UNICODE_SIZE\", warn)\n            if unicode_size == 4 or (\n                unicode_size is None and sys.maxunicode == 0x10FFFF\n            ):\n                ucs4 = \"u\"\n    elif debug:\n        # Debug builds can also load \"normal\" extension modules.\n        # We can also assume no UCS-4 or pymalloc requirement.\n        abis.append(f\"cp{version}\")\n    abis.insert(\n        0,\n        \"cp{version}{debug}{pymalloc}{ucs4}\".format(\n            version=version, debug=debug, pymalloc=pymalloc, ucs4=ucs4\n        ),\n    )\n    return abis\n\n\ndef cpython_tags(\n    python_version: Optional[PythonVersion] = None,\n    abis: Optional[Iterable[str]] = None,\n    platforms: Optional[Iterable[str]] = None,\n    *,\n    warn: bool = False,\n) -> Iterator[Tag]:\n    \"\"\"\n    Yields the tags for a CPython interpreter.\n\n    The tags consist of:\n    - cp<python_version>-<abi>-<platform>\n    - cp<python_version>-abi3-<platform>\n    - cp<python_version>-none-<platform>\n    - cp<less than python_version>-abi3-<platform>  # Older Python versions down to 3.2.\n\n    If python_version only specifies a major version then user-provided ABIs and\n    the 'none' ABItag will be used.\n\n    If 'abi3' or 'none' are specified in 'abis' then they will be yielded at\n    their normal position and not at the beginning.\n    \"\"\"\n    if not python_version:\n        python_version = sys.version_info[:2]\n\n    interpreter = f\"cp{_version_nodot(python_version[:2])}\"\n\n    if abis is None:\n        if len(python_version) > 1:\n            abis = _cpython_abis(python_version, warn)\n        else:\n            abis = []\n    abis = list(abis)\n    # 'abi3' and 'none' are explicitly handled later.\n    for explicit_abi in (\"abi3\", \"none\"):\n        try:\n            abis.remove(explicit_abi)\n        except ValueError:\n            pass\n\n    platforms = list(platforms or platform_tags())\n    for abi in abis:\n        for platform_ in platforms:\n            yield Tag(interpreter, abi, platform_)\n    if _abi3_applies(python_version):\n        yield from (Tag(interpreter, \"abi3\", platform_) for platform_ in platforms)\n    yield from (Tag(interpreter, \"none\", platform_) for platform_ in platforms)\n\n    if _abi3_applies(python_version):\n        for minor_version in range(python_version[1] - 1, 1, -1):\n            for platform_ in platforms:\n                interpreter = \"cp{version}\".format(\n                    version=_version_nodot((python_version[0], minor_version))\n                )\n                yield Tag(interpreter, \"abi3\", platform_)\n\n\ndef _generic_abi() -> List[str]:\n    \"\"\"\n    Return the ABI tag based on EXT_SUFFIX.\n    \"\"\"\n    # The following are examples of `EXT_SUFFIX`.\n    # We want to keep the parts which are related to the ABI and remove the\n    # parts which are related to the platform:\n    # - linux:   '.cpython-310-x86_64-linux-gnu.so' => cp310\n    # - mac:     '.cpython-310-darwin.so'           => cp310\n    # - win:     '.cp310-win_amd64.pyd'             => cp310\n    # - win:     '.pyd'                             => cp37 (uses _cpython_abis())\n    # - pypy:    '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73\n    # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'\n    #                                               => graalpy_38_native\n\n    ext_suffix = _get_config_var(\"EXT_SUFFIX\", warn=True)\n    if not isinstance(ext_suffix, str) or ext_suffix[0] != \".\":\n        raise SystemError(\"invalid sysconfig.get_config_var('EXT_SUFFIX')\")\n    parts = ext_suffix.split(\".\")\n    if len(parts) < 3:\n        # CPython3.7 and earlier uses \".pyd\" on Windows.\n        return _cpython_abis(sys.version_info[:2])\n    soabi = parts[1]\n    if soabi.startswith(\"cpython\"):\n        # non-windows\n        abi = \"cp\" + soabi.split(\"-\")[1]\n    elif soabi.startswith(\"cp\"):\n        # windows\n        abi = soabi.split(\"-\")[0]\n    elif soabi.startswith(\"pypy\"):\n        abi = \"-\".join(soabi.split(\"-\")[:2])\n    elif soabi.startswith(\"graalpy\"):\n        abi = \"-\".join(soabi.split(\"-\")[:3])\n    elif soabi:\n        # pyston, ironpython, others?\n        abi = soabi\n    else:\n        return []\n    return [_normalize_string(abi)]\n\n\ndef generic_tags(\n    interpreter: Optional[str] = None,\n    abis: Optional[Iterable[str]] = None,\n    platforms: Optional[Iterable[str]] = None,\n    *,\n    warn: bool = False,\n) -> Iterator[Tag]:\n    \"\"\"\n    Yields the tags for a generic interpreter.\n\n    The tags consist of:\n    - <interpreter>-<abi>-<platform>\n\n    The \"none\" ABI will be added if it was not explicitly provided.\n    \"\"\"\n    if not interpreter:\n        interp_name = interpreter_name()\n        interp_version = interpreter_version(warn=warn)\n        interpreter = \"\".join([interp_name, interp_version])\n    if abis is None:\n        abis = _generic_abi()\n    else:\n        abis = list(abis)\n    platforms = list(platforms or platform_tags())\n    if \"none\" not in abis:\n        abis.append(\"none\")\n    for abi in abis:\n        for platform_ in platforms:\n            yield Tag(interpreter, abi, platform_)\n\n\ndef _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]:\n    \"\"\"\n    Yields Python versions in descending order.\n\n    After the latest version, the major-only version will be yielded, and then\n    all previous versions of that major version.\n    \"\"\"\n    if len(py_version) > 1:\n        yield f\"py{_version_nodot(py_version[:2])}\"\n    yield f\"py{py_version[0]}\"\n    if len(py_version) > 1:\n        for minor in range(py_version[1] - 1, -1, -1):\n            yield f\"py{_version_nodot((py_version[0], minor))}\"\n\n\ndef compatible_tags(\n    python_version: Optional[PythonVersion] = None,\n    interpreter: Optional[str] = None,\n    platforms: Optional[Iterable[str]] = None,\n) -> Iterator[Tag]:\n    \"\"\"\n    Yields the sequence of tags that are compatible with a specific version of Python.\n\n    The tags consist of:\n    - py*-none-<platform>\n    - <interpreter>-none-any  # ... if `interpreter` is provided.\n    - py*-none-any\n    \"\"\"\n    if not python_version:\n        python_version = sys.version_info[:2]\n    platforms = list(platforms or platform_tags())\n    for version in _py_interpreter_range(python_version):\n        for platform_ in platforms:\n            yield Tag(version, \"none\", platform_)\n    if interpreter:\n        yield Tag(interpreter, \"none\", \"any\")\n    for version in _py_interpreter_range(python_version):\n        yield Tag(version, \"none\", \"any\")\n\n\ndef _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str:\n    if not is_32bit:\n        return arch\n\n    if arch.startswith(\"ppc\"):\n        return \"ppc\"\n\n    return \"i386\"\n\n\ndef _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]:\n    formats = [cpu_arch]\n    if cpu_arch == \"x86_64\":\n        if version < (10, 4):\n            return []\n        formats.extend([\"intel\", \"fat64\", \"fat32\"])\n\n    elif cpu_arch == \"i386\":\n        if version < (10, 4):\n            return []\n        formats.extend([\"intel\", \"fat32\", \"fat\"])\n\n    elif cpu_arch == \"ppc64\":\n        # TODO: Need to care about 32-bit PPC for ppc64 through 10.2?\n        if version > (10, 5) or version < (10, 4):\n            return []\n        formats.append(\"fat64\")\n\n    elif cpu_arch == \"ppc\":\n        if version > (10, 6):\n            return []\n        formats.extend([\"fat32\", \"fat\"])\n\n    if cpu_arch in {\"arm64\", \"x86_64\"}:\n        formats.append(\"universal2\")\n\n    if cpu_arch in {\"x86_64\", \"i386\", \"ppc64\", \"ppc\", \"intel\"}:\n        formats.append(\"universal\")\n\n    return formats\n\n\ndef mac_platforms(\n    version: Optional[MacVersion] = None, arch: Optional[str] = None\n) -> Iterator[str]:\n    \"\"\"\n    Yields the platform tags for a macOS system.\n\n    The `version` parameter is a two-item tuple specifying the macOS version to\n    generate platform tags for. The `arch` parameter is the CPU architecture to\n    generate platform tags for. Both parameters default to the appropriate value\n    for the current system.\n    \"\"\"\n    version_str, _, cpu_arch = platform.mac_ver()\n    if version is None:\n        version = cast(\"MacVersion\", tuple(map(int, version_str.split(\".\")[:2])))\n        if version == (10, 16):\n            # When built against an older macOS SDK, Python will report macOS 10.16\n            # instead of the real version.\n            version_str = subprocess.run(\n                [\n                    sys.executable,\n                    \"-sS\",\n                    \"-c\",\n                    \"import platform; print(platform.mac_ver()[0])\",\n                ],\n                check=True,\n                env={\"SYSTEM_VERSION_COMPAT\": \"0\"},\n                stdout=subprocess.PIPE,\n                text=True,\n            ).stdout\n            version = cast(\"MacVersion\", tuple(map(int, version_str.split(\".\")[:2])))\n    else:\n        version = version\n    if arch is None:\n        arch = _mac_arch(cpu_arch)\n    else:\n        arch = arch\n\n    if (10, 0) <= version and version < (11, 0):\n        # Prior to Mac OS 11, each yearly release of Mac OS bumped the\n        # \"minor\" version number.  The major version was always 10.\n        for minor_version in range(version[1], -1, -1):\n            compat_version = 10, minor_version\n            binary_formats = _mac_binary_formats(compat_version, arch)\n            for binary_format in binary_formats:\n                yield \"macosx_{major}_{minor}_{binary_format}\".format(\n                    major=10, minor=minor_version, binary_format=binary_format\n                )\n\n    if version >= (11, 0):\n        # Starting with Mac OS 11, each yearly release bumps the major version\n        # number.   The minor versions are now the midyear updates.\n        for major_version in range(version[0], 10, -1):\n            compat_version = major_version, 0\n            binary_formats = _mac_binary_formats(compat_version, arch)\n            for binary_format in binary_formats:\n                yield \"macosx_{major}_{minor}_{binary_format}\".format(\n                    major=major_version, minor=0, binary_format=binary_format\n                )\n\n    if version >= (11, 0):\n        # Mac OS 11 on x86_64 is compatible with binaries from previous releases.\n        # Arm64 support was introduced in 11.0, so no Arm binaries from previous\n        # releases exist.\n        #\n        # However, the \"universal2\" binary format can have a\n        # macOS version earlier than 11.0 when the x86_64 part of the binary supports\n        # that version of macOS.\n        if arch == \"x86_64\":\n            for minor_version in range(16, 3, -1):\n                compat_version = 10, minor_version\n                binary_formats = _mac_binary_formats(compat_version, arch)\n                for binary_format in binary_formats:\n                    yield \"macosx_{major}_{minor}_{binary_format}\".format(\n                        major=compat_version[0],\n                        minor=compat_version[1],\n                        binary_format=binary_format,\n                    )\n        else:\n            for minor_version in range(16, 3, -1):\n                compat_version = 10, minor_version\n                binary_format = \"universal2\"\n                yield \"macosx_{major}_{minor}_{binary_format}\".format(\n                    major=compat_version[0],\n                    minor=compat_version[1],\n                    binary_format=binary_format,\n                )\n\n\ndef _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]:\n    linux = _normalize_string(sysconfig.get_platform())\n    if not linux.startswith(\"linux_\"):\n        # we should never be here, just yield the sysconfig one and return\n        yield linux\n        return\n    if is_32bit:\n        if linux == \"linux_x86_64\":\n            linux = \"linux_i686\"\n        elif linux == \"linux_aarch64\":\n            linux = \"linux_armv8l\"\n    _, arch = linux.split(\"_\", 1)\n    archs = {\"armv8l\": [\"armv8l\", \"armv7l\"]}.get(arch, [arch])\n    yield from _manylinux.platform_tags(archs)\n    yield from _musllinux.platform_tags(archs)\n    for arch in archs:\n        yield f\"linux_{arch}\"\n\n\ndef _generic_platforms() -> Iterator[str]:\n    yield _normalize_string(sysconfig.get_platform())\n\n\ndef platform_tags() -> Iterator[str]:\n    \"\"\"\n    Provides the platform tags for this installation.\n    \"\"\"\n    if platform.system() == \"Darwin\":\n        return mac_platforms()\n    elif platform.system() == \"Linux\":\n        return _linux_platforms()\n    else:\n        return _generic_platforms()\n\n\ndef interpreter_name() -> str:\n    \"\"\"\n    Returns the name of the running interpreter.\n\n    Some implementations have a reserved, two-letter abbreviation which will\n    be returned when appropriate.\n    \"\"\"\n    name = sys.implementation.name\n    return INTERPRETER_SHORT_NAMES.get(name) or name\n\n\ndef interpreter_version(*, warn: bool = False) -> str:\n    \"\"\"\n    Returns the version of the running interpreter.\n    \"\"\"\n    version = _get_config_var(\"py_version_nodot\", warn=warn)\n    if version:\n        version = str(version)\n    else:\n        version = _version_nodot(sys.version_info[:2])\n    return version\n\n\ndef _version_nodot(version: PythonVersion) -> str:\n    return \"\".join(map(str, version))\n\n\ndef sys_tags(*, warn: bool = False) -> Iterator[Tag]:\n    \"\"\"\n    Returns the sequence of tag triples for the running interpreter.\n\n    The order of the sequence corresponds to priority order for the\n    interpreter, from most to least important.\n    \"\"\"\n\n    interp_name = interpreter_name()\n    if interp_name == \"cp\":\n        yield from cpython_tags(warn=warn)\n    else:\n        yield from generic_tags()\n\n    if interp_name == \"pp\":\n        interp = \"pp3\"\n    elif interp_name == \"cp\":\n        interp = \"cp\" + interpreter_version(warn=warn)\n    else:\n        interp = None\n    yield from compatible_tags(interpreter=interp)\n"
  },
  {
    "path": "gyp/pylib/packaging/utils.py",
    "content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nimport re\nfrom typing import FrozenSet, NewType, Tuple, Union, cast\n\nfrom .tags import Tag, parse_tag\nfrom .version import InvalidVersion, Version\n\nBuildTag = Union[Tuple[()], Tuple[int, str]]\nNormalizedName = NewType(\"NormalizedName\", str)\n\n\nclass InvalidName(ValueError):\n    \"\"\"\n    An invalid distribution name; users should refer to the packaging user guide.\n    \"\"\"\n\n\nclass InvalidWheelFilename(ValueError):\n    \"\"\"\n    An invalid wheel filename was found, users should refer to PEP 427.\n    \"\"\"\n\n\nclass InvalidSdistFilename(ValueError):\n    \"\"\"\n    An invalid sdist filename was found, users should refer to the packaging user guide.\n    \"\"\"\n\n\n# Core metadata spec for `Name`\n_validate_regex = re.compile(\n    r\"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$\", re.IGNORECASE\n)\n_canonicalize_regex = re.compile(r\"[-_.]+\")\n_normalized_regex = re.compile(r\"^([a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9])$\")\n# PEP 427: The build number must start with a digit.\n_build_tag_regex = re.compile(r\"(\\d+)(.*)\")\n\n\ndef canonicalize_name(name: str, *, validate: bool = False) -> NormalizedName:\n    if validate and not _validate_regex.match(name):\n        raise InvalidName(f\"name is invalid: {name!r}\")\n    # This is taken from PEP 503.\n    value = _canonicalize_regex.sub(\"-\", name).lower()\n    return cast(NormalizedName, value)\n\n\ndef is_normalized_name(name: str) -> bool:\n    return _normalized_regex.match(name) is not None\n\n\ndef canonicalize_version(\n    version: Union[Version, str], *, strip_trailing_zero: bool = True\n) -> str:\n    \"\"\"\n    This is very similar to Version.__str__, but has one subtle difference\n    with the way it handles the release segment.\n    \"\"\"\n    if isinstance(version, str):\n        try:\n            parsed = Version(version)\n        except InvalidVersion:\n            # Legacy versions cannot be normalized\n            return version\n    else:\n        parsed = version\n\n    parts = []\n\n    # Epoch\n    if parsed.epoch != 0:\n        parts.append(f\"{parsed.epoch}!\")\n\n    # Release segment\n    release_segment = \".\".join(str(x) for x in parsed.release)\n    if strip_trailing_zero:\n        # NB: This strips trailing '.0's to normalize\n        release_segment = re.sub(r\"(\\.0)+$\", \"\", release_segment)\n    parts.append(release_segment)\n\n    # Pre-release\n    if parsed.pre is not None:\n        parts.append(\"\".join(str(x) for x in parsed.pre))\n\n    # Post-release\n    if parsed.post is not None:\n        parts.append(f\".post{parsed.post}\")\n\n    # Development release\n    if parsed.dev is not None:\n        parts.append(f\".dev{parsed.dev}\")\n\n    # Local version segment\n    if parsed.local is not None:\n        parts.append(f\"+{parsed.local}\")\n\n    return \"\".join(parts)\n\n\ndef parse_wheel_filename(\n    filename: str,\n) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]:\n    if not filename.endswith(\".whl\"):\n        raise InvalidWheelFilename(\n            f\"Invalid wheel filename (extension must be '.whl'): {filename}\"\n        )\n\n    filename = filename[:-4]\n    dashes = filename.count(\"-\")\n    if dashes not in (4, 5):\n        raise InvalidWheelFilename(\n            f\"Invalid wheel filename (wrong number of parts): {filename}\"\n        )\n\n    parts = filename.split(\"-\", dashes - 2)\n    name_part = parts[0]\n    # See PEP 427 for the rules on escaping the project name.\n    if \"__\" in name_part or re.match(r\"^[\\w\\d._]*$\", name_part, re.UNICODE) is None:\n        raise InvalidWheelFilename(f\"Invalid project name: {filename}\")\n    name = canonicalize_name(name_part)\n\n    try:\n        version = Version(parts[1])\n    except InvalidVersion as e:\n        raise InvalidWheelFilename(\n            f\"Invalid wheel filename (invalid version): {filename}\"\n        ) from e\n\n    if dashes == 5:\n        build_part = parts[2]\n        build_match = _build_tag_regex.match(build_part)\n        if build_match is None:\n            raise InvalidWheelFilename(\n                f\"Invalid build number: {build_part} in '{filename}'\"\n            )\n        build = cast(BuildTag, (int(build_match.group(1)), build_match.group(2)))\n    else:\n        build = ()\n    tags = parse_tag(parts[-1])\n    return (name, version, build, tags)\n\n\ndef parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]:\n    if filename.endswith(\".tar.gz\"):\n        file_stem = filename[: -len(\".tar.gz\")]\n    elif filename.endswith(\".zip\"):\n        file_stem = filename[: -len(\".zip\")]\n    else:\n        raise InvalidSdistFilename(\n            f\"Invalid sdist filename (extension must be '.tar.gz' or '.zip'):\"\n            f\" {filename}\"\n        )\n\n    # We are requiring a PEP 440 version, which cannot contain dashes,\n    # so we split on the last dash.\n    name_part, sep, version_part = file_stem.rpartition(\"-\")\n    if not sep:\n        raise InvalidSdistFilename(f\"Invalid sdist filename: {filename}\")\n\n    name = canonicalize_name(name_part)\n\n    try:\n        version = Version(version_part)\n    except InvalidVersion as e:\n        raise InvalidSdistFilename(\n            f\"Invalid sdist filename (invalid version): {filename}\"\n        ) from e\n\n    return (name, version)\n"
  },
  {
    "path": "gyp/pylib/packaging/version.py",
    "content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\"\"\"\n.. testsetup::\n\n    from packaging.version import parse, Version\n\"\"\"\n\nimport itertools\nimport re\nfrom typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union\n\nfrom ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType\n\n__all__ = [\"VERSION_PATTERN\", \"parse\", \"Version\", \"InvalidVersion\"]\n\nLocalType = Tuple[Union[int, str], ...]\n\nCmpPrePostDevType = Union[InfinityType, NegativeInfinityType, Tuple[str, int]]\nCmpLocalType = Union[\n    NegativeInfinityType,\n    Tuple[Union[Tuple[int, str], Tuple[NegativeInfinityType, Union[int, str]]], ...],\n]\nCmpKey = Tuple[\n    int,\n    Tuple[int, ...],\n    CmpPrePostDevType,\n    CmpPrePostDevType,\n    CmpPrePostDevType,\n    CmpLocalType,\n]\nVersionComparisonMethod = Callable[[CmpKey, CmpKey], bool]\n\n\nclass _Version(NamedTuple):\n    epoch: int\n    release: Tuple[int, ...]\n    dev: Optional[Tuple[str, int]]\n    pre: Optional[Tuple[str, int]]\n    post: Optional[Tuple[str, int]]\n    local: Optional[LocalType]\n\n\ndef parse(version: str) -> \"Version\":\n    \"\"\"Parse the given version string.\n\n    >>> parse('1.0.dev1')\n    <Version('1.0.dev1')>\n\n    :param version: The version string to parse.\n    :raises InvalidVersion: When the version string is not a valid version.\n    \"\"\"\n    return Version(version)\n\n\nclass InvalidVersion(ValueError):\n    \"\"\"Raised when a version string is not a valid version.\n\n    >>> Version(\"invalid\")\n    Traceback (most recent call last):\n        ...\n    packaging.version.InvalidVersion: Invalid version: 'invalid'\n    \"\"\"\n\n\nclass _BaseVersion:\n    _key: Tuple[Any, ...]\n\n    def __hash__(self) -> int:\n        return hash(self._key)\n\n    # Please keep the duplicated `isinstance` check\n    # in the six comparisons hereunder\n    # unless you find a way to avoid adding overhead function calls.\n    def __lt__(self, other: \"_BaseVersion\") -> bool:\n        if not isinstance(other, _BaseVersion):\n            return NotImplemented\n\n        return self._key < other._key\n\n    def __le__(self, other: \"_BaseVersion\") -> bool:\n        if not isinstance(other, _BaseVersion):\n            return NotImplemented\n\n        return self._key <= other._key\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, _BaseVersion):\n            return NotImplemented\n\n        return self._key == other._key\n\n    def __ge__(self, other: \"_BaseVersion\") -> bool:\n        if not isinstance(other, _BaseVersion):\n            return NotImplemented\n\n        return self._key >= other._key\n\n    def __gt__(self, other: \"_BaseVersion\") -> bool:\n        if not isinstance(other, _BaseVersion):\n            return NotImplemented\n\n        return self._key > other._key\n\n    def __ne__(self, other: object) -> bool:\n        if not isinstance(other, _BaseVersion):\n            return NotImplemented\n\n        return self._key != other._key\n\n\n# Deliberately not anchored to the start and end of the string, to make it\n# easier for 3rd party code to reuse\n_VERSION_PATTERN = r\"\"\"\n    v?\n    (?:\n        (?:(?P<epoch>[0-9]+)!)?                           # epoch\n        (?P<release>[0-9]+(?:\\.[0-9]+)*)                  # release segment\n        (?P<pre>                                          # pre-release\n            [-_\\.]?\n            (?P<pre_l>alpha|a|beta|b|preview|pre|c|rc)\n            [-_\\.]?\n            (?P<pre_n>[0-9]+)?\n        )?\n        (?P<post>                                         # post release\n            (?:-(?P<post_n1>[0-9]+))\n            |\n            (?:\n                [-_\\.]?\n                (?P<post_l>post|rev|r)\n                [-_\\.]?\n                (?P<post_n2>[0-9]+)?\n            )\n        )?\n        (?P<dev>                                          # dev release\n            [-_\\.]?\n            (?P<dev_l>dev)\n            [-_\\.]?\n            (?P<dev_n>[0-9]+)?\n        )?\n    )\n    (?:\\+(?P<local>[a-z0-9]+(?:[-_\\.][a-z0-9]+)*))?       # local version\n\"\"\"\n\nVERSION_PATTERN = _VERSION_PATTERN\n\"\"\"\nA string containing the regular expression used to match a valid version.\n\nThe pattern is not anchored at either end, and is intended for embedding in larger\nexpressions (for example, matching a version number as part of a file name). The\nregular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``\nflags set.\n\n:meta hide-value:\n\"\"\"\n\n\nclass Version(_BaseVersion):\n    \"\"\"This class abstracts handling of a project's versions.\n\n    A :class:`Version` instance is comparison aware and can be compared and\n    sorted using the standard Python interfaces.\n\n    >>> v1 = Version(\"1.0a5\")\n    >>> v2 = Version(\"1.0\")\n    >>> v1\n    <Version('1.0a5')>\n    >>> v2\n    <Version('1.0')>\n    >>> v1 < v2\n    True\n    >>> v1 == v2\n    False\n    >>> v1 > v2\n    False\n    >>> v1 >= v2\n    False\n    >>> v1 <= v2\n    True\n    \"\"\"\n\n    _regex = re.compile(r\"^\\s*\" + VERSION_PATTERN + r\"\\s*$\", re.VERBOSE | re.IGNORECASE)\n    _key: CmpKey\n\n    def __init__(self, version: str) -> None:\n        \"\"\"Initialize a Version object.\n\n        :param version:\n            The string representation of a version which will be parsed and normalized\n            before use.\n        :raises InvalidVersion:\n            If the ``version`` does not conform to PEP 440 in any way then this\n            exception will be raised.\n        \"\"\"\n\n        # Validate the version and parse it into pieces\n        match = self._regex.search(version)\n        if not match:\n            raise InvalidVersion(f\"Invalid version: '{version}'\")\n\n        # Store the parsed out pieces of the version\n        self._version = _Version(\n            epoch=int(match.group(\"epoch\")) if match.group(\"epoch\") else 0,\n            release=tuple(int(i) for i in match.group(\"release\").split(\".\")),\n            pre=_parse_letter_version(match.group(\"pre_l\"), match.group(\"pre_n\")),\n            post=_parse_letter_version(\n                match.group(\"post_l\"), match.group(\"post_n1\") or match.group(\"post_n2\")\n            ),\n            dev=_parse_letter_version(match.group(\"dev_l\"), match.group(\"dev_n\")),\n            local=_parse_local_version(match.group(\"local\")),\n        )\n\n        # Generate a key which will be used for sorting\n        self._key = _cmpkey(\n            self._version.epoch,\n            self._version.release,\n            self._version.pre,\n            self._version.post,\n            self._version.dev,\n            self._version.local,\n        )\n\n    def __repr__(self) -> str:\n        \"\"\"A representation of the Version that shows all internal state.\n\n        >>> Version('1.0.0')\n        <Version('1.0.0')>\n        \"\"\"\n        return f\"<Version('{self}')>\"\n\n    def __str__(self) -> str:\n        \"\"\"A string representation of the version that can be rounded-tripped.\n\n        >>> str(Version(\"1.0a5\"))\n        '1.0a5'\n        \"\"\"\n        parts = []\n\n        # Epoch\n        if self.epoch != 0:\n            parts.append(f\"{self.epoch}!\")\n\n        # Release segment\n        parts.append(\".\".join(str(x) for x in self.release))\n\n        # Pre-release\n        if self.pre is not None:\n            parts.append(\"\".join(str(x) for x in self.pre))\n\n        # Post-release\n        if self.post is not None:\n            parts.append(f\".post{self.post}\")\n\n        # Development release\n        if self.dev is not None:\n            parts.append(f\".dev{self.dev}\")\n\n        # Local version segment\n        if self.local is not None:\n            parts.append(f\"+{self.local}\")\n\n        return \"\".join(parts)\n\n    @property\n    def epoch(self) -> int:\n        \"\"\"The epoch of the version.\n\n        >>> Version(\"2.0.0\").epoch\n        0\n        >>> Version(\"1!2.0.0\").epoch\n        1\n        \"\"\"\n        return self._version.epoch\n\n    @property\n    def release(self) -> Tuple[int, ...]:\n        \"\"\"The components of the \"release\" segment of the version.\n\n        >>> Version(\"1.2.3\").release\n        (1, 2, 3)\n        >>> Version(\"2.0.0\").release\n        (2, 0, 0)\n        >>> Version(\"1!2.0.0.post0\").release\n        (2, 0, 0)\n\n        Includes trailing zeroes but not the epoch or any pre-release / development /\n        post-release suffixes.\n        \"\"\"\n        return self._version.release\n\n    @property\n    def pre(self) -> Optional[Tuple[str, int]]:\n        \"\"\"The pre-release segment of the version.\n\n        >>> print(Version(\"1.2.3\").pre)\n        None\n        >>> Version(\"1.2.3a1\").pre\n        ('a', 1)\n        >>> Version(\"1.2.3b1\").pre\n        ('b', 1)\n        >>> Version(\"1.2.3rc1\").pre\n        ('rc', 1)\n        \"\"\"\n        return self._version.pre\n\n    @property\n    def post(self) -> Optional[int]:\n        \"\"\"The post-release number of the version.\n\n        >>> print(Version(\"1.2.3\").post)\n        None\n        >>> Version(\"1.2.3.post1\").post\n        1\n        \"\"\"\n        return self._version.post[1] if self._version.post else None\n\n    @property\n    def dev(self) -> Optional[int]:\n        \"\"\"The development number of the version.\n\n        >>> print(Version(\"1.2.3\").dev)\n        None\n        >>> Version(\"1.2.3.dev1\").dev\n        1\n        \"\"\"\n        return self._version.dev[1] if self._version.dev else None\n\n    @property\n    def local(self) -> Optional[str]:\n        \"\"\"The local version segment of the version.\n\n        >>> print(Version(\"1.2.3\").local)\n        None\n        >>> Version(\"1.2.3+abc\").local\n        'abc'\n        \"\"\"\n        if self._version.local:\n            return \".\".join(str(x) for x in self._version.local)\n        else:\n            return None\n\n    @property\n    def public(self) -> str:\n        \"\"\"The public portion of the version.\n\n        >>> Version(\"1.2.3\").public\n        '1.2.3'\n        >>> Version(\"1.2.3+abc\").public\n        '1.2.3'\n        >>> Version(\"1.2.3+abc.dev1\").public\n        '1.2.3'\n        \"\"\"\n        return str(self).split(\"+\", 1)[0]\n\n    @property\n    def base_version(self) -> str:\n        \"\"\"The \"base version\" of the version.\n\n        >>> Version(\"1.2.3\").base_version\n        '1.2.3'\n        >>> Version(\"1.2.3+abc\").base_version\n        '1.2.3'\n        >>> Version(\"1!1.2.3+abc.dev1\").base_version\n        '1!1.2.3'\n\n        The \"base version\" is the public version of the project without any pre or post\n        release markers.\n        \"\"\"\n        parts = []\n\n        # Epoch\n        if self.epoch != 0:\n            parts.append(f\"{self.epoch}!\")\n\n        # Release segment\n        parts.append(\".\".join(str(x) for x in self.release))\n\n        return \"\".join(parts)\n\n    @property\n    def is_prerelease(self) -> bool:\n        \"\"\"Whether this version is a pre-release.\n\n        >>> Version(\"1.2.3\").is_prerelease\n        False\n        >>> Version(\"1.2.3a1\").is_prerelease\n        True\n        >>> Version(\"1.2.3b1\").is_prerelease\n        True\n        >>> Version(\"1.2.3rc1\").is_prerelease\n        True\n        >>> Version(\"1.2.3dev1\").is_prerelease\n        True\n        \"\"\"\n        return self.dev is not None or self.pre is not None\n\n    @property\n    def is_postrelease(self) -> bool:\n        \"\"\"Whether this version is a post-release.\n\n        >>> Version(\"1.2.3\").is_postrelease\n        False\n        >>> Version(\"1.2.3.post1\").is_postrelease\n        True\n        \"\"\"\n        return self.post is not None\n\n    @property\n    def is_devrelease(self) -> bool:\n        \"\"\"Whether this version is a development release.\n\n        >>> Version(\"1.2.3\").is_devrelease\n        False\n        >>> Version(\"1.2.3.dev1\").is_devrelease\n        True\n        \"\"\"\n        return self.dev is not None\n\n    @property\n    def major(self) -> int:\n        \"\"\"The first item of :attr:`release` or ``0`` if unavailable.\n\n        >>> Version(\"1.2.3\").major\n        1\n        \"\"\"\n        return self.release[0] if len(self.release) >= 1 else 0\n\n    @property\n    def minor(self) -> int:\n        \"\"\"The second item of :attr:`release` or ``0`` if unavailable.\n\n        >>> Version(\"1.2.3\").minor\n        2\n        >>> Version(\"1\").minor\n        0\n        \"\"\"\n        return self.release[1] if len(self.release) >= 2 else 0\n\n    @property\n    def micro(self) -> int:\n        \"\"\"The third item of :attr:`release` or ``0`` if unavailable.\n\n        >>> Version(\"1.2.3\").micro\n        3\n        >>> Version(\"1\").micro\n        0\n        \"\"\"\n        return self.release[2] if len(self.release) >= 3 else 0\n\n\ndef _parse_letter_version(\n    letter: Optional[str], number: Union[str, bytes, SupportsInt, None]\n) -> Optional[Tuple[str, int]]:\n\n    if letter:\n        # We consider there to be an implicit 0 in a pre-release if there is\n        # not a numeral associated with it.\n        if number is None:\n            number = 0\n\n        # We normalize any letters to their lower case form\n        letter = letter.lower()\n\n        # We consider some words to be alternate spellings of other words and\n        # in those cases we want to normalize the spellings to our preferred\n        # spelling.\n        if letter == \"alpha\":\n            letter = \"a\"\n        elif letter == \"beta\":\n            letter = \"b\"\n        elif letter in [\"c\", \"pre\", \"preview\"]:\n            letter = \"rc\"\n        elif letter in [\"rev\", \"r\"]:\n            letter = \"post\"\n\n        return letter, int(number)\n    if not letter and number:\n        # We assume if we are given a number, but we are not given a letter\n        # then this is using the implicit post release syntax (e.g. 1.0-1)\n        letter = \"post\"\n\n        return letter, int(number)\n\n    return None\n\n\n_local_version_separators = re.compile(r\"[\\._-]\")\n\n\ndef _parse_local_version(local: Optional[str]) -> Optional[LocalType]:\n    \"\"\"\n    Takes a string like abc.1.twelve and turns it into (\"abc\", 1, \"twelve\").\n    \"\"\"\n    if local is not None:\n        return tuple(\n            part.lower() if not part.isdigit() else int(part)\n            for part in _local_version_separators.split(local)\n        )\n    return None\n\n\ndef _cmpkey(\n    epoch: int,\n    release: Tuple[int, ...],\n    pre: Optional[Tuple[str, int]],\n    post: Optional[Tuple[str, int]],\n    dev: Optional[Tuple[str, int]],\n    local: Optional[LocalType],\n) -> CmpKey:\n\n    # When we compare a release version, we want to compare it with all of the\n    # trailing zeros removed. So we'll use a reverse the list, drop all the now\n    # leading zeros until we come to something non zero, then take the rest\n    # re-reverse it back into the correct order and make it a tuple and use\n    # that for our sorting key.\n    _release = tuple(\n        reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))\n    )\n\n    # We need to \"trick\" the sorting algorithm to put 1.0.dev0 before 1.0a0.\n    # We'll do this by abusing the pre segment, but we _only_ want to do this\n    # if there is not a pre or a post segment. If we have one of those then\n    # the normal sorting rules will handle this case correctly.\n    if pre is None and post is None and dev is not None:\n        _pre: CmpPrePostDevType = NegativeInfinity\n    # Versions without a pre-release (except as noted above) should sort after\n    # those with one.\n    elif pre is None:\n        _pre = Infinity\n    else:\n        _pre = pre\n\n    # Versions without a post segment should sort before those with one.\n    if post is None:\n        _post: CmpPrePostDevType = NegativeInfinity\n\n    else:\n        _post = post\n\n    # Versions without a development segment should sort after those with one.\n    if dev is None:\n        _dev: CmpPrePostDevType = Infinity\n\n    else:\n        _dev = dev\n\n    if local is None:\n        # Versions without a local segment should sort before those with one.\n        _local: CmpLocalType = NegativeInfinity\n    else:\n        # Versions with a local segment need that segment parsed to implement\n        # the sorting rules in PEP440.\n        # - Alpha numeric segments sort before numeric segments\n        # - Alpha numeric segments sort lexicographically\n        # - Numeric segments sort numerically\n        # - Shorter versions sort before longer versions when the prefixes\n        #   match exactly\n        _local = tuple(\n            (i, \"\") if isinstance(i, int) else (NegativeInfinity, i) for i in local\n        )\n\n    return epoch, _release, _pre, _post, _dev, _local\n"
  },
  {
    "path": "gyp/pyproject.toml",
    "content": "[build-system]\nrequires = [\"setuptools>=61.0\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"gyp-next\"\nversion = \"0.21.1\"\nauthors = [\n  { name=\"Node.js contributors\", email=\"ryzokuken@disroot.org\" },\n]\ndescription = \"A fork of the GYP build system for use in the Node.js projects\"\nreadme = \"README.md\"\nlicense = { file=\"LICENSE\" }\nrequires-python = \">=3.8\"\ndependencies = [\"packaging>=24.0\", \"setuptools>=69.5.1\"]\nclassifiers = [\n    \"Development Status :: 3 - Alpha\",\n    \"Environment :: Console\",\n    \"Intended Audience :: Developers\",\n    \"License :: OSI Approved :: BSD License\",\n    \"Natural Language :: English\",\n    \"Programming Language :: Python\",\n    \"Programming Language :: Python :: 3\",\n    \"Programming Language :: Python :: 3.8\",\n    \"Programming Language :: Python :: 3.9\",\n    \"Programming Language :: Python :: 3.10\",\n    \"Programming Language :: Python :: 3.11\",\n]\n\n[project.optional-dependencies]\ndev = [\"pytest\", \"ruff\"]\n\n[project.scripts]\ngyp = \"gyp:script_main\"\n\n[project.urls]\n\"Homepage\" = \"https://github.com/nodejs/gyp-next\"\n\n[tool.ruff]\nextend-exclude = [\"pylib/packaging\"]\nline-length = 88\n\n[tool.ruff.lint]\nselect = [\n  \"C4\",   # flake8-comprehensions\n  \"C90\",  # McCabe cyclomatic complexity\n  \"DTZ\",  # flake8-datetimez\n  \"E\",    # pycodestyle\n  \"F\",    # Pyflakes\n  \"G\",    # flake8-logging-format\n  \"ICN\",  # flake8-import-conventions\n  \"INT\",  # flake8-gettext\n  \"PL\",   # Pylint\n  \"PYI\",  # flake8-pyi\n  \"RSE\",  # flake8-raise\n  \"RUF\",  # Ruff-specific rules\n  \"T10\",  # flake8-debugger\n  \"TCH\",  # flake8-type-checking\n  \"TID\",  # flake8-tidy-imports\n  \"UP\",   # pyupgrade\n  \"W\",    # pycodestyle\n  \"YTT\",  # flake8-2020\n  # \"A\",    # flake8-builtins\n  # \"ANN\",  # flake8-annotations\n  # \"ARG\",  # flake8-unused-arguments\n  # \"B\",    # flake8-bugbear\n  # \"BLE\",  # flake8-blind-except\n  # \"COM\",  # flake8-commas\n  # \"D\",    # pydocstyle\n  # \"DJ\",   # flake8-django\n  # \"EM\",   # flake8-errmsg\n  # \"ERA\",  # eradicate\n  # \"EXE\",  # flake8-executable\n  # \"FBT\",  # flake8-boolean-trap\n  # \"I\",    # isort\n  # \"INP\",  # flake8-no-pep420\n  # \"ISC\",  # flake8-implicit-str-concat\n  # \"N\",    # pep8-naming\n  # \"NPY\",  # NumPy-specific rules\n  # \"PD\",   # pandas-vet\n  # \"PGH\",  # pygrep-hooks\n  # \"PIE\",  # flake8-pie\n  # \"PT\",   # flake8-pytest-style\n  # \"PTH\",  # flake8-use-pathlib\n  # \"Q\",    # flake8-quotes\n  # \"RET\",  # flake8-return\n  # \"S\",    # flake8-bandit\n  # \"SIM\",  # flake8-simplify\n  # \"SLF\",  # flake8-self\n  # \"T20\",  # flake8-print\n  # \"TRY\",  # tryceratops\n]\nignore = [\n  \"PLR1714\",\n  \"PLW0603\",\n  \"PLW2901\",\n  \"RUF005\",\n  \"RUF012\",\n  \"UP031\",\n]\n\n[tool.ruff.lint.mccabe]\nmax-complexity = 101\n\n[tool.ruff.lint.pylint]\nallow-magic-value-types = [\"float\", \"int\", \"str\"]\nmax-args = 11\nmax-branches = 108\nmax-returns = 10\nmax-statements = 286\n\n[tool.setuptools]\npackage-dir = {\"\" = \"pylib\"}\npackages = [\"gyp\", \"gyp.generator\"]\n"
  },
  {
    "path": "gyp/release-please-config.json",
    "content": "{\n    \"last-release-sha\": \"78756421b0d7bb335992a9c7d26ba3cc8b619708\",\n    \"packages\": {\n        \".\": {\n          \"release-type\": \"python\",\n          \"package-name\": \"gyp-next\",\n          \"bump-minor-pre-major\": true,\n          \"include-component-in-tag\": false\n        }\n    }\n}\n"
  },
  {
    "path": "gyp/test_gyp.py",
    "content": "#!/usr/bin/env python3\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"gyptest.py -- test runner for GYP tests.\"\"\"\n\nimport argparse\nimport os\nimport platform\nimport subprocess\nimport sys\nimport time\n\n\ndef is_test_name(f):\n    return f.startswith(\"gyptest\") and f.endswith(\".py\")\n\n\ndef find_all_gyptest_files(directory):\n    result = []\n    for root, dirs, files in os.walk(directory):\n        result.extend([os.path.join(root, f) for f in files if is_test_name(f)])\n    result.sort()\n    return result\n\n\ndef main(argv=None):\n    if argv is None:\n        argv = sys.argv\n\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\"-a\", \"--all\", action=\"store_true\", help=\"run all tests\")\n    parser.add_argument(\"-C\", \"--chdir\", action=\"store\", help=\"change to directory\")\n    parser.add_argument(\n        \"-f\",\n        \"--format\",\n        action=\"store\",\n        default=\"\",\n        help=\"run tests with the specified formats\",\n    )\n    parser.add_argument(\n        \"-G\",\n        \"--gyp_option\",\n        action=\"append\",\n        default=[],\n        help=\"Add -G options to the gyp command line\",\n    )\n    parser.add_argument(\n        \"-l\", \"--list\", action=\"store_true\", help=\"list available tests and exit\"\n    )\n    parser.add_argument(\n        \"-n\",\n        \"--no-exec\",\n        action=\"store_true\",\n        help=\"no execute, just print the command line\",\n    )\n    parser.add_argument(\n        \"--path\", action=\"append\", default=[], help=\"additional $PATH directory\"\n    )\n    parser.add_argument(\n        \"-q\",\n        \"--quiet\",\n        action=\"store_true\",\n        help=\"quiet, don't print anything unless there are failures\",\n    )\n    parser.add_argument(\n        \"-v\",\n        \"--verbose\",\n        action=\"store_true\",\n        help=\"print configuration info and test results.\",\n    )\n    parser.add_argument(\"tests\", nargs=\"*\")\n    args = parser.parse_args(argv[1:])\n\n    if args.chdir:\n        os.chdir(args.chdir)\n\n    if args.path:\n        extra_path = [os.path.abspath(p) for p in args.path]\n        extra_path = os.pathsep.join(extra_path)\n        os.environ[\"PATH\"] = extra_path + os.pathsep + os.environ[\"PATH\"]\n\n    if not args.tests:\n        if not args.all:\n            sys.stderr.write(\"Specify -a to get all tests.\\n\")\n            return 1\n        args.tests = [\"test\"]\n\n    tests = []\n    for arg in args.tests:\n        if os.path.isdir(arg):\n            tests.extend(find_all_gyptest_files(os.path.normpath(arg)))\n        else:\n            if not is_test_name(os.path.basename(arg)):\n                print(arg, \"is not a valid gyp test name.\", file=sys.stderr)\n                sys.exit(1)\n            tests.append(arg)\n\n    if args.list:\n        for test in tests:\n            print(test)\n        sys.exit(0)\n\n    os.environ[\"PYTHONPATH\"] = os.path.abspath(\"test/lib\")\n\n    if args.verbose:\n        print_configuration_info()\n\n    if args.gyp_option and not args.quiet:\n        print(\"Extra Gyp options: %s\\n\" % args.gyp_option)\n\n    if args.format:\n        format_list = args.format.split(\",\")\n    else:\n        format_list = {\n            \"aix5\": [\"make\"],\n            \"os400\": [\"make\"],\n            \"freebsd7\": [\"make\"],\n            \"freebsd8\": [\"make\"],\n            \"openbsd5\": [\"make\"],\n            \"cygwin\": [\"msvs\"],\n            \"win32\": [\"msvs\", \"ninja\"],\n            \"linux\": [\"make\", \"ninja\"],\n            \"linux2\": [\"make\", \"ninja\"],\n            \"linux3\": [\"make\", \"ninja\"],\n            # TODO: Re-enable xcode-ninja.\n            # https://bugs.chromium.org/p/gyp/issues/detail?id=530\n            # 'darwin':   ['make', 'ninja', 'xcode', 'xcode-ninja'],\n            \"darwin\": [\"make\", \"ninja\", \"xcode\"],\n        }[sys.platform]\n\n    gyp_options = []\n    for option in args.gyp_option:\n        gyp_options += [\"-G\", option]\n\n    runner = Runner(format_list, tests, gyp_options, args.verbose)\n    runner.run()\n\n    if not args.quiet:\n        runner.print_results()\n\n    return 1 if runner.failures else 0\n\n\ndef print_configuration_info():\n    print(\"Test configuration:\")\n    if sys.platform == \"darwin\":\n        sys.path.append(os.path.abspath(\"test/lib\"))\n        import TestMac  # noqa: PLC0415\n\n        print(f\"  Mac {platform.mac_ver()[0]} {platform.mac_ver()[2]}\")\n        print(f\"  Xcode {TestMac.Xcode.Version()}\")\n    elif sys.platform == \"win32\":\n        sys.path.append(os.path.abspath(\"pylib\"))\n        import gyp.MSVSVersion  # noqa: PLC0415\n\n        print(\"  Win %s %s\\n\" % platform.win32_ver()[0:2])\n        print(\"  MSVS %s\" % gyp.MSVSVersion.SelectVisualStudioVersion().Description())\n    elif sys.platform in (\"linux\", \"linux2\"):\n        print(\"  Linux %s\" % \" \".join(platform.linux_distribution()))\n    print(f\"  Python {platform.python_version()}\")\n    print(f\"  PYTHONPATH={os.environ['PYTHONPATH']}\")\n    print()\n\n\nclass Runner:\n    def __init__(self, formats, tests, gyp_options, verbose):\n        self.formats = formats\n        self.tests = tests\n        self.verbose = verbose\n        self.gyp_options = gyp_options\n        self.failures = []\n        self.num_tests = len(formats) * len(tests)\n        num_digits = len(str(self.num_tests))\n        self.fmt_str = \"[%%%dd/%%%dd] (%%s) %%s\" % (num_digits, num_digits)\n        self.isatty = sys.stdout.isatty() and not self.verbose\n        self.env = os.environ.copy()\n        self.hpos = 0\n\n    def run(self):\n        run_start = time.time()\n\n        i = 1\n        for fmt in self.formats:\n            for test in self.tests:\n                self.run_test(test, fmt, i)\n                i += 1\n\n        if self.isatty:\n            self.erase_current_line()\n\n        self.took = time.time() - run_start\n\n    def run_test(self, test, fmt, i):\n        if self.isatty:\n            self.erase_current_line()\n\n        msg = self.fmt_str % (i, self.num_tests, fmt, test)\n        self.print_(msg)\n\n        start = time.time()\n        cmd = [sys.executable, test] + self.gyp_options\n        self.env[\"TESTGYP_FORMAT\"] = fmt\n        proc = subprocess.Popen(\n            cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.env\n        )\n        proc.wait()\n        took = time.time() - start\n\n        stdout = proc.stdout.read().decode(\"utf8\")\n        if proc.returncode == 2:\n            res = \"skipped\"\n        elif proc.returncode:\n            res = \"failed\"\n            self.failures.append(f\"({test}) {fmt}\")\n        else:\n            res = \"passed\"\n        res_msg = f\" {res} {took:.3f}s\"\n        self.print_(res_msg)\n\n        if stdout and not stdout.endswith((\"PASSED\\n\", \"NO RESULT\\n\")):\n            print()\n            print(\"\\n\".join(f\"    {line}\" for line in stdout.splitlines()))\n        elif not self.isatty:\n            print()\n\n    def print_(self, msg):\n        print(msg, end=\"\")\n        index = msg.rfind(\"\\n\")\n        if index == -1:\n            self.hpos += len(msg)\n        else:\n            self.hpos = len(msg) - index\n        sys.stdout.flush()\n\n    def erase_current_line(self):\n        print(\"\\b\" * self.hpos + \" \" * self.hpos + \"\\b\" * self.hpos, end=\"\")\n        sys.stdout.flush()\n        self.hpos = 0\n\n    def print_results(self):\n        num_failures = len(self.failures)\n        if num_failures:\n            print()\n            if num_failures == 1:\n                print(\"Failed the following test:\")\n            else:\n                print(\"Failed the following %d tests:\" % num_failures)\n            print(\"\\t\" + \"\\n\\t\".join(sorted(self.failures)))\n            print()\n        print(\n            \"Ran %d tests in %.3fs, %d failed.\"\n            % (self.num_tests, self.took, num_failures)\n        )\n        print()\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n"
  },
  {
    "path": "gyp/tools/README",
    "content": "pretty_vcproj:\n  Usage: pretty_vcproj.py \"c:\\path\\to\\vcproj.vcproj\" [key1=value1] [key2=value2]\n\n  They key/value pair are used to resolve vsprops name.\n\n  For example, if I want to diff the base.vcproj project:\n\n  pretty_vcproj.py z:\\dev\\src-chrome\\src\\base\\build\\base.vcproj \"$(SolutionDir)=z:\\dev\\src-chrome\\src\\chrome\\\\\" \"$(CHROMIUM_BUILD)=\" \"$(CHROME_BUILD_TYPE)=\" > original.txt\n  pretty_vcproj.py z:\\dev\\src-chrome\\src\\base\\base_gyp.vcproj \"$(SolutionDir)=z:\\dev\\src-chrome\\src\\chrome\\\\\" \"$(CHROMIUM_BUILD)=\" \"$(CHROME_BUILD_TYPE)=\" > gyp.txt\n\n  And you can use your favorite diff tool to see the changes.\n\n  Note: In the case of base.vcproj, the original vcproj is one level up the generated one.\n        I suggest you do a search and replace for '\"..\\' and replace it with '\"' in original.txt\n        before you perform the diff."
  },
  {
    "path": "gyp/tools/Xcode/README",
    "content": "Specifications contains syntax formatters for Xcode 3. These do not appear to be supported yet on Xcode 4. To use these with Xcode 3 please install both the gyp.pbfilespec and gyp.xclangspec files in\n\n~/Library/Application Support/Developer/Shared/Xcode/Specifications/\n\nand restart Xcode."
  },
  {
    "path": "gyp/tools/Xcode/Specifications/gyp.pbfilespec",
    "content": "/*\n\tgyp.pbfilespec\n\tGYP source file spec for Xcode 3\n\n\tThere is not much documentation available regarding the format\n\tof .pbfilespec files. As a starting point, see for instance the\n\toutdated documentation at:\n\thttp://maxao.free.fr/xcode-plugin-interface/specifications.html\n\tand the files in:\n\t/Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/\n\n\tPlace this file in directory:\n\t~/Library/Application Support/Developer/Shared/Xcode/Specifications/\n*/\n\n(\n\t{\n\t\tIdentifier = sourcecode.gyp;\n\t\tBasedOn = sourcecode;\n\t\tName = \"GYP Files\";\n\t\tExtensions = (\"gyp\", \"gypi\");\n\t\tMIMETypes = (\"text/gyp\");\n\t\tLanguage = \"xcode.lang.gyp\";\n\t\tIsTextFile = YES;\n\t\tIsSourceFile = YES;\n\t}\n)\n"
  },
  {
    "path": "gyp/tools/Xcode/Specifications/gyp.xclangspec",
    "content": "/*\n\tCopyright (c) 2011 Google Inc. All rights reserved.\n\tUse of this source code is governed by a BSD-style license that can be\n\tfound in the LICENSE file.\n\t\n\tgyp.xclangspec\n\tGYP language specification for Xcode 3\n\n\tThere is not much documentation available regarding the format\n\tof .xclangspec files. As a starting point, see for instance the\n\toutdated documentation at:\n\thttp://maxao.free.fr/xcode-plugin-interface/specifications.html\n\tand the files in:\n\t/Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/\n\n\tPlace this file in directory:\n\t~/Library/Application Support/Developer/Shared/Xcode/Specifications/\n*/\n\n(\n\n    {\n        Identifier = \"xcode.lang.gyp.keyword\";\n        Syntax = {\n            Words = (\n                \"and\",\n                \"or\",\n                \"<!\",\n                \"<\",\n             );\n            Type = \"xcode.syntax.keyword\";\n        };\n    },\n\n    {\n        Identifier = \"xcode.lang.gyp.target.declarator\";\n        Syntax = {\n        \tWords = (\n        \t\t\"'target_name'\",\n        \t);\n            Type = \"xcode.syntax.identifier.type\";\n        };\n    },\n\n\t{\n\t\tIdentifier = \"xcode.lang.gyp.string.singlequote\";\n\t\tSyntax = {\n\t\t\tIncludeRules = (\n\t\t\t\t\"xcode.lang.string\",\n\t\t\t\t\"xcode.lang.gyp.keyword\",\n\t\t\t\t\"xcode.lang.number\",\n\t\t\t);\n\t\t\tStart = \"'\";\n\t\t\tEnd = \"'\";\n\t\t};\n\t},\n\t\n\t{\n\t\tIdentifier = \"xcode.lang.gyp.comma\";\n\t\tSyntax = {\n\t\t\tWords = ( \",\", );\n\t\t\t\n\t\t};\n\t},\n\n\t{\n\t\tIdentifier = \"xcode.lang.gyp\";\n\t\tDescription = \"GYP Coloring\";\n\t\tBasedOn = \"xcode.lang.simpleColoring\";\n\t\tIncludeInMenu = YES;\n\t\tName = \"GYP\";\n\t\tSyntax = {\n\t\t\tTokenizer = \"xcode.lang.gyp.lexer.toplevel\";\n\t\t\tIncludeRules = (\n\t\t\t\t\"xcode.lang.gyp.dictionary\",\n\t\t\t);\n\t\t\tType = \"xcode.syntax.plain\";\n\t\t};\n\t},\n\n\t// The following rule returns tokens to the other rules\n\t{\n\t\tIdentifier = \"xcode.lang.gyp.lexer\";\n\t\tSyntax = {\n\t\t\tIncludeRules = (\n\t\t\t\t\"xcode.lang.gyp.comment\",\n\t\t\t\t\"xcode.lang.string\",\n\t\t\t\t'xcode.lang.gyp.targetname.declarator',\n\t\t\t\t\"xcode.lang.gyp.string.singlequote\",\n\t\t\t\t\"xcode.lang.number\",\n\t\t\t\t\"xcode.lang.gyp.comma\",\n\t\t\t);\n\t\t};\n\t},\n\n\t{\n\t\tIdentifier = \"xcode.lang.gyp.lexer.toplevel\";\n\t\tSyntax = {\n\t\t\tIncludeRules = (\n\t\t\t\t\"xcode.lang.gyp.comment\",\n\t\t\t);\n\t\t};\n\t},\n\n\t{\n        Identifier = \"xcode.lang.gyp.assignment\";\n        Syntax = {\n            Tokenizer = \"xcode.lang.gyp.lexer\";\n            Rules = (\n            \t\"xcode.lang.gyp.assignment.lhs\",\n            \t\":\",\n                \"xcode.lang.gyp.assignment.rhs\",\n            );\n        };\n       \n    },\n    \n    {\n        Identifier = \"xcode.lang.gyp.target.declaration\";\n        Syntax = {\n            Tokenizer = \"xcode.lang.gyp.lexer\";\n            Rules = (\n                \"xcode.lang.gyp.target.declarator\",\n                \":\",\n                \"xcode.lang.gyp.target.name\",\n            );\n        };\n   },\n   \n   {\n        Identifier = \"xcode.lang.gyp.target.name\";\n        Syntax = {\n            Tokenizer = \"xcode.lang.gyp.lexer\";\n            Rules = (\n                \"xcode.lang.gyp.string.singlequote\",\n            );\n        \tType = \"xcode.syntax.definition.function\";\n        };\n    },\n    \n\t{\n        Identifier = \"xcode.lang.gyp.assignment.lhs\";\n        Syntax = {\n            Tokenizer = \"xcode.lang.gyp.lexer\";\n            Rules = (\n            \t\"xcode.lang.gyp.string.singlequote\",\n            );\n         \tType = \"xcode.syntax.identifier.type\";\n        };\n    },\n    \n    {\n        Identifier = \"xcode.lang.gyp.assignment.rhs\";\n        Syntax = {\n        \tTokenizer = \"xcode.lang.gyp.lexer\";\n            Rules = (\n            \t\"xcode.lang.gyp.string.singlequote?\",\n                \"xcode.lang.gyp.array?\",\n\t\t\t\t\"xcode.lang.gyp.dictionary?\",\n\t\t\t\t\"xcode.lang.number?\",\n            );\n        };\n    },\n\n\t{\n\t\tIdentifier = \"xcode.lang.gyp.dictionary\";\n\t\tSyntax = {\n\t\t\tTokenizer = \"xcode.lang.gyp.lexer\";\n\t\t\tStart = \"{\";\n\t\t\tEnd = \"}\";\n\t\t\tFoldable = YES;\n\t\t\tRecursive = YES;\n\t\t\tIncludeRules = (\n\t\t\t\t\"xcode.lang.gyp.target.declaration\",\n\t\t\t\t\"xcode.lang.gyp.assignment\",\n\t\t\t);\n\t\t};\n\t},\n\n\t{\n\t\tIdentifier = \"xcode.lang.gyp.array\";\n\t\tSyntax = {\n\t\t\tTokenizer = \"xcode.lang.gyp.lexer\";\n\t\t\tStart = \"[\";\n\t\t\tEnd = \"]\";\n\t\t\tFoldable = YES;\n\t\t\tRecursive = YES;\n\t\t\tIncludeRules = (\n\t\t\t\t\"xcode.lang.gyp.array\",\n\t\t\t\t\"xcode.lang.gyp.dictionary\",\n\t\t\t\t\"xcode.lang.gyp.string.singlequote\",\n\t\t\t);\n\t\t};\n\t},\n\n    {\n        Identifier = \"xcode.lang.gyp.todo.mark\";\n        Syntax = {\n            StartChars = \"T\";\n            Match = (\n                \"^\\(TODO\\(.*\\):[ \\t]+.*\\)$\",       // include \"TODO: \" in the markers list\n            );\n            // This is the order of captures. All of the match strings above need the same order.\n            CaptureTypes = (\n                \"xcode.syntax.mark\"\n            );\n            Type = \"xcode.syntax.comment\";\n        };\n    },\n\n\t{\n\t\tIdentifier = \"xcode.lang.gyp.comment\";\n\t\tBasedOn = \"xcode.lang.comment\"; // for text macros\n\t\tSyntax = {\n\t\t\tStart = \"#\";\n\t\t\tEnd = \"\\n\";\n\t\t\tIncludeRules = (\n\t\t\t\t\"xcode.lang.url\",\n\t\t\t\t\"xcode.lang.url.mail\",\n\t\t\t\t\"xcode.lang.comment.mark\",\n\t\t\t\t\"xcode.lang.gyp.todo.mark\",\n\t\t\t);\n\t\t\tType = \"xcode.syntax.comment\";\n\t\t};\n\t},\n)\n"
  },
  {
    "path": "gyp/tools/emacs/README",
    "content": "How to install gyp-mode for emacs:\n\nAdd the following to your ~/.emacs (replace ... with the path to your gyp\ncheckout).\n\n(setq load-path (cons \".../tools/emacs\" load-path))\n(require 'gyp)\n\nRestart emacs (or eval-region the added lines) and you should be all set.\n\nPlease note that ert is required for running the tests, which is included in\nEmacs 24, or available separately from https://github.com/ohler/ert\n"
  },
  {
    "path": "gyp/tools/emacs/gyp-tests.el",
    "content": ";;; gyp-tests.el - unit tests for gyp-mode.\n\n;; Copyright (c) 2012 Google Inc. All rights reserved.\n;; Use of this source code is governed by a BSD-style license that can be\n;; found in the LICENSE file.\n\n;; The recommended way to run these tests is to run them from the command-line,\n;; with the run-unit-tests.sh script.\n\n(require 'cl)\n(require 'ert)\n(require 'gyp)\n\n(defconst samples (directory-files \"testdata\" t \".gyp$\")\n  \"List of golden samples to check\")\n\n(defun fontify (filename)\n  (with-temp-buffer\n    (insert-file-contents-literally filename)\n    (gyp-mode)\n    (font-lock-fontify-buffer)\n    (buffer-string)))\n\n(defun read-golden-sample (filename)\n  (with-temp-buffer\n    (insert-file-contents-literally (concat filename \".fontified\"))\n    (read (current-buffer))))\n\n(defun equivalent-face (face)\n  \"For the purposes of face comparison, we're not interested in the\n   differences between certain faces. For example, the difference between\n   font-lock-comment-delimiter and font-lock-comment-face.\"\n  (cl-case face\n    ((font-lock-comment-delimiter-face) font-lock-comment-face)\n    (t face)))\n\n(defun text-face-properties (s)\n  \"Extract the text properties from s\"\n  (let ((result (list t)))\n    (dotimes (i (length s))\n      (setq result (cons (equivalent-face (get-text-property i 'face s))\n                         result)))\n    (nreverse result)))\n\n(ert-deftest test-golden-samples ()\n  \"Check that fontification produces the same results as the golden samples\"\n  (dolist (sample samples)\n    (let ((golden (read-golden-sample sample))\n          (fontified (fontify sample)))\n      (should (equal golden fontified))\n      (should (equal (text-face-properties golden)\n                     (text-face-properties fontified))))))\n\n(defun create-golden-sample (filename)\n  \"Create a golden sample by fontifying filename and writing out the printable\n   representation of the fontified buffer (with text properties) to the\n   FILENAME.fontified\"\n  (with-temp-file (concat filename \".fontified\")\n    (print (fontify filename) (current-buffer))))\n\n(defun create-golden-samples ()\n  \"Recreate the golden samples\"\n  (dolist (sample samples) (create-golden-sample sample)))\n"
  },
  {
    "path": "gyp/tools/emacs/gyp.el",
    "content": ";;; gyp.el - font-lock-mode support for gyp files.\n\n;; Copyright (c) 2012 Google Inc. All rights reserved.\n;; Use of this source code is governed by a BSD-style license that can be\n;; found in the LICENSE file.\n\n;; Put this somewhere in your load-path and\n;; (require 'gyp)\n\n(require 'python)\n(require 'cl)\n\n(when (string-match \"python-mode.el\" (symbol-file 'python-mode 'defun))\n  (error (concat \"python-mode must be loaded from python.el (bundled with \"\n                 \"recent emacsen), not from the older and less maintained \"\n                 \"python-mode.el\")))\n\n(defadvice python-indent-calculate-levels (after gyp-outdent-closing-parens\n                                                 activate)\n  \"De-indent closing parens, braces, and brackets in gyp-mode.\"\n  (when (and (eq major-mode 'gyp-mode)\n             (string-match \"^ *[])}][],)}]* *$\"\n                           (buffer-substring-no-properties\n                            (line-beginning-position) (line-end-position))))\n    (setf (first python-indent-levels)\n          (- (first python-indent-levels) python-continuation-offset))))\n\n(defadvice python-indent-guess-indent-offset (around\n                                              gyp-indent-guess-indent-offset\n                                              activate)\n  \"Guess correct indent offset in gyp-mode.\"\n  (or (and (not (eq major-mode 'gyp-mode))\n           ad-do-it)\n      (save-excursion\n        (save-restriction\n          (widen)\n          (goto-char (point-min))\n          ;; Find first line ending with an opening brace that is not a comment.\n          (or (and (re-search-forward \"\\\\(^[[{]$\\\\|^.*[^#].*[[{]$\\\\)\")\n                   (forward-line)\n                   (/= (current-indentation) 0)\n                   (set (make-local-variable 'python-indent-offset)\n                        (current-indentation))\n                   (set (make-local-variable 'python-continuation-offset)\n                        (current-indentation)))\n              (message \"Can't guess gyp indent offset, using default: %s\"\n                       python-continuation-offset))))))\n\n(define-derived-mode gyp-mode python-mode \"Gyp\"\n  \"Major mode for editing .gyp files. See http://code.google.com/p/gyp/\"\n  ;; gyp-parse-history is a stack of (POSITION . PARSE-STATE) tuples,\n  ;; with greater positions at the top of the stack. PARSE-STATE\n  ;; is a list of section symbols (see gyp-section-name and gyp-parse-to)\n  ;; with most nested section symbol at the front of the list.\n  (set (make-local-variable 'gyp-parse-history) '((1 . (list))))\n  (gyp-add-font-lock-keywords))\n\n(defun gyp-set-indentation ()\n  \"Hook function to configure python indentation to suit gyp mode.\"\n  (set (make-local-variable 'python-indent-offset) 2)\n  (set (make-local-variable 'python-continuation-offset) 2)\n  (set (make-local-variable 'python-indent-guess-indent-offset) t)\n  (python-indent-guess-indent-offset))\n\n(add-hook 'gyp-mode-hook 'gyp-set-indentation)\n\n(add-to-list 'auto-mode-alist '(\"\\\\.gyp\\\\'\" . gyp-mode))\n(add-to-list 'auto-mode-alist '(\"\\\\.gypi\\\\'\" . gyp-mode))\n(add-to-list 'auto-mode-alist '(\"/\\\\.gclient\\\\'\" . gyp-mode))\n\n;;; Font-lock support\n\n(defconst gyp-dependencies-regexp\n  (regexp-opt (list \"dependencies\" \"export_dependent_settings\"))\n  \"Regular expression to introduce 'dependencies' section\")\n\n(defconst gyp-sources-regexp\n  (regexp-opt (list \"action\" \"files\" \"include_dirs\" \"includes\" \"inputs\"\n                    \"libraries\" \"outputs\" \"sources\"))\n  \"Regular expression to introduce 'sources' sections\")\n\n(defconst gyp-conditions-regexp\n  (regexp-opt (list \"conditions\" \"target_conditions\"))\n  \"Regular expression to introduce conditions sections\")\n\n(defconst gyp-variables-regexp\n  \"^variables\"\n  \"Regular expression to introduce variables sections\")\n\n(defconst gyp-defines-regexp\n  \"^defines\"\n  \"Regular expression to introduce 'defines' sections\")\n\n(defconst gyp-targets-regexp\n  \"^targets\"\n  \"Regular expression to introduce 'targets' sections\")\n\n(defun gyp-section-name (section)\n  \"Map the sections we are interested in from SECTION to symbol.\n\n   SECTION is a string from the buffer that introduces a section.  The result is\n   a symbol representing the kind of section.\n\n   This allows us to treat (for the purposes of font-lock) several different\n   section names as the same kind of section. For example, a 'sources section\n   can be introduced by the 'sources', 'inputs', 'outputs' keyword.\n\n   'other is the default section kind when a more specific match is not made.\"\n  (cond ((string-match-p gyp-dependencies-regexp section) 'dependencies)\n        ((string-match-p gyp-sources-regexp section) 'sources)\n        ((string-match-p gyp-variables-regexp section) 'variables)\n        ((string-match-p gyp-conditions-regexp section) 'conditions)\n        ((string-match-p gyp-targets-regexp section) 'targets)\n        ((string-match-p gyp-defines-regexp section) 'defines)\n        (t 'other)))\n\n(defun gyp-invalidate-parse-states-after (target-point)\n  \"Erase any parse information after target-point.\"\n  (while (> (caar gyp-parse-history) target-point)\n    (setq gyp-parse-history (cdr gyp-parse-history))))\n\n(defun gyp-parse-point ()\n  \"The point of the last parse state added by gyp-parse-to.\"\n  (caar gyp-parse-history))\n\n(defun gyp-parse-sections ()\n  \"A list of section symbols holding at the last parse state point.\"\n  (cdar gyp-parse-history))\n\n(defun gyp-inside-dictionary-p ()\n  \"Predicate returning true if the parser is inside a dictionary.\"\n  (not (eq (cadar gyp-parse-history) 'list)))\n\n(defun gyp-add-parse-history (point sections)\n  \"Add parse state SECTIONS to the parse history at POINT so that parsing can be\n   resumed instantly.\"\n  (while (>= (caar gyp-parse-history) point)\n    (setq gyp-parse-history (cdr gyp-parse-history)))\n  (setq gyp-parse-history (cons (cons point sections) gyp-parse-history)))\n\n(defun gyp-parse-to (target-point)\n  \"Parses from (point) to TARGET-POINT adding the parse state information to\n   gyp-parse-state-history. Parsing stops if TARGET-POINT is reached or if a\n   string literal has been parsed. Returns nil if no further parsing can be\n   done, otherwise returns the position of the start of a parsed string, leaving\n   the point at the end of the string.\"\n  (let ((parsing t)\n        string-start)\n    (while parsing\n      (setq string-start nil)\n      ;; Parse up to a character that starts a sexp, or if the nesting\n      ;; level decreases.\n      (let ((state (parse-partial-sexp (gyp-parse-point)\n                                       target-point\n                                       -1\n                                       t))\n            (sections (gyp-parse-sections)))\n        (if (= (nth 0 state) -1)\n            (setq sections (cdr sections)) ; pop out a level\n          (cond ((looking-at-p \"['\\\"]\") ; a string\n                 (setq string-start (point))\n                 (goto-char (scan-sexps (point) 1))\n                 (if (gyp-inside-dictionary-p)\n                     ;; Look for sections inside a dictionary\n                     (let ((section (gyp-section-name\n                                     (buffer-substring-no-properties\n                                      (+ 1 string-start)\n                                      (- (point) 1)))))\n                       (setq sections (cons section (cdr sections)))))\n                 ;; Stop after the string so it can be fontified.\n                 (setq target-point (point)))\n                ((looking-at-p \"{\")\n                 ;; Inside a dictionary. Increase nesting.\n                 (forward-char 1)\n                 (setq sections (cons 'unknown sections)))\n                ((looking-at-p \"\\\\[\")\n                 ;; Inside a list. Increase nesting\n                 (forward-char 1)\n                 (setq sections (cons 'list sections)))\n                ((not (eobp))\n                 ;; other\n                 (forward-char 1))))\n        (gyp-add-parse-history (point) sections)\n        (setq parsing (< (point) target-point))))\n    string-start))\n\n(defun gyp-section-at-point ()\n  \"Transform the last parse state, which is a list of nested sections and return\n   the section symbol that should be used to determine font-lock information for\n   the string. Can return nil indicating the string should not have any attached\n   section.\"\n  (let ((sections (gyp-parse-sections)))\n    (cond\n     ((eq (car sections) 'conditions)\n      ;; conditions can occur in a variables section, but we still want to\n      ;; highlight it as a keyword.\n      nil)\n     ((and (eq (car sections) 'list)\n           (eq (cadr sections) 'list))\n      ;; conditions and sources can have items in [[ ]]\n      (caddr sections))\n     (t (cadr sections)))))\n\n(defun gyp-section-match (limit)\n  \"Parse from (point) to LIMIT returning by means of match data what was\n   matched. The group of the match indicates what style font-lock should apply.\n   See also `gyp-add-font-lock-keywords'.\"\n  (gyp-invalidate-parse-states-after (point))\n  (let ((group nil)\n        (string-start t))\n    (while (and (< (point) limit)\n                (not group)\n                string-start)\n      (setq string-start (gyp-parse-to limit))\n      (if string-start\n          (setq group (cl-case (gyp-section-at-point)\n                        ('dependencies 1)\n                        ('variables 2)\n                        ('conditions 2)\n                        ('sources 3)\n                        ('defines 4)\n                        (nil nil)))))\n    (if group\n        (progn\n          ;; Set the match data to indicate to the font-lock mechanism the\n          ;; highlighting to be performed.\n          (set-match-data (append (list string-start (point))\n                                  (make-list (* (1- group) 2) nil)\n                                  (list (1+ string-start) (1- (point)))))\n          t))))\n\n;;; Please see http://code.google.com/p/gyp/wiki/GypLanguageSpecification for\n;;; canonical list of keywords.\n(defun gyp-add-font-lock-keywords ()\n  \"Add gyp-mode keywords to font-lock mechanism.\"\n  ;; TODO(jknotten): Move all the keyword highlighting into gyp-section-match\n  ;; so that we can do the font-locking in a single font-lock pass.\n  (font-lock-add-keywords\n   nil\n   (list\n    ;; Top-level keywords\n    (list (concat \"['\\\"]\\\\(\"\n              (regexp-opt (list \"action\" \"action_name\" \"actions\" \"cflags\"\n                                \"cflags_cc\" \"conditions\" \"configurations\"\n                                \"copies\" \"defines\" \"dependencies\" \"destination\"\n                                \"direct_dependent_settings\"\n                                \"export_dependent_settings\" \"extension\" \"files\"\n                                \"include_dirs\" \"includes\" \"inputs\" \"ldflags\" \"libraries\"\n                                \"link_settings\" \"mac_bundle\" \"message\"\n                                \"msvs_external_rule\" \"outputs\" \"product_name\"\n                                \"process_outputs_as_sources\" \"rules\" \"rule_name\"\n                                \"sources\" \"suppress_wildcard\"\n                                \"target_conditions\" \"target_defaults\"\n                                \"target_defines\" \"target_name\" \"toolsets\"\n                                \"targets\" \"type\" \"variables\" \"xcode_settings\"))\n              \"[!/+=]?\\\\)\") 1 'font-lock-keyword-face t)\n    ;; Type of target\n    (list (concat \"['\\\"]\\\\(\"\n              (regexp-opt (list \"loadable_module\" \"static_library\"\n                                \"shared_library\" \"executable\" \"none\"))\n              \"\\\\)\") 1 'font-lock-type-face t)\n    (list \"\\\\(?:target\\\\|action\\\\)_name['\\\"]\\\\s-*:\\\\s-*['\\\"]\\\\([^ '\\\"]*\\\\)\" 1\n          'font-lock-function-name-face t)\n    (list 'gyp-section-match\n          (list 1 'font-lock-function-name-face t t) ; dependencies\n          (list 2 'font-lock-variable-name-face t t) ; variables, conditions\n          (list 3 'font-lock-constant-face t t) ; sources\n          (list 4 'font-lock-preprocessor-face t t)) ; preprocessor\n    ;; Variable expansion\n    (list \"<@?(\\\\([^\\n )]+\\\\))\" 1 'font-lock-variable-name-face t)\n    ;; Command expansion\n    (list \"<!@?(\\\\([^\\n )]+\\\\))\" 1 'font-lock-variable-name-face t)\n    )))\n\n(provide 'gyp)\n"
  },
  {
    "path": "gyp/tools/emacs/run-unit-tests.sh",
    "content": "#!/bin/sh\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\nemacs --no-site-file --no-init-file --batch \\\n      --load ert.el --load gyp.el --load gyp-tests.el \\\n      -f ert-run-tests-batch-and-exit\n"
  },
  {
    "path": "gyp/tools/emacs/testdata/media.gyp",
    "content": "# Copyright (c) 2012 The Chromium Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n{\n  'variables': {\n    'chromium_code': 1,\n    # Override to dynamically link the PulseAudio library.\n    'use_pulseaudio%': 0,\n    # Override to dynamically link the cras (ChromeOS audio) library.\n    'use_cras%': 0,\n  },\n  'targets': [\n    {\n      'target_name': 'media',\n      'type': '<(component)',\n      'dependencies': [\n        'yuv_convert',\n        '../base/base.gyp:base',\n        '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',\n        '../build/temp_gyp/googleurl.gyp:googleurl',\n        '../crypto/crypto.gyp:crypto',\n        '../third_party/openmax/openmax.gyp:il',\n        '../ui/ui.gyp:ui',\n      ],\n      'defines': [\n        'MEDIA_IMPLEMENTATION',\n      ],\n      'include_dirs': [\n        '..',\n      ],\n      'sources': [\n        'audio/android/audio_manager_android.cc',\n        'audio/android/audio_manager_android.h',\n        'audio/android/audio_track_output_android.cc',\n        'audio/android/audio_track_output_android.h',\n        'audio/android/opensles_input.cc',\n        'audio/android/opensles_input.h',\n        'audio/android/opensles_output.cc',\n        'audio/android/opensles_output.h',\n        'audio/async_socket_io_handler.h',\n        'audio/async_socket_io_handler_posix.cc',\n        'audio/async_socket_io_handler_win.cc',\n        'audio/audio_buffers_state.cc',\n        'audio/audio_buffers_state.h',\n        'audio/audio_io.h',\n        'audio/audio_input_controller.cc',\n        'audio/audio_input_controller.h',\n        'audio/audio_input_stream_impl.cc',\n        'audio/audio_input_stream_impl.h',\n        'audio/audio_device_name.cc',\n        'audio/audio_device_name.h',\n        'audio/audio_manager.cc',\n        'audio/audio_manager.h',\n        'audio/audio_manager_base.cc',\n        'audio/audio_manager_base.h',\n        'audio/audio_output_controller.cc',\n        'audio/audio_output_controller.h',\n        'audio/audio_output_dispatcher.cc',\n        'audio/audio_output_dispatcher.h',\n        'audio/audio_output_dispatcher_impl.cc',\n        'audio/audio_output_dispatcher_impl.h',\n        'audio/audio_output_mixer.cc',\n        'audio/audio_output_mixer.h',\n        'audio/audio_output_proxy.cc',\n        'audio/audio_output_proxy.h',\n        'audio/audio_parameters.cc',\n        'audio/audio_parameters.h',\n        'audio/audio_util.cc',\n        'audio/audio_util.h',\n        'audio/cross_process_notification.cc',\n        'audio/cross_process_notification.h',\n        'audio/cross_process_notification_win.cc',\n        'audio/cross_process_notification_posix.cc',\n        'audio/fake_audio_input_stream.cc',\n        'audio/fake_audio_input_stream.h',\n        'audio/fake_audio_output_stream.cc',\n        'audio/fake_audio_output_stream.h',\n        'audio/linux/audio_manager_linux.cc',\n        'audio/linux/audio_manager_linux.h',\n        'audio/linux/alsa_input.cc',\n        'audio/linux/alsa_input.h',\n        'audio/linux/alsa_output.cc',\n        'audio/linux/alsa_output.h',\n        'audio/linux/alsa_util.cc',\n        'audio/linux/alsa_util.h',\n        'audio/linux/alsa_wrapper.cc',\n        'audio/linux/alsa_wrapper.h',\n        'audio/linux/cras_output.cc',\n        'audio/linux/cras_output.h',\n        'audio/openbsd/audio_manager_openbsd.cc',\n        'audio/openbsd/audio_manager_openbsd.h',\n        'audio/mac/audio_input_mac.cc',\n        'audio/mac/audio_input_mac.h',\n        'audio/mac/audio_low_latency_input_mac.cc',\n        'audio/mac/audio_low_latency_input_mac.h',\n        'audio/mac/audio_low_latency_output_mac.cc',\n        'audio/mac/audio_low_latency_output_mac.h',\n        'audio/mac/audio_manager_mac.cc',\n        'audio/mac/audio_manager_mac.h',\n        'audio/mac/audio_output_mac.cc',\n        'audio/mac/audio_output_mac.h',\n        'audio/null_audio_sink.cc',\n        'audio/null_audio_sink.h',\n        'audio/pulse/pulse_output.cc',\n        'audio/pulse/pulse_output.h',\n        'audio/sample_rates.cc',\n        'audio/sample_rates.h',\n        'audio/simple_sources.cc',\n        'audio/simple_sources.h',\n        'audio/win/audio_low_latency_input_win.cc',\n        'audio/win/audio_low_latency_input_win.h',\n        'audio/win/audio_low_latency_output_win.cc',\n        'audio/win/audio_low_latency_output_win.h',\n        'audio/win/audio_manager_win.cc',\n        'audio/win/audio_manager_win.h',\n        'audio/win/avrt_wrapper_win.cc',\n        'audio/win/avrt_wrapper_win.h',\n        'audio/win/device_enumeration_win.cc',\n        'audio/win/device_enumeration_win.h',\n        'audio/win/wavein_input_win.cc',\n        'audio/win/wavein_input_win.h',\n        'audio/win/waveout_output_win.cc',\n        'audio/win/waveout_output_win.h',\n        'base/android/media_jni_registrar.cc',\n        'base/android/media_jni_registrar.h',\n        'base/audio_decoder.cc',\n        'base/audio_decoder.h',\n        'base/audio_decoder_config.cc',\n        'base/audio_decoder_config.h',\n        'base/audio_renderer.h',\n        'base/audio_renderer_mixer.cc',\n        'base/audio_renderer_mixer.h',\n        'base/audio_renderer_mixer_input.cc',\n        'base/audio_renderer_mixer_input.h',\n        'base/bitstream_buffer.h',\n        'base/buffers.cc',\n        'base/buffers.h',\n        'base/byte_queue.cc',\n        'base/byte_queue.h',\n        'base/channel_layout.cc',\n        'base/channel_layout.h',\n        'base/clock.cc',\n        'base/clock.h',\n        'base/composite_filter.cc',\n        'base/composite_filter.h',\n        'base/data_buffer.cc',\n        'base/data_buffer.h',\n        'base/data_source.cc',\n        'base/data_source.h',\n        'base/decoder_buffer.cc',\n        'base/decoder_buffer.h',\n        'base/decrypt_config.cc',\n        'base/decrypt_config.h',\n        'base/decryptor.h',\n        'base/decryptor_client.h',\n        'base/demuxer.cc',\n        'base/demuxer.h',\n        'base/demuxer_stream.cc',\n        'base/demuxer_stream.h',\n        'base/djb2.cc',\n        'base/djb2.h',\n        'base/filter_collection.cc',\n        'base/filter_collection.h',\n        'base/filter_host.h',\n        'base/filters.cc',\n        'base/filters.h',\n        'base/h264_bitstream_converter.cc',\n        'base/h264_bitstream_converter.h',\n        'base/media.h',\n        'base/media_android.cc',\n        'base/media_export.h',\n        'base/media_log.cc',\n        'base/media_log.h',\n        'base/media_log_event.h',\n        'base/media_posix.cc',\n        'base/media_switches.cc',\n        'base/media_switches.h',\n        'base/media_win.cc',\n        'base/message_loop_factory.cc',\n        'base/message_loop_factory.h',\n        'base/pipeline.cc',\n        'base/pipeline.h',\n        'base/pipeline_status.cc',\n        'base/pipeline_status.h',\n        'base/ranges.cc',\n        'base/ranges.h',\n        'base/seekable_buffer.cc',\n        'base/seekable_buffer.h',\n        'base/state_matrix.cc',\n        'base/state_matrix.h',\n        'base/stream_parser.cc',\n        'base/stream_parser.h',\n        'base/stream_parser_buffer.cc',\n        'base/stream_parser_buffer.h',\n        'base/video_decoder.cc',\n        'base/video_decoder.h',\n        'base/video_decoder_config.cc',\n        'base/video_decoder_config.h',\n        'base/video_frame.cc',\n        'base/video_frame.h',\n        'base/video_renderer.h',\n        'base/video_util.cc',\n        'base/video_util.h',\n        'crypto/aes_decryptor.cc',\n        'crypto/aes_decryptor.h',\n        'ffmpeg/ffmpeg_common.cc',\n        'ffmpeg/ffmpeg_common.h',\n        'ffmpeg/file_protocol.cc',\n        'ffmpeg/file_protocol.h',\n        'filters/audio_file_reader.cc',\n        'filters/audio_file_reader.h',\n        'filters/audio_renderer_algorithm.cc',\n        'filters/audio_renderer_algorithm.h',\n        'filters/audio_renderer_impl.cc',\n        'filters/audio_renderer_impl.h',\n        'filters/bitstream_converter.cc',\n        'filters/bitstream_converter.h',\n        'filters/chunk_demuxer.cc',\n        'filters/chunk_demuxer.h',\n        'filters/chunk_demuxer_client.h',\n        'filters/dummy_demuxer.cc',\n        'filters/dummy_demuxer.h',\n        'filters/ffmpeg_audio_decoder.cc',\n        'filters/ffmpeg_audio_decoder.h',\n        'filters/ffmpeg_demuxer.cc',\n        'filters/ffmpeg_demuxer.h',\n        'filters/ffmpeg_h264_bitstream_converter.cc',\n        'filters/ffmpeg_h264_bitstream_converter.h',\n        'filters/ffmpeg_glue.cc',\n        'filters/ffmpeg_glue.h',\n        'filters/ffmpeg_video_decoder.cc',\n        'filters/ffmpeg_video_decoder.h',\n        'filters/file_data_source.cc',\n        'filters/file_data_source.h',\n        'filters/gpu_video_decoder.cc',\n        'filters/gpu_video_decoder.h',\n        'filters/in_memory_url_protocol.cc',\n        'filters/in_memory_url_protocol.h',\n        'filters/source_buffer_stream.cc',\n        'filters/source_buffer_stream.h',\n        'filters/video_frame_generator.cc',\n        'filters/video_frame_generator.h',\n        'filters/video_renderer_base.cc',\n        'filters/video_renderer_base.h',\n        'video/capture/fake_video_capture_device.cc',\n        'video/capture/fake_video_capture_device.h',\n        'video/capture/linux/video_capture_device_linux.cc',\n        'video/capture/linux/video_capture_device_linux.h',\n        'video/capture/mac/video_capture_device_mac.h',\n        'video/capture/mac/video_capture_device_mac.mm',\n        'video/capture/mac/video_capture_device_qtkit_mac.h',\n        'video/capture/mac/video_capture_device_qtkit_mac.mm',\n        'video/capture/video_capture.h',\n        'video/capture/video_capture_device.h',\n        'video/capture/video_capture_device_dummy.cc',\n        'video/capture/video_capture_device_dummy.h',\n        'video/capture/video_capture_proxy.cc',\n        'video/capture/video_capture_proxy.h',\n        'video/capture/video_capture_types.h',\n        'video/capture/win/filter_base_win.cc',\n        'video/capture/win/filter_base_win.h',\n        'video/capture/win/pin_base_win.cc',\n        'video/capture/win/pin_base_win.h',\n        'video/capture/win/sink_filter_observer_win.h',\n        'video/capture/win/sink_filter_win.cc',\n        'video/capture/win/sink_filter_win.h',\n        'video/capture/win/sink_input_pin_win.cc',\n        'video/capture/win/sink_input_pin_win.h',\n        'video/capture/win/video_capture_device_win.cc',\n        'video/capture/win/video_capture_device_win.h',\n        'video/picture.cc',\n        'video/picture.h',\n        'video/video_decode_accelerator.cc',\n        'video/video_decode_accelerator.h',\n        'webm/webm_constants.h',\n        'webm/webm_cluster_parser.cc',\n        'webm/webm_cluster_parser.h',\n        'webm/webm_content_encodings.cc',\n        'webm/webm_content_encodings.h',\n        'webm/webm_content_encodings_client.cc',\n        'webm/webm_content_encodings_client.h',\n        'webm/webm_info_parser.cc',\n        'webm/webm_info_parser.h',\n        'webm/webm_parser.cc',\n        'webm/webm_parser.h',\n        'webm/webm_stream_parser.cc',\n        'webm/webm_stream_parser.h',\n        'webm/webm_tracks_parser.cc',\n        'webm/webm_tracks_parser.h',\n      ],\n      'direct_dependent_settings': {\n        'include_dirs': [\n          '..',\n        ],\n      },\n      'conditions': [\n        # Android doesn't use ffmpeg, so make the dependency conditional\n        # and exclude the sources which depend on ffmpeg.\n        ['OS != \"android\"', {\n          'dependencies': [\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n        }],\n        ['OS == \"android\"', {\n          'sources!': [\n            'base/media_posix.cc',\n            'ffmpeg/ffmpeg_common.cc',\n            'ffmpeg/ffmpeg_common.h',\n            'ffmpeg/file_protocol.cc',\n            'ffmpeg/file_protocol.h',\n            'filters/audio_file_reader.cc',\n            'filters/audio_file_reader.h',\n            'filters/bitstream_converter.cc',\n            'filters/bitstream_converter.h',\n            'filters/chunk_demuxer.cc',\n            'filters/chunk_demuxer.h',\n            'filters/chunk_demuxer_client.h',\n            'filters/ffmpeg_audio_decoder.cc',\n            'filters/ffmpeg_audio_decoder.h',\n            'filters/ffmpeg_demuxer.cc',\n            'filters/ffmpeg_demuxer.h',\n            'filters/ffmpeg_h264_bitstream_converter.cc',\n            'filters/ffmpeg_h264_bitstream_converter.h',\n            'filters/ffmpeg_glue.cc',\n            'filters/ffmpeg_glue.h',\n            'filters/ffmpeg_video_decoder.cc',\n            'filters/ffmpeg_video_decoder.h',\n            'filters/gpu_video_decoder.cc',\n            'filters/gpu_video_decoder.h',\n            'webm/webm_cluster_parser.cc',\n            'webm/webm_cluster_parser.h',\n            'webm/webm_stream_parser.cc',\n            'webm/webm_stream_parser.h',\n          ],\n        }],\n        # The below 'android' condition were added temporarily and should be\n        # removed in downstream, because there is no Java environment setup in\n        # upstream yet.\n        ['OS == \"android\"', {\n          'sources!':[\n            'audio/android/audio_track_output_android.cc',\n          ],\n          'sources':[\n            'audio/android/audio_track_output_stub_android.cc',\n          ],\n          'link_settings': {\n            'libraries': [\n              '-lOpenSLES',\n            ],\n          },\n        }],\n        ['OS==\"linux\" or OS==\"freebsd\" or OS==\"solaris\"', {\n          'link_settings': {\n            'libraries': [\n              '-lasound',\n            ],\n          },\n        }],\n        ['OS==\"openbsd\"', {\n          'sources/': [ ['exclude', '/alsa_' ],\n                        ['exclude', '/audio_manager_linux' ] ],\n          'link_settings': {\n            'libraries': [\n            ],\n          },\n        }],\n        ['OS!=\"openbsd\"', {\n          'sources!': [\n            'audio/openbsd/audio_manager_openbsd.cc',\n            'audio/openbsd/audio_manager_openbsd.h',\n          ],\n        }],\n        ['OS==\"linux\"', {\n          'variables': {\n            'conditions': [\n              ['sysroot!=\"\"', {\n                'pkg-config': '../build/linux/pkg-config-wrapper \"<(sysroot)\" \"<(target_arch)\"',\n              }, {\n                'pkg-config': 'pkg-config'\n              }],\n            ],\n          },\n          'conditions': [\n            ['use_cras == 1', {\n              'cflags': [\n                '<!@(<(pkg-config) --cflags libcras)',\n              ],\n              'link_settings': {\n                'libraries': [\n                  '<!@(<(pkg-config) --libs libcras)',\n                ],\n              },\n              'defines': [\n                'USE_CRAS',\n              ],\n            }, {  # else: use_cras == 0\n              'sources!': [\n                'audio/linux/cras_output.cc',\n                'audio/linux/cras_output.h',\n              ],\n            }],\n          ],\n        }],\n        ['os_posix == 1', {\n          'conditions': [\n            ['use_pulseaudio == 1', {\n              'cflags': [\n                '<!@(pkg-config --cflags libpulse)',\n              ],\n              'link_settings': {\n                'libraries': [\n                  '<!@(pkg-config --libs-only-l libpulse)',\n                ],\n              },\n              'defines': [\n                'USE_PULSEAUDIO',\n              ],\n            }, {  # else: use_pulseaudio == 0\n              'sources!': [\n                'audio/pulse/pulse_output.cc',\n                'audio/pulse/pulse_output.h',\n              ],\n            }],\n          ],\n        }],\n        ['os_posix == 1 and OS != \"android\"', {\n          # Video capture isn't supported in Android yet.\n          'sources!': [\n            'video/capture/video_capture_device_dummy.cc',\n            'video/capture/video_capture_device_dummy.h',\n          ],\n        }],\n        ['OS==\"mac\"', {\n          'link_settings': {\n            'libraries': [\n              '$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework',\n              '$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework',\n              '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework',\n              '$(SDKROOT)/System/Library/Frameworks/CoreVideo.framework',\n              '$(SDKROOT)/System/Library/Frameworks/QTKit.framework',\n            ],\n          },\n        }],\n        ['OS==\"win\"', {\n          'sources!': [\n            'audio/pulse/pulse_output.cc',\n            'audio/pulse/pulse_output.h',\n            'video/capture/video_capture_device_dummy.cc',\n            'video/capture/video_capture_device_dummy.h',\n          ],\n        }],\n        ['proprietary_codecs==1 or branding==\"Chrome\"', {\n          'sources': [\n            'mp4/avc.cc',\n            'mp4/avc.h',\n            'mp4/box_definitions.cc',\n            'mp4/box_definitions.h',\n            'mp4/box_reader.cc',\n            'mp4/box_reader.h',\n            'mp4/cenc.cc',\n            'mp4/cenc.h',\n            'mp4/mp4_stream_parser.cc',\n            'mp4/mp4_stream_parser.h',\n            'mp4/offset_byte_queue.cc',\n            'mp4/offset_byte_queue.h',\n            'mp4/track_run_iterator.cc',\n            'mp4/track_run_iterator.h',\n          ],\n        }],\n      ],\n    },\n    {\n      'target_name': 'yuv_convert',\n      'type': 'static_library',\n      'include_dirs': [\n        '..',\n      ],\n      'conditions': [\n        ['order_profiling != 0', {\n          'target_conditions' : [\n            ['_toolset==\"target\"', {\n              'cflags!': [ '-finstrument-functions' ],\n            }],\n          ],\n        }],\n        [ 'target_arch == \"ia32\" or target_arch == \"x64\"', {\n          'dependencies': [\n            'yuv_convert_simd_x86',\n          ],\n        }],\n        [ 'target_arch == \"arm\"', {\n          'dependencies': [\n            'yuv_convert_simd_arm',\n          ],\n        }],\n      ],\n      'sources': [\n        'base/yuv_convert.cc',\n        'base/yuv_convert.h',\n      ],\n    },\n    {\n      'target_name': 'yuv_convert_simd_x86',\n      'type': 'static_library',\n      'include_dirs': [\n        '..',\n      ],\n      'sources': [\n        'base/simd/convert_rgb_to_yuv_c.cc',\n        'base/simd/convert_rgb_to_yuv_sse2.cc',\n        'base/simd/convert_rgb_to_yuv_ssse3.asm',\n        'base/simd/convert_rgb_to_yuv_ssse3.cc',\n        'base/simd/convert_rgb_to_yuv_ssse3.inc',\n        'base/simd/convert_yuv_to_rgb_c.cc',\n        'base/simd/convert_yuv_to_rgb_x86.cc',\n        'base/simd/convert_yuv_to_rgb_mmx.asm',\n        'base/simd/convert_yuv_to_rgb_mmx.inc',\n        'base/simd/convert_yuv_to_rgb_sse.asm',\n        'base/simd/filter_yuv.h',\n        'base/simd/filter_yuv_c.cc',\n        'base/simd/filter_yuv_mmx.cc',\n        'base/simd/filter_yuv_sse2.cc',\n        'base/simd/linear_scale_yuv_to_rgb_mmx.asm',\n        'base/simd/linear_scale_yuv_to_rgb_mmx.inc',\n        'base/simd/linear_scale_yuv_to_rgb_sse.asm',\n        'base/simd/scale_yuv_to_rgb_mmx.asm',\n        'base/simd/scale_yuv_to_rgb_mmx.inc',\n        'base/simd/scale_yuv_to_rgb_sse.asm',\n        'base/simd/yuv_to_rgb_table.cc',\n        'base/simd/yuv_to_rgb_table.h',\n      ],\n      'conditions': [\n        ['order_profiling != 0', {\n          'target_conditions' : [\n            ['_toolset==\"target\"', {\n              'cflags!': [ '-finstrument-functions' ],\n            }],\n          ],\n        }],\n        [ 'target_arch == \"x64\"', {\n          # Source files optimized for X64 systems.\n          'sources': [\n            'base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm',\n            'base/simd/scale_yuv_to_rgb_sse2_x64.asm',\n          ],\n        }],\n        [ 'os_posix == 1 and OS != \"mac\" and OS != \"android\"', {\n          'cflags': [\n            '-msse2',\n          ],\n        }],\n        [ 'OS == \"mac\"', {\n          'configurations': {\n            'Debug': {\n              'xcode_settings': {\n                # gcc on the mac builds horribly unoptimized sse code in debug\n                # mode. Since this is rarely going to be debugged, run with full\n                # optimizations in Debug as well as Release.\n                'GCC_OPTIMIZATION_LEVEL': '3',  # -O3\n               },\n             },\n          },\n        }],\n        [ 'OS==\"win\"', {\n          'variables': {\n            'yasm_flags': [\n              '-DWIN32',\n              '-DMSVC',\n              '-DCHROMIUM',\n              '-Isimd',\n            ],\n          },\n        }],\n        [ 'OS==\"mac\"', {\n          'variables': {\n            'yasm_flags': [\n              '-DPREFIX',\n              '-DMACHO',\n              '-DCHROMIUM',\n              '-Isimd',\n            ],\n          },\n        }],\n        [ 'os_posix==1 and OS!=\"mac\"', {\n          'variables': {\n            'conditions': [\n              [ 'target_arch==\"ia32\"', {\n                'yasm_flags': [\n                  '-DX86_32',\n                  '-DELF',\n                  '-DCHROMIUM',\n                  '-Isimd',\n                ],\n              }, {\n                'yasm_flags': [\n                  '-DARCH_X86_64',\n                  '-DELF',\n                  '-DPIC',\n                  '-DCHROMIUM',\n                  '-Isimd',\n                ],\n              }],\n            ],\n          },\n        }],\n      ],\n      'variables': {\n        'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/media',\n      },\n      'msvs_2010_disable_uldi_when_referenced': 1,\n      'includes': [\n        '../third_party/yasm/yasm_compile.gypi',\n      ],\n    },\n    {\n      'target_name': 'yuv_convert_simd_arm',\n      'type': 'static_library',\n      'include_dirs': [\n        '..',\n      ],\n      'sources': [\n        'base/simd/convert_rgb_to_yuv_c.cc',\n        'base/simd/convert_rgb_to_yuv.h',\n        'base/simd/convert_yuv_to_rgb_c.cc',\n        'base/simd/convert_yuv_to_rgb.h',\n        'base/simd/filter_yuv.h',\n        'base/simd/filter_yuv_c.cc',\n        'base/simd/yuv_to_rgb_table.cc',\n        'base/simd/yuv_to_rgb_table.h',\n      ],\n    },\n    {\n      'target_name': 'media_unittests',\n      'type': 'executable',\n      'dependencies': [\n        'media',\n        'media_test_support',\n        'yuv_convert',\n        '../base/base.gyp:base',\n        '../base/base.gyp:base_i18n',\n        '../base/base.gyp:test_support_base',\n        '../testing/gmock.gyp:gmock',\n        '../testing/gtest.gyp:gtest',\n        '../ui/ui.gyp:ui',\n      ],\n      'sources': [\n        'audio/async_socket_io_handler_unittest.cc',\n        'audio/audio_input_controller_unittest.cc',\n        'audio/audio_input_device_unittest.cc',\n        'audio/audio_input_unittest.cc',\n        'audio/audio_input_volume_unittest.cc',\n        'audio/audio_low_latency_input_output_unittest.cc',\n        'audio/audio_output_controller_unittest.cc',\n        'audio/audio_output_proxy_unittest.cc',\n        'audio/audio_parameters_unittest.cc',\n        'audio/audio_util_unittest.cc',\n        'audio/cross_process_notification_unittest.cc',\n        'audio/linux/alsa_output_unittest.cc',\n        'audio/mac/audio_low_latency_input_mac_unittest.cc',\n        'audio/mac/audio_output_mac_unittest.cc',\n        'audio/simple_sources_unittest.cc',\n        'audio/win/audio_low_latency_input_win_unittest.cc',\n        'audio/win/audio_low_latency_output_win_unittest.cc',\n        'audio/win/audio_output_win_unittest.cc',\n        'base/audio_renderer_mixer_unittest.cc',\n        'base/audio_renderer_mixer_input_unittest.cc',\n        'base/buffers_unittest.cc',\n        'base/clock_unittest.cc',\n        'base/composite_filter_unittest.cc',\n        'base/data_buffer_unittest.cc',\n        'base/decoder_buffer_unittest.cc',\n        'base/djb2_unittest.cc',\n        'base/fake_audio_render_callback.cc',\n        'base/fake_audio_render_callback.h',\n        'base/filter_collection_unittest.cc',\n        'base/h264_bitstream_converter_unittest.cc',\n        'base/pipeline_unittest.cc',\n        'base/ranges_unittest.cc',\n        'base/run_all_unittests.cc',\n        'base/seekable_buffer_unittest.cc',\n        'base/state_matrix_unittest.cc',\n        'base/test_data_util.cc',\n        'base/test_data_util.h',\n        'base/video_frame_unittest.cc',\n        'base/video_util_unittest.cc',\n        'base/yuv_convert_unittest.cc',\n        'crypto/aes_decryptor_unittest.cc',\n        'ffmpeg/ffmpeg_common_unittest.cc',\n        'filters/audio_renderer_algorithm_unittest.cc',\n        'filters/audio_renderer_impl_unittest.cc',\n        'filters/bitstream_converter_unittest.cc',\n        'filters/chunk_demuxer_unittest.cc',\n        'filters/ffmpeg_audio_decoder_unittest.cc',\n        'filters/ffmpeg_decoder_unittest.h',\n        'filters/ffmpeg_demuxer_unittest.cc',\n        'filters/ffmpeg_glue_unittest.cc',\n        'filters/ffmpeg_h264_bitstream_converter_unittest.cc',\n        'filters/ffmpeg_video_decoder_unittest.cc',\n        'filters/file_data_source_unittest.cc',\n        'filters/pipeline_integration_test.cc',\n        'filters/pipeline_integration_test_base.cc',\n        'filters/source_buffer_stream_unittest.cc',\n        'filters/video_renderer_base_unittest.cc',\n        'video/capture/video_capture_device_unittest.cc',\n        'webm/cluster_builder.cc',\n        'webm/cluster_builder.h',\n        'webm/webm_cluster_parser_unittest.cc',\n        'webm/webm_content_encodings_client_unittest.cc',\n        'webm/webm_parser_unittest.cc',\n      ],\n      'conditions': [\n        ['os_posix==1 and OS!=\"mac\"', {\n          'conditions': [\n            ['linux_use_tcmalloc==1', {\n              'dependencies': [\n                '../base/allocator/allocator.gyp:allocator',\n              ],\n            }],\n          ],\n        }],\n        ['OS != \"android\"', {\n          'dependencies': [\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n        }],\n        ['OS == \"android\"', {\n          'sources!': [\n            'audio/audio_input_volume_unittest.cc',\n            'base/test_data_util.cc',\n            'base/test_data_util.h',\n            'ffmpeg/ffmpeg_common_unittest.cc',\n            'filters/ffmpeg_audio_decoder_unittest.cc',\n            'filters/bitstream_converter_unittest.cc',\n            'filters/chunk_demuxer_unittest.cc',\n            'filters/ffmpeg_demuxer_unittest.cc',\n            'filters/ffmpeg_glue_unittest.cc',\n            'filters/ffmpeg_h264_bitstream_converter_unittest.cc',\n            'filters/ffmpeg_video_decoder_unittest.cc',\n            'filters/pipeline_integration_test.cc',\n            'filters/pipeline_integration_test_base.cc',\n            'mp4/mp4_stream_parser_unittest.cc',\n            'webm/webm_cluster_parser_unittest.cc',\n          ],\n        }],\n        ['OS == \"linux\"', {\n          'conditions': [\n            ['use_cras == 1', {\n              'sources': [\n                'audio/linux/cras_output_unittest.cc',\n              ],\n              'defines': [\n                'USE_CRAS',\n              ],\n            }],\n          ],\n        }],\n        [ 'target_arch==\"ia32\" or target_arch==\"x64\"', {\n          'sources': [\n            'base/simd/convert_rgb_to_yuv_unittest.cc',\n          ],\n        }],\n        ['proprietary_codecs==1 or branding==\"Chrome\"', {\n          'sources': [\n            'mp4/avc_unittest.cc',\n            'mp4/box_reader_unittest.cc',\n            'mp4/mp4_stream_parser_unittest.cc',\n            'mp4/offset_byte_queue_unittest.cc',\n          ],\n        }],\n      ],\n    },\n    {\n      'target_name': 'media_test_support',\n      'type': 'static_library',\n      'dependencies': [\n        'media',\n        '../base/base.gyp:base',\n        '../testing/gmock.gyp:gmock',\n        '../testing/gtest.gyp:gtest',\n      ],\n      'sources': [\n        'audio/test_audio_input_controller_factory.cc',\n        'audio/test_audio_input_controller_factory.h',\n        'base/mock_callback.cc',\n        'base/mock_callback.h',\n        'base/mock_data_source_host.cc',\n        'base/mock_data_source_host.h',\n        'base/mock_demuxer_host.cc',\n        'base/mock_demuxer_host.h',\n        'base/mock_filter_host.cc',\n        'base/mock_filter_host.h',\n        'base/mock_filters.cc',\n        'base/mock_filters.h',\n      ],\n    },\n    {\n      'target_name': 'scaler_bench',\n      'type': 'executable',\n      'dependencies': [\n        'media',\n        'yuv_convert',\n        '../base/base.gyp:base',\n        '../skia/skia.gyp:skia',\n      ],\n      'sources': [\n        'tools/scaler_bench/scaler_bench.cc',\n      ],\n    },\n    {\n      'target_name': 'qt_faststart',\n      'type': 'executable',\n      'sources': [\n        'tools/qt_faststart/qt_faststart.c'\n      ],\n    },\n    {\n      'target_name': 'seek_tester',\n      'type': 'executable',\n      'dependencies': [\n        'media',\n        '../base/base.gyp:base',\n      ],\n      'sources': [\n        'tools/seek_tester/seek_tester.cc',\n      ],\n    },\n  ],\n  'conditions': [\n    ['OS==\"win\"', {\n      'targets': [\n        {\n          'target_name': 'player_wtl',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'yuv_convert',\n            '../base/base.gyp:base',\n            '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',\n            '../ui/ui.gyp:ui',\n          ],\n          'include_dirs': [\n            '<(DEPTH)/third_party/wtl/include',\n          ],\n          'sources': [\n            'tools/player_wtl/list.h',\n            'tools/player_wtl/mainfrm.h',\n            'tools/player_wtl/movie.cc',\n            'tools/player_wtl/movie.h',\n            'tools/player_wtl/player_wtl.cc',\n            'tools/player_wtl/player_wtl.rc',\n            'tools/player_wtl/props.h',\n            'tools/player_wtl/seek.h',\n            'tools/player_wtl/resource.h',\n            'tools/player_wtl/view.h',\n          ],\n          'msvs_settings': {\n            'VCLinkerTool': {\n              'SubSystem': '2',         # Set /SUBSYSTEM:WINDOWS\n            },\n          },\n          'defines': [\n            '_CRT_SECURE_NO_WARNINGS=1',\n          ],\n        },\n      ],\n    }],\n    ['OS == \"win\" or toolkit_uses_gtk == 1', {\n      'targets': [\n        {\n          'target_name': 'shader_bench',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'yuv_convert',\n            '../base/base.gyp:base',\n            '../ui/gl/gl.gyp:gl',\n          ],\n          'sources': [\n            'tools/shader_bench/shader_bench.cc',\n            'tools/shader_bench/cpu_color_painter.cc',\n            'tools/shader_bench/cpu_color_painter.h',\n            'tools/shader_bench/gpu_color_painter.cc',\n            'tools/shader_bench/gpu_color_painter.h',\n            'tools/shader_bench/gpu_painter.cc',\n            'tools/shader_bench/gpu_painter.h',\n            'tools/shader_bench/painter.cc',\n            'tools/shader_bench/painter.h',\n            'tools/shader_bench/window.cc',\n            'tools/shader_bench/window.h',\n          ],\n          'conditions': [\n            ['toolkit_uses_gtk == 1', {\n              'dependencies': [\n                '../build/linux/system.gyp:gtk',\n              ],\n              'sources': [\n                'tools/shader_bench/window_linux.cc',\n              ],\n            }],\n            ['OS==\"win\"', {\n              'dependencies': [\n                '../third_party/angle/src/build_angle.gyp:libEGL',\n                '../third_party/angle/src/build_angle.gyp:libGLESv2',\n              ],\n              'sources': [\n                'tools/shader_bench/window_win.cc',\n              ],\n            }],\n          ],\n        },\n      ],\n    }],\n    ['OS == \"linux\" and target_arch != \"arm\"', {\n      'targets': [\n        {\n          'target_name': 'tile_render_bench',\n          'type': 'executable',\n          'dependencies': [\n            '../base/base.gyp:base',\n            '../ui/gl/gl.gyp:gl',\n          ],\n          'libraries': [\n            '-lGL',\n            '-ldl',\n          ],\n          'sources': [\n            'tools/tile_render_bench/tile_render_bench.cc',\n          ],\n        },\n      ],\n    }],\n    ['os_posix == 1 and OS != \"mac\" and OS != \"android\"', {\n      'targets': [\n        {\n          'target_name': 'player_x11',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'yuv_convert',\n            '../base/base.gyp:base',\n            '../ui/gl/gl.gyp:gl',\n          ],\n          'link_settings': {\n            'libraries': [\n              '-ldl',\n              '-lX11',\n              '-lXrender',\n              '-lXext',\n            ],\n          },\n          'sources': [\n            'tools/player_x11/data_source_logger.cc',\n            'tools/player_x11/data_source_logger.h',\n            'tools/player_x11/gl_video_renderer.cc',\n            'tools/player_x11/gl_video_renderer.h',\n            'tools/player_x11/player_x11.cc',\n            'tools/player_x11/x11_video_renderer.cc',\n            'tools/player_x11/x11_video_renderer.h',\n          ],\n        },\n      ],\n    }],\n    ['OS == \"android\"', {\n      'targets': [\n        {\n          'target_name': 'player_android',\n          'type': 'static_library',\n          'sources': [\n            'base/android/media_player_bridge.cc',\n            'base/android/media_player_bridge.h',\n          ],\n          'dependencies': [\n            '../base/base.gyp:base',\n          ],\n          'include_dirs': [\n            '<(SHARED_INTERMEDIATE_DIR)/media',\n          ],\n          'actions': [\n            {\n              'action_name': 'generate-jni-headers',\n              'inputs': [\n                '../base/android/jni_generator/jni_generator.py',\n                'base/android/java/src/org/chromium/media/MediaPlayerListener.java',\n              ],\n              'outputs': [\n                '<(SHARED_INTERMEDIATE_DIR)/media/jni/media_player_listener_jni.h',\n              ],\n              'action': [\n                'python',\n                '<(DEPTH)/base/android/jni_generator/jni_generator.py',\n                '-o',\n                '<@(_inputs)',\n                '<@(_outputs)',\n              ],\n            },\n          ],\n        },\n        {\n          'target_name': 'media_java',\n          'type': 'none',\n          'dependencies': [ '../base/base.gyp:base_java' ],\n          'variables': {\n            'package_name': 'media',\n            'java_in_dir': 'base/android/java',\n          },\n          'includes': [ '../build/java.gypi' ],\n        },\n\n      ],\n    }, { # OS != \"android\"'\n      # Android does not use ffmpeg, so disable the targets which require it.\n      'targets': [\n        {\n          'target_name': 'ffmpeg_unittests',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'media_test_support',\n            '../base/base.gyp:base',\n            '../base/base.gyp:base_i18n',\n            '../base/base.gyp:test_support_base',\n            '../base/base.gyp:test_support_perf',\n            '../testing/gtest.gyp:gtest',\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n          'sources': [\n            'ffmpeg/ffmpeg_unittest.cc',\n          ],\n          'conditions': [\n            ['toolkit_uses_gtk == 1', {\n              'dependencies': [\n                # Needed for the following #include chain:\n                #   base/run_all_unittests.cc\n                #   ../base/test_suite.h\n                #   gtk/gtk.h\n                '../build/linux/system.gyp:gtk',\n              ],\n              'conditions': [\n                ['linux_use_tcmalloc==1', {\n                  'dependencies': [\n                    '../base/allocator/allocator.gyp:allocator',\n                  ],\n                }],\n              ],\n            }],\n          ],\n        },\n        {\n          'target_name': 'ffmpeg_regression_tests',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'media_test_support',\n            '../base/base.gyp:test_support_base',\n            '../testing/gmock.gyp:gmock',\n            '../testing/gtest.gyp:gtest',\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n          'sources': [\n            'base/test_data_util.cc',\n            'base/run_all_unittests.cc',\n            'ffmpeg/ffmpeg_regression_tests.cc',\n            'filters/pipeline_integration_test_base.cc',\n          ],\n          'conditions': [\n            ['os_posix==1 and OS!=\"mac\"', {\n              'conditions': [\n                ['linux_use_tcmalloc==1', {\n                  'dependencies': [\n                    '../base/allocator/allocator.gyp:allocator',\n                  ],\n                }],\n              ],\n            }],\n          ],\n        },\n        {\n          'target_name': 'ffmpeg_tests',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            '../base/base.gyp:base',\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n          'sources': [\n            'test/ffmpeg_tests/ffmpeg_tests.cc',\n          ],\n        },\n        {\n          'target_name': 'media_bench',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            '../base/base.gyp:base',\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n          'sources': [\n            'tools/media_bench/media_bench.cc',\n          ],\n        },\n      ],\n    }]\n  ],\n}\n"
  },
  {
    "path": "gyp/tools/emacs/testdata/media.gyp.fontified",
    "content": "\n#(\"# Copyright (c) 2012 The Chromium Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n{\n  'variables': {\n    'chromium_code': 1,\n    # Override to dynamically link the PulseAudio library.\n    'use_pulseaudio%': 0,\n    # Override to dynamically link the cras (ChromeOS audio) library.\n    'use_cras%': 0,\n  },\n  'targets': [\n    {\n      'target_name': 'media',\n      'type': '<(component)',\n      'dependencies': [\n        'yuv_convert',\n        '../base/base.gyp:base',\n        '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',\n        '../build/temp_gyp/googleurl.gyp:googleurl',\n        '../crypto/crypto.gyp:crypto',\n        '../third_party/openmax/openmax.gyp:il',\n        '../ui/ui.gyp:ui',\n      ],\n      'defines': [\n        'MEDIA_IMPLEMENTATION',\n      ],\n      'include_dirs': [\n        '..',\n      ],\n      'sources': [\n        'audio/android/audio_manager_android.cc',\n        'audio/android/audio_manager_android.h',\n        'audio/android/audio_track_output_android.cc',\n        'audio/android/audio_track_output_android.h',\n        'audio/android/opensles_input.cc',\n        'audio/android/opensles_input.h',\n        'audio/android/opensles_output.cc',\n        'audio/android/opensles_output.h',\n        'audio/async_socket_io_handler.h',\n        'audio/async_socket_io_handler_posix.cc',\n        'audio/async_socket_io_handler_win.cc',\n        'audio/audio_buffers_state.cc',\n        'audio/audio_buffers_state.h',\n        'audio/audio_io.h',\n        'audio/audio_input_controller.cc',\n        'audio/audio_input_controller.h',\n        'audio/audio_input_stream_impl.cc',\n        'audio/audio_input_stream_impl.h',\n        'audio/audio_device_name.cc',\n        'audio/audio_device_name.h',\n        'audio/audio_manager.cc',\n        'audio/audio_manager.h',\n        'audio/audio_manager_base.cc',\n        'audio/audio_manager_base.h',\n        'audio/audio_output_controller.cc',\n        'audio/audio_output_controller.h',\n        'audio/audio_output_dispatcher.cc',\n        'audio/audio_output_dispatcher.h',\n        'audio/audio_output_dispatcher_impl.cc',\n        'audio/audio_output_dispatcher_impl.h',\n        'audio/audio_output_mixer.cc',\n        'audio/audio_output_mixer.h',\n        'audio/audio_output_proxy.cc',\n        'audio/audio_output_proxy.h',\n        'audio/audio_parameters.cc',\n        'audio/audio_parameters.h',\n        'audio/audio_util.cc',\n        'audio/audio_util.h',\n        'audio/cross_process_notification.cc',\n        'audio/cross_process_notification.h',\n        'audio/cross_process_notification_win.cc',\n        'audio/cross_process_notification_posix.cc',\n        'audio/fake_audio_input_stream.cc',\n        'audio/fake_audio_input_stream.h',\n        'audio/fake_audio_output_stream.cc',\n        'audio/fake_audio_output_stream.h',\n        'audio/linux/audio_manager_linux.cc',\n        'audio/linux/audio_manager_linux.h',\n        'audio/linux/alsa_input.cc',\n        'audio/linux/alsa_input.h',\n        'audio/linux/alsa_output.cc',\n        'audio/linux/alsa_output.h',\n        'audio/linux/alsa_util.cc',\n        'audio/linux/alsa_util.h',\n        'audio/linux/alsa_wrapper.cc',\n        'audio/linux/alsa_wrapper.h',\n        'audio/linux/cras_output.cc',\n        'audio/linux/cras_output.h',\n        'audio/openbsd/audio_manager_openbsd.cc',\n        'audio/openbsd/audio_manager_openbsd.h',\n        'audio/mac/audio_input_mac.cc',\n        'audio/mac/audio_input_mac.h',\n        'audio/mac/audio_low_latency_input_mac.cc',\n        'audio/mac/audio_low_latency_input_mac.h',\n        'audio/mac/audio_low_latency_output_mac.cc',\n        'audio/mac/audio_low_latency_output_mac.h',\n        'audio/mac/audio_manager_mac.cc',\n        'audio/mac/audio_manager_mac.h',\n        'audio/mac/audio_output_mac.cc',\n        'audio/mac/audio_output_mac.h',\n        'audio/null_audio_sink.cc',\n        'audio/null_audio_sink.h',\n        'audio/pulse/pulse_output.cc',\n        'audio/pulse/pulse_output.h',\n        'audio/sample_rates.cc',\n        'audio/sample_rates.h',\n        'audio/simple_sources.cc',\n        'audio/simple_sources.h',\n        'audio/win/audio_low_latency_input_win.cc',\n        'audio/win/audio_low_latency_input_win.h',\n        'audio/win/audio_low_latency_output_win.cc',\n        'audio/win/audio_low_latency_output_win.h',\n        'audio/win/audio_manager_win.cc',\n        'audio/win/audio_manager_win.h',\n        'audio/win/avrt_wrapper_win.cc',\n        'audio/win/avrt_wrapper_win.h',\n        'audio/win/device_enumeration_win.cc',\n        'audio/win/device_enumeration_win.h',\n        'audio/win/wavein_input_win.cc',\n        'audio/win/wavein_input_win.h',\n        'audio/win/waveout_output_win.cc',\n        'audio/win/waveout_output_win.h',\n        'base/android/media_jni_registrar.cc',\n        'base/android/media_jni_registrar.h',\n        'base/audio_decoder.cc',\n        'base/audio_decoder.h',\n        'base/audio_decoder_config.cc',\n        'base/audio_decoder_config.h',\n        'base/audio_renderer.h',\n        'base/audio_renderer_mixer.cc',\n        'base/audio_renderer_mixer.h',\n        'base/audio_renderer_mixer_input.cc',\n        'base/audio_renderer_mixer_input.h',\n        'base/bitstream_buffer.h',\n        'base/buffers.cc',\n        'base/buffers.h',\n        'base/byte_queue.cc',\n        'base/byte_queue.h',\n        'base/channel_layout.cc',\n        'base/channel_layout.h',\n        'base/clock.cc',\n        'base/clock.h',\n        'base/composite_filter.cc',\n        'base/composite_filter.h',\n        'base/data_buffer.cc',\n        'base/data_buffer.h',\n        'base/data_source.cc',\n        'base/data_source.h',\n        'base/decoder_buffer.cc',\n        'base/decoder_buffer.h',\n        'base/decrypt_config.cc',\n        'base/decrypt_config.h',\n        'base/decryptor.h',\n        'base/decryptor_client.h',\n        'base/demuxer.cc',\n        'base/demuxer.h',\n        'base/demuxer_stream.cc',\n        'base/demuxer_stream.h',\n        'base/djb2.cc',\n        'base/djb2.h',\n        'base/filter_collection.cc',\n        'base/filter_collection.h',\n        'base/filter_host.h',\n        'base/filters.cc',\n        'base/filters.h',\n        'base/h264_bitstream_converter.cc',\n        'base/h264_bitstream_converter.h',\n        'base/media.h',\n        'base/media_android.cc',\n        'base/media_export.h',\n        'base/media_log.cc',\n        'base/media_log.h',\n        'base/media_log_event.h',\n        'base/media_posix.cc',\n        'base/media_switches.cc',\n        'base/media_switches.h',\n        'base/media_win.cc',\n        'base/message_loop_factory.cc',\n        'base/message_loop_factory.h',\n        'base/pipeline.cc',\n        'base/pipeline.h',\n        'base/pipeline_status.cc',\n        'base/pipeline_status.h',\n        'base/ranges.cc',\n        'base/ranges.h',\n        'base/seekable_buffer.cc',\n        'base/seekable_buffer.h',\n        'base/state_matrix.cc',\n        'base/state_matrix.h',\n        'base/stream_parser.cc',\n        'base/stream_parser.h',\n        'base/stream_parser_buffer.cc',\n        'base/stream_parser_buffer.h',\n        'base/video_decoder.cc',\n        'base/video_decoder.h',\n        'base/video_decoder_config.cc',\n        'base/video_decoder_config.h',\n        'base/video_frame.cc',\n        'base/video_frame.h',\n        'base/video_renderer.h',\n        'base/video_util.cc',\n        'base/video_util.h',\n        'crypto/aes_decryptor.cc',\n        'crypto/aes_decryptor.h',\n        'ffmpeg/ffmpeg_common.cc',\n        'ffmpeg/ffmpeg_common.h',\n        'ffmpeg/file_protocol.cc',\n        'ffmpeg/file_protocol.h',\n        'filters/audio_file_reader.cc',\n        'filters/audio_file_reader.h',\n        'filters/audio_renderer_algorithm.cc',\n        'filters/audio_renderer_algorithm.h',\n        'filters/audio_renderer_impl.cc',\n        'filters/audio_renderer_impl.h',\n        'filters/bitstream_converter.cc',\n        'filters/bitstream_converter.h',\n        'filters/chunk_demuxer.cc',\n        'filters/chunk_demuxer.h',\n        'filters/chunk_demuxer_client.h',\n        'filters/dummy_demuxer.cc',\n        'filters/dummy_demuxer.h',\n        'filters/ffmpeg_audio_decoder.cc',\n        'filters/ffmpeg_audio_decoder.h',\n        'filters/ffmpeg_demuxer.cc',\n        'filters/ffmpeg_demuxer.h',\n        'filters/ffmpeg_h264_bitstream_converter.cc',\n        'filters/ffmpeg_h264_bitstream_converter.h',\n        'filters/ffmpeg_glue.cc',\n        'filters/ffmpeg_glue.h',\n        'filters/ffmpeg_video_decoder.cc',\n        'filters/ffmpeg_video_decoder.h',\n        'filters/file_data_source.cc',\n        'filters/file_data_source.h',\n        'filters/gpu_video_decoder.cc',\n        'filters/gpu_video_decoder.h',\n        'filters/in_memory_url_protocol.cc',\n        'filters/in_memory_url_protocol.h',\n        'filters/source_buffer_stream.cc',\n        'filters/source_buffer_stream.h',\n        'filters/video_frame_generator.cc',\n        'filters/video_frame_generator.h',\n        'filters/video_renderer_base.cc',\n        'filters/video_renderer_base.h',\n        'video/capture/fake_video_capture_device.cc',\n        'video/capture/fake_video_capture_device.h',\n        'video/capture/linux/video_capture_device_linux.cc',\n        'video/capture/linux/video_capture_device_linux.h',\n        'video/capture/mac/video_capture_device_mac.h',\n        'video/capture/mac/video_capture_device_mac.mm',\n        'video/capture/mac/video_capture_device_qtkit_mac.h',\n        'video/capture/mac/video_capture_device_qtkit_mac.mm',\n        'video/capture/video_capture.h',\n        'video/capture/video_capture_device.h',\n        'video/capture/video_capture_device_dummy.cc',\n        'video/capture/video_capture_device_dummy.h',\n        'video/capture/video_capture_proxy.cc',\n        'video/capture/video_capture_proxy.h',\n        'video/capture/video_capture_types.h',\n        'video/capture/win/filter_base_win.cc',\n        'video/capture/win/filter_base_win.h',\n        'video/capture/win/pin_base_win.cc',\n        'video/capture/win/pin_base_win.h',\n        'video/capture/win/sink_filter_observer_win.h',\n        'video/capture/win/sink_filter_win.cc',\n        'video/capture/win/sink_filter_win.h',\n        'video/capture/win/sink_input_pin_win.cc',\n        'video/capture/win/sink_input_pin_win.h',\n        'video/capture/win/video_capture_device_win.cc',\n        'video/capture/win/video_capture_device_win.h',\n        'video/picture.cc',\n        'video/picture.h',\n        'video/video_decode_accelerator.cc',\n        'video/video_decode_accelerator.h',\n        'webm/webm_constants.h',\n        'webm/webm_cluster_parser.cc',\n        'webm/webm_cluster_parser.h',\n        'webm/webm_content_encodings.cc',\n        'webm/webm_content_encodings.h',\n        'webm/webm_content_encodings_client.cc',\n        'webm/webm_content_encodings_client.h',\n        'webm/webm_info_parser.cc',\n        'webm/webm_info_parser.h',\n        'webm/webm_parser.cc',\n        'webm/webm_parser.h',\n        'webm/webm_stream_parser.cc',\n        'webm/webm_stream_parser.h',\n        'webm/webm_tracks_parser.cc',\n        'webm/webm_tracks_parser.h',\n      ],\n      'direct_dependent_settings': {\n        'include_dirs': [\n          '..',\n        ],\n      },\n      'conditions': [\n        # Android doesn't use ffmpeg, so make the dependency conditional\n        # and exclude the sources which depend on ffmpeg.\n        ['OS != \\\"android\\\"', {\n          'dependencies': [\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n        }],\n        ['OS == \\\"android\\\"', {\n          'sources!': [\n            'base/media_posix.cc',\n            'ffmpeg/ffmpeg_common.cc',\n            'ffmpeg/ffmpeg_common.h',\n            'ffmpeg/file_protocol.cc',\n            'ffmpeg/file_protocol.h',\n            'filters/audio_file_reader.cc',\n            'filters/audio_file_reader.h',\n            'filters/bitstream_converter.cc',\n            'filters/bitstream_converter.h',\n            'filters/chunk_demuxer.cc',\n            'filters/chunk_demuxer.h',\n            'filters/chunk_demuxer_client.h',\n            'filters/ffmpeg_audio_decoder.cc',\n            'filters/ffmpeg_audio_decoder.h',\n            'filters/ffmpeg_demuxer.cc',\n            'filters/ffmpeg_demuxer.h',\n            'filters/ffmpeg_h264_bitstream_converter.cc',\n            'filters/ffmpeg_h264_bitstream_converter.h',\n            'filters/ffmpeg_glue.cc',\n            'filters/ffmpeg_glue.h',\n            'filters/ffmpeg_video_decoder.cc',\n            'filters/ffmpeg_video_decoder.h',\n            'filters/gpu_video_decoder.cc',\n            'filters/gpu_video_decoder.h',\n            'webm/webm_cluster_parser.cc',\n            'webm/webm_cluster_parser.h',\n            'webm/webm_stream_parser.cc',\n            'webm/webm_stream_parser.h',\n          ],\n        }],\n        # The below 'android' condition were added temporarily and should be\n        # removed in downstream, because there is no Java environment setup in\n        # upstream yet.\n        ['OS == \\\"android\\\"', {\n          'sources!':[\n            'audio/android/audio_track_output_android.cc',\n          ],\n          'sources':[\n            'audio/android/audio_track_output_stub_android.cc',\n          ],\n          'link_settings': {\n            'libraries': [\n              '-lOpenSLES',\n            ],\n          },\n        }],\n        ['OS==\\\"linux\\\" or OS==\\\"freebsd\\\" or OS==\\\"solaris\\\"', {\n          'link_settings': {\n            'libraries': [\n              '-lasound',\n            ],\n          },\n        }],\n        ['OS==\\\"openbsd\\\"', {\n          'sources/': [ ['exclude', '/alsa_' ],\n                        ['exclude', '/audio_manager_linux' ] ],\n          'link_settings': {\n            'libraries': [\n            ],\n          },\n        }],\n        ['OS!=\\\"openbsd\\\"', {\n          'sources!': [\n            'audio/openbsd/audio_manager_openbsd.cc',\n            'audio/openbsd/audio_manager_openbsd.h',\n          ],\n        }],\n        ['OS==\\\"linux\\\"', {\n          'variables': {\n            'conditions': [\n              ['sysroot!=\\\"\\\"', {\n                'pkg-config': '../build/linux/pkg-config-wrapper \\\"<(sysroot)\\\" \\\"<(target_arch)\\\"',\n              }, {\n                'pkg-config': 'pkg-config'\n              }],\n            ],\n          },\n          'conditions': [\n            ['use_cras == 1', {\n              'cflags': [\n                '<!@(<(pkg-config) --cflags libcras)',\n              ],\n              'link_settings': {\n                'libraries': [\n                  '<!@(<(pkg-config) --libs libcras)',\n                ],\n              },\n              'defines': [\n                'USE_CRAS',\n              ],\n            }, {  # else: use_cras == 0\n              'sources!': [\n                'audio/linux/cras_output.cc',\n                'audio/linux/cras_output.h',\n              ],\n            }],\n          ],\n        }],\n        ['os_posix == 1', {\n          'conditions': [\n            ['use_pulseaudio == 1', {\n              'cflags': [\n                '<!@(pkg-config --cflags libpulse)',\n              ],\n              'link_settings': {\n                'libraries': [\n                  '<!@(pkg-config --libs-only-l libpulse)',\n                ],\n              },\n              'defines': [\n                'USE_PULSEAUDIO',\n              ],\n            }, {  # else: use_pulseaudio == 0\n              'sources!': [\n                'audio/pulse/pulse_output.cc',\n                'audio/pulse/pulse_output.h',\n              ],\n            }],\n          ],\n        }],\n        ['os_posix == 1 and OS != \\\"android\\\"', {\n          # Video capture isn't supported in Android yet.\n          'sources!': [\n            'video/capture/video_capture_device_dummy.cc',\n            'video/capture/video_capture_device_dummy.h',\n          ],\n        }],\n        ['OS==\\\"mac\\\"', {\n          'link_settings': {\n            'libraries': [\n              '$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework',\n              '$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework',\n              '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework',\n              '$(SDKROOT)/System/Library/Frameworks/CoreVideo.framework',\n              '$(SDKROOT)/System/Library/Frameworks/QTKit.framework',\n            ],\n          },\n        }],\n        ['OS==\\\"win\\\"', {\n          'sources!': [\n            'audio/pulse/pulse_output.cc',\n            'audio/pulse/pulse_output.h',\n            'video/capture/video_capture_device_dummy.cc',\n            'video/capture/video_capture_device_dummy.h',\n          ],\n        }],\n        ['proprietary_codecs==1 or branding==\\\"Chrome\\\"', {\n          'sources': [\n            'mp4/avc.cc',\n            'mp4/avc.h',\n            'mp4/box_definitions.cc',\n            'mp4/box_definitions.h',\n            'mp4/box_reader.cc',\n            'mp4/box_reader.h',\n            'mp4/cenc.cc',\n            'mp4/cenc.h',\n            'mp4/mp4_stream_parser.cc',\n            'mp4/mp4_stream_parser.h',\n            'mp4/offset_byte_queue.cc',\n            'mp4/offset_byte_queue.h',\n            'mp4/track_run_iterator.cc',\n            'mp4/track_run_iterator.h',\n          ],\n        }],\n      ],\n    },\n    {\n      'target_name': 'yuv_convert',\n      'type': 'static_library',\n      'include_dirs': [\n        '..',\n      ],\n      'conditions': [\n        ['order_profiling != 0', {\n          'target_conditions' : [\n            ['_toolset==\\\"target\\\"', {\n              'cflags!': [ '-finstrument-functions' ],\n            }],\n          ],\n        }],\n        [ 'target_arch == \\\"ia32\\\" or target_arch == \\\"x64\\\"', {\n          'dependencies': [\n            'yuv_convert_simd_x86',\n          ],\n        }],\n        [ 'target_arch == \\\"arm\\\"', {\n          'dependencies': [\n            'yuv_convert_simd_arm',\n          ],\n        }],\n      ],\n      'sources': [\n        'base/yuv_convert.cc',\n        'base/yuv_convert.h',\n      ],\n    },\n    {\n      'target_name': 'yuv_convert_simd_x86',\n      'type': 'static_library',\n      'include_dirs': [\n        '..',\n      ],\n      'sources': [\n        'base/simd/convert_rgb_to_yuv_c.cc',\n        'base/simd/convert_rgb_to_yuv_sse2.cc',\n        'base/simd/convert_rgb_to_yuv_ssse3.asm',\n        'base/simd/convert_rgb_to_yuv_ssse3.cc',\n        'base/simd/convert_rgb_to_yuv_ssse3.inc',\n        'base/simd/convert_yuv_to_rgb_c.cc',\n        'base/simd/convert_yuv_to_rgb_x86.cc',\n        'base/simd/convert_yuv_to_rgb_mmx.asm',\n        'base/simd/convert_yuv_to_rgb_mmx.inc',\n        'base/simd/convert_yuv_to_rgb_sse.asm',\n        'base/simd/filter_yuv.h',\n        'base/simd/filter_yuv_c.cc',\n        'base/simd/filter_yuv_mmx.cc',\n        'base/simd/filter_yuv_sse2.cc',\n        'base/simd/linear_scale_yuv_to_rgb_mmx.asm',\n        'base/simd/linear_scale_yuv_to_rgb_mmx.inc',\n        'base/simd/linear_scale_yuv_to_rgb_sse.asm',\n        'base/simd/scale_yuv_to_rgb_mmx.asm',\n        'base/simd/scale_yuv_to_rgb_mmx.inc',\n        'base/simd/scale_yuv_to_rgb_sse.asm',\n        'base/simd/yuv_to_rgb_table.cc',\n        'base/simd/yuv_to_rgb_table.h',\n      ],\n      'conditions': [\n        ['order_profiling != 0', {\n          'target_conditions' : [\n            ['_toolset==\\\"target\\\"', {\n              'cflags!': [ '-finstrument-functions' ],\n            }],\n          ],\n        }],\n        [ 'target_arch == \\\"x64\\\"', {\n          # Source files optimized for X64 systems.\n          'sources': [\n            'base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm',\n            'base/simd/scale_yuv_to_rgb_sse2_x64.asm',\n          ],\n        }],\n        [ 'os_posix == 1 and OS != \\\"mac\\\" and OS != \\\"android\\\"', {\n          'cflags': [\n            '-msse2',\n          ],\n        }],\n        [ 'OS == \\\"mac\\\"', {\n          'configurations': {\n            'Debug': {\n              'xcode_settings': {\n                # gcc on the mac builds horribly unoptimized sse code in debug\n                # mode. Since this is rarely going to be debugged, run with full\n                # optimizations in Debug as well as Release.\n                'GCC_OPTIMIZATION_LEVEL': '3',  # -O3\n               },\n             },\n          },\n        }],\n        [ 'OS==\\\"win\\\"', {\n          'variables': {\n            'yasm_flags': [\n              '-DWIN32',\n              '-DMSVC',\n              '-DCHROMIUM',\n              '-Isimd',\n            ],\n          },\n        }],\n        [ 'OS==\\\"mac\\\"', {\n          'variables': {\n            'yasm_flags': [\n              '-DPREFIX',\n              '-DMACHO',\n              '-DCHROMIUM',\n              '-Isimd',\n            ],\n          },\n        }],\n        [ 'os_posix==1 and OS!=\\\"mac\\\"', {\n          'variables': {\n            'conditions': [\n              [ 'target_arch==\\\"ia32\\\"', {\n                'yasm_flags': [\n                  '-DX86_32',\n                  '-DELF',\n                  '-DCHROMIUM',\n                  '-Isimd',\n                ],\n              }, {\n                'yasm_flags': [\n                  '-DARCH_X86_64',\n                  '-DELF',\n                  '-DPIC',\n                  '-DCHROMIUM',\n                  '-Isimd',\n                ],\n              }],\n            ],\n          },\n        }],\n      ],\n      'variables': {\n        'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/media',\n      },\n      'msvs_2010_disable_uldi_when_referenced': 1,\n      'includes': [\n        '../third_party/yasm/yasm_compile.gypi',\n      ],\n    },\n    {\n      'target_name': 'yuv_convert_simd_arm',\n      'type': 'static_library',\n      'include_dirs': [\n        '..',\n      ],\n      'sources': [\n        'base/simd/convert_rgb_to_yuv_c.cc',\n        'base/simd/convert_rgb_to_yuv.h',\n        'base/simd/convert_yuv_to_rgb_c.cc',\n        'base/simd/convert_yuv_to_rgb.h',\n        'base/simd/filter_yuv.h',\n        'base/simd/filter_yuv_c.cc',\n        'base/simd/yuv_to_rgb_table.cc',\n        'base/simd/yuv_to_rgb_table.h',\n      ],\n    },\n    {\n      'target_name': 'media_unittests',\n      'type': 'executable',\n      'dependencies': [\n        'media',\n        'media_test_support',\n        'yuv_convert',\n        '../base/base.gyp:base',\n        '../base/base.gyp:base_i18n',\n        '../base/base.gyp:test_support_base',\n        '../testing/gmock.gyp:gmock',\n        '../testing/gtest.gyp:gtest',\n        '../ui/ui.gyp:ui',\n      ],\n      'sources': [\n        'audio/async_socket_io_handler_unittest.cc',\n        'audio/audio_input_controller_unittest.cc',\n        'audio/audio_input_device_unittest.cc',\n        'audio/audio_input_unittest.cc',\n        'audio/audio_input_volume_unittest.cc',\n        'audio/audio_low_latency_input_output_unittest.cc',\n        'audio/audio_output_controller_unittest.cc',\n        'audio/audio_output_proxy_unittest.cc',\n        'audio/audio_parameters_unittest.cc',\n        'audio/audio_util_unittest.cc',\n        'audio/cross_process_notification_unittest.cc',\n        'audio/linux/alsa_output_unittest.cc',\n        'audio/mac/audio_low_latency_input_mac_unittest.cc',\n        'audio/mac/audio_output_mac_unittest.cc',\n        'audio/simple_sources_unittest.cc',\n        'audio/win/audio_low_latency_input_win_unittest.cc',\n        'audio/win/audio_low_latency_output_win_unittest.cc',\n        'audio/win/audio_output_win_unittest.cc',\n        'base/audio_renderer_mixer_unittest.cc',\n        'base/audio_renderer_mixer_input_unittest.cc',\n        'base/buffers_unittest.cc',\n        'base/clock_unittest.cc',\n        'base/composite_filter_unittest.cc',\n        'base/data_buffer_unittest.cc',\n        'base/decoder_buffer_unittest.cc',\n        'base/djb2_unittest.cc',\n        'base/fake_audio_render_callback.cc',\n        'base/fake_audio_render_callback.h',\n        'base/filter_collection_unittest.cc',\n        'base/h264_bitstream_converter_unittest.cc',\n        'base/pipeline_unittest.cc',\n        'base/ranges_unittest.cc',\n        'base/run_all_unittests.cc',\n        'base/seekable_buffer_unittest.cc',\n        'base/state_matrix_unittest.cc',\n        'base/test_data_util.cc',\n        'base/test_data_util.h',\n        'base/video_frame_unittest.cc',\n        'base/video_util_unittest.cc',\n        'base/yuv_convert_unittest.cc',\n        'crypto/aes_decryptor_unittest.cc',\n        'ffmpeg/ffmpeg_common_unittest.cc',\n        'filters/audio_renderer_algorithm_unittest.cc',\n        'filters/audio_renderer_impl_unittest.cc',\n        'filters/bitstream_converter_unittest.cc',\n        'filters/chunk_demuxer_unittest.cc',\n        'filters/ffmpeg_audio_decoder_unittest.cc',\n        'filters/ffmpeg_decoder_unittest.h',\n        'filters/ffmpeg_demuxer_unittest.cc',\n        'filters/ffmpeg_glue_unittest.cc',\n        'filters/ffmpeg_h264_bitstream_converter_unittest.cc',\n        'filters/ffmpeg_video_decoder_unittest.cc',\n        'filters/file_data_source_unittest.cc',\n        'filters/pipeline_integration_test.cc',\n        'filters/pipeline_integration_test_base.cc',\n        'filters/source_buffer_stream_unittest.cc',\n        'filters/video_renderer_base_unittest.cc',\n        'video/capture/video_capture_device_unittest.cc',\n        'webm/cluster_builder.cc',\n        'webm/cluster_builder.h',\n        'webm/webm_cluster_parser_unittest.cc',\n        'webm/webm_content_encodings_client_unittest.cc',\n        'webm/webm_parser_unittest.cc',\n      ],\n      'conditions': [\n        ['os_posix==1 and OS!=\\\"mac\\\"', {\n          'conditions': [\n            ['linux_use_tcmalloc==1', {\n              'dependencies': [\n                '../base/allocator/allocator.gyp:allocator',\n              ],\n            }],\n          ],\n        }],\n        ['OS != \\\"android\\\"', {\n          'dependencies': [\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n        }],\n        ['OS == \\\"android\\\"', {\n          'sources!': [\n            'audio/audio_input_volume_unittest.cc',\n            'base/test_data_util.cc',\n            'base/test_data_util.h',\n            'ffmpeg/ffmpeg_common_unittest.cc',\n            'filters/ffmpeg_audio_decoder_unittest.cc',\n            'filters/bitstream_converter_unittest.cc',\n            'filters/chunk_demuxer_unittest.cc',\n            'filters/ffmpeg_demuxer_unittest.cc',\n            'filters/ffmpeg_glue_unittest.cc',\n            'filters/ffmpeg_h264_bitstream_converter_unittest.cc',\n            'filters/ffmpeg_video_decoder_unittest.cc',\n            'filters/pipeline_integration_test.cc',\n            'filters/pipeline_integration_test_base.cc',\n            'mp4/mp4_stream_parser_unittest.cc',\n            'webm/webm_cluster_parser_unittest.cc',\n          ],\n        }],\n        ['OS == \\\"linux\\\"', {\n          'conditions': [\n            ['use_cras == 1', {\n              'sources': [\n                'audio/linux/cras_output_unittest.cc',\n              ],\n              'defines': [\n                'USE_CRAS',\n              ],\n            }],\n          ],\n        }],\n        [ 'target_arch==\\\"ia32\\\" or target_arch==\\\"x64\\\"', {\n          'sources': [\n            'base/simd/convert_rgb_to_yuv_unittest.cc',\n          ],\n        }],\n        ['proprietary_codecs==1 or branding==\\\"Chrome\\\"', {\n          'sources': [\n            'mp4/avc_unittest.cc',\n            'mp4/box_reader_unittest.cc',\n            'mp4/mp4_stream_parser_unittest.cc',\n            'mp4/offset_byte_queue_unittest.cc',\n          ],\n        }],\n      ],\n    },\n    {\n      'target_name': 'media_test_support',\n      'type': 'static_library',\n      'dependencies': [\n        'media',\n        '../base/base.gyp:base',\n        '../testing/gmock.gyp:gmock',\n        '../testing/gtest.gyp:gtest',\n      ],\n      'sources': [\n        'audio/test_audio_input_controller_factory.cc',\n        'audio/test_audio_input_controller_factory.h',\n        'base/mock_callback.cc',\n        'base/mock_callback.h',\n        'base/mock_data_source_host.cc',\n        'base/mock_data_source_host.h',\n        'base/mock_demuxer_host.cc',\n        'base/mock_demuxer_host.h',\n        'base/mock_filter_host.cc',\n        'base/mock_filter_host.h',\n        'base/mock_filters.cc',\n        'base/mock_filters.h',\n      ],\n    },\n    {\n      'target_name': 'scaler_bench',\n      'type': 'executable',\n      'dependencies': [\n        'media',\n        'yuv_convert',\n        '../base/base.gyp:base',\n        '../skia/skia.gyp:skia',\n      ],\n      'sources': [\n        'tools/scaler_bench/scaler_bench.cc',\n      ],\n    },\n    {\n      'target_name': 'qt_faststart',\n      'type': 'executable',\n      'sources': [\n        'tools/qt_faststart/qt_faststart.c'\n      ],\n    },\n    {\n      'target_name': 'seek_tester',\n      'type': 'executable',\n      'dependencies': [\n        'media',\n        '../base/base.gyp:base',\n      ],\n      'sources': [\n        'tools/seek_tester/seek_tester.cc',\n      ],\n    },\n  ],\n  'conditions': [\n    ['OS==\\\"win\\\"', {\n      'targets': [\n        {\n          'target_name': 'player_wtl',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'yuv_convert',\n            '../base/base.gyp:base',\n            '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',\n            '../ui/ui.gyp:ui',\n          ],\n          'include_dirs': [\n            '<(DEPTH)/third_party/wtl/include',\n          ],\n          'sources': [\n            'tools/player_wtl/list.h',\n            'tools/player_wtl/mainfrm.h',\n            'tools/player_wtl/movie.cc',\n            'tools/player_wtl/movie.h',\n            'tools/player_wtl/player_wtl.cc',\n            'tools/player_wtl/player_wtl.rc',\n            'tools/player_wtl/props.h',\n            'tools/player_wtl/seek.h',\n            'tools/player_wtl/resource.h',\n            'tools/player_wtl/view.h',\n          ],\n          'msvs_settings': {\n            'VCLinkerTool': {\n              'SubSystem': '2',         # Set /SUBSYSTEM:WINDOWS\n            },\n          },\n          'defines': [\n            '_CRT_SECURE_NO_WARNINGS=1',\n          ],\n        },\n      ],\n    }],\n    ['OS == \\\"win\\\" or toolkit_uses_gtk == 1', {\n      'targets': [\n        {\n          'target_name': 'shader_bench',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'yuv_convert',\n            '../base/base.gyp:base',\n            '../ui/gl/gl.gyp:gl',\n          ],\n          'sources': [\n            'tools/shader_bench/shader_bench.cc',\n            'tools/shader_bench/cpu_color_painter.cc',\n            'tools/shader_bench/cpu_color_painter.h',\n            'tools/shader_bench/gpu_color_painter.cc',\n            'tools/shader_bench/gpu_color_painter.h',\n            'tools/shader_bench/gpu_painter.cc',\n            'tools/shader_bench/gpu_painter.h',\n            'tools/shader_bench/painter.cc',\n            'tools/shader_bench/painter.h',\n            'tools/shader_bench/window.cc',\n            'tools/shader_bench/window.h',\n          ],\n          'conditions': [\n            ['toolkit_uses_gtk == 1', {\n              'dependencies': [\n                '../build/linux/system.gyp:gtk',\n              ],\n              'sources': [\n                'tools/shader_bench/window_linux.cc',\n              ],\n            }],\n            ['OS==\\\"win\\\"', {\n              'dependencies': [\n                '../third_party/angle/src/build_angle.gyp:libEGL',\n                '../third_party/angle/src/build_angle.gyp:libGLESv2',\n              ],\n              'sources': [\n                'tools/shader_bench/window_win.cc',\n              ],\n            }],\n          ],\n        },\n      ],\n    }],\n    ['OS == \\\"linux\\\" and target_arch != \\\"arm\\\"', {\n      'targets': [\n        {\n          'target_name': 'tile_render_bench',\n          'type': 'executable',\n          'dependencies': [\n            '../base/base.gyp:base',\n            '../ui/gl/gl.gyp:gl',\n          ],\n          'libraries': [\n            '-lGL',\n            '-ldl',\n          ],\n          'sources': [\n            'tools/tile_render_bench/tile_render_bench.cc',\n          ],\n        },\n      ],\n    }],\n    ['os_posix == 1 and OS != \\\"mac\\\" and OS != \\\"android\\\"', {\n      'targets': [\n        {\n          'target_name': 'player_x11',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'yuv_convert',\n            '../base/base.gyp:base',\n            '../ui/gl/gl.gyp:gl',\n          ],\n          'link_settings': {\n            'libraries': [\n              '-ldl',\n              '-lX11',\n              '-lXrender',\n              '-lXext',\n            ],\n          },\n          'sources': [\n            'tools/player_x11/data_source_logger.cc',\n            'tools/player_x11/data_source_logger.h',\n            'tools/player_x11/gl_video_renderer.cc',\n            'tools/player_x11/gl_video_renderer.h',\n            'tools/player_x11/player_x11.cc',\n            'tools/player_x11/x11_video_renderer.cc',\n            'tools/player_x11/x11_video_renderer.h',\n          ],\n        },\n      ],\n    }],\n    ['OS == \\\"android\\\"', {\n      'targets': [\n        {\n          'target_name': 'player_android',\n          'type': 'static_library',\n          'sources': [\n            'base/android/media_player_bridge.cc',\n            'base/android/media_player_bridge.h',\n          ],\n          'dependencies': [\n            '../base/base.gyp:base',\n          ],\n          'include_dirs': [\n            '<(SHARED_INTERMEDIATE_DIR)/media',\n          ],\n          'actions': [\n            {\n              'action_name': 'generate-jni-headers',\n              'inputs': [\n                '../base/android/jni_generator/jni_generator.py',\n                'base/android/java/src/org/chromium/media/MediaPlayerListener.java',\n              ],\n              'outputs': [\n                '<(SHARED_INTERMEDIATE_DIR)/media/jni/media_player_listener_jni.h',\n              ],\n              'action': [\n                'python',\n                '<(DEPTH)/base/android/jni_generator/jni_generator.py',\n                '-o',\n                '<@(_inputs)',\n                '<@(_outputs)',\n              ],\n            },\n          ],\n        },\n        {\n          'target_name': 'media_java',\n          'type': 'none',\n          'dependencies': [ '../base/base.gyp:base_java' ],\n          'variables': {\n            'package_name': 'media',\n            'java_in_dir': 'base/android/java',\n          },\n          'includes': [ '../build/java.gypi' ],\n        },\n\n      ],\n    }, { # OS != \\\"android\\\"'\n      # Android does not use ffmpeg, so disable the targets which require it.\n      'targets': [\n        {\n          'target_name': 'ffmpeg_unittests',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'media_test_support',\n            '../base/base.gyp:base',\n            '../base/base.gyp:base_i18n',\n            '../base/base.gyp:test_support_base',\n            '../base/base.gyp:test_support_perf',\n            '../testing/gtest.gyp:gtest',\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n          'sources': [\n            'ffmpeg/ffmpeg_unittest.cc',\n          ],\n          'conditions': [\n            ['toolkit_uses_gtk == 1', {\n              'dependencies': [\n                # Needed for the following #include chain:\n                #   base/run_all_unittests.cc\n                #   ../base/test_suite.h\n                #   gtk/gtk.h\n                '../build/linux/system.gyp:gtk',\n              ],\n              'conditions': [\n                ['linux_use_tcmalloc==1', {\n                  'dependencies': [\n                    '../base/allocator/allocator.gyp:allocator',\n                  ],\n                }],\n              ],\n            }],\n          ],\n        },\n        {\n          'target_name': 'ffmpeg_regression_tests',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            'media_test_support',\n            '../base/base.gyp:test_support_base',\n            '../testing/gmock.gyp:gmock',\n            '../testing/gtest.gyp:gtest',\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n          'sources': [\n            'base/test_data_util.cc',\n            'base/run_all_unittests.cc',\n            'ffmpeg/ffmpeg_regression_tests.cc',\n            'filters/pipeline_integration_test_base.cc',\n          ],\n          'conditions': [\n            ['os_posix==1 and OS!=\\\"mac\\\"', {\n              'conditions': [\n                ['linux_use_tcmalloc==1', {\n                  'dependencies': [\n                    '../base/allocator/allocator.gyp:allocator',\n                  ],\n                }],\n              ],\n            }],\n          ],\n        },\n        {\n          'target_name': 'ffmpeg_tests',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            '../base/base.gyp:base',\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n          'sources': [\n            'test/ffmpeg_tests/ffmpeg_tests.cc',\n          ],\n        },\n        {\n          'target_name': 'media_bench',\n          'type': 'executable',\n          'dependencies': [\n            'media',\n            '../base/base.gyp:base',\n            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',\n          ],\n          'sources': [\n            'tools/media_bench/media_bench.cc',\n          ],\n        },\n      ],\n    }]\n  ],\n}\n\" 0 64 (face font-lock-comment-face) 64 137 (face font-lock-comment-face) 137 166 (face font-lock-comment-face) 166 171 nil 171 172 (face font-lock-string-face) 172 181 (face font-lock-keyword-face) 181 182 (face font-lock-string-face) 182 190 nil 190 191 (face font-lock-string-face) 191 204 (face font-lock-variable-name-face) 204 205 (face font-lock-string-face) 205 214 nil 214 269 (face font-lock-comment-face) 269 273 nil 273 274 (face font-lock-string-face) 274 289 (face font-lock-variable-name-face) 289 290 (face font-lock-string-face) 290 299 nil 299 365 (face font-lock-comment-face) 365 369 nil 369 370 (face font-lock-string-face) 370 379 (face font-lock-variable-name-face) 379 380 (face font-lock-string-face) 380 392 nil 392 393 (face font-lock-string-face) 393 400 (face font-lock-keyword-face) 400 401 (face font-lock-string-face) 401 417 nil 417 418 (face font-lock-string-face) 418 429 (face font-lock-keyword-face) 429 430 (face font-lock-string-face) 430 432 nil 432 433 (face font-lock-string-face) 433 438 (face font-lock-function-name-face) 438 439 (face font-lock-string-face) 439 447 nil 447 448 (face font-lock-string-face) 448 452 (face font-lock-keyword-face) 452 453 (face font-lock-string-face) 453 455 nil 455 458 (face font-lock-string-face) 458 467 (face font-lock-variable-name-face) 467 469 (face font-lock-string-face) 469 477 nil 477 478 (face font-lock-string-face) 478 490 (face font-lock-keyword-face) 490 491 (face font-lock-string-face) 491 503 nil 503 504 (face font-lock-string-face) 504 515 (face font-lock-function-name-face) 515 516 (face font-lock-string-face) 516 526 nil 526 527 (face font-lock-string-face) 527 548 (face font-lock-function-name-face) 548 549 (face font-lock-string-face) 549 559 nil 559 560 (face font-lock-string-face) 560 643 (face font-lock-function-name-face) 643 644 (face font-lock-string-face) 644 654 nil 654 655 (face font-lock-string-face) 655 696 (face font-lock-function-name-face) 696 697 (face font-lock-string-face) 697 707 nil 707 708 (face font-lock-string-face) 708 735 (face font-lock-function-name-face) 735 736 (face font-lock-string-face) 736 746 nil 746 747 (face font-lock-string-face) 747 784 (face font-lock-function-name-face) 784 785 (face font-lock-string-face) 785 795 nil 795 796 (face font-lock-string-face) 796 811 (face font-lock-function-name-face) 811 812 (face font-lock-string-face) 812 829 nil 829 830 (face font-lock-string-face) 830 837 (face font-lock-keyword-face) 837 838 (face font-lock-string-face) 838 850 nil 850 851 (face font-lock-string-face) 851 871 (face font-lock-preprocessor-face) 871 872 (face font-lock-string-face) 872 889 nil 889 890 (face font-lock-string-face) 890 902 (face font-lock-keyword-face) 902 903 (face font-lock-string-face) 903 915 nil 915 916 (face font-lock-string-face) 916 918 (face font-lock-constant-face) 918 919 (face font-lock-string-face) 919 936 nil 936 937 (face font-lock-string-face) 937 944 (face font-lock-keyword-face) 944 945 (face font-lock-string-face) 945 957 nil 957 958 (face font-lock-string-face) 958 996 (face font-lock-constant-face) 996 997 (face font-lock-string-face) 997 1007 nil 1007 1008 (face font-lock-string-face) 1008 1045 (face font-lock-constant-face) 1045 1046 (face font-lock-string-face) 1046 1056 nil 1056 1057 (face font-lock-string-face) 1057 1100 (face font-lock-constant-face) 1100 1101 (face font-lock-string-face) 1101 1111 nil 1111 1112 (face font-lock-string-face) 1112 1154 (face font-lock-constant-face) 1154 1155 (face font-lock-string-face) 1155 1165 nil 1165 1166 (face font-lock-string-face) 1166 1197 (face font-lock-constant-face) 1197 1198 (face font-lock-string-face) 1198 1208 nil 1208 1209 (face font-lock-string-face) 1209 1239 (face font-lock-constant-face) 1239 1240 (face font-lock-string-face) 1240 1250 nil 1250 1251 (face font-lock-string-face) 1251 1283 (face font-lock-constant-face) 1283 1284 (face font-lock-string-face) 1284 1294 nil 1294 1295 (face font-lock-string-face) 1295 1326 (face font-lock-constant-face) 1326 1327 (face font-lock-string-face) 1327 1337 nil 1337 1338 (face font-lock-string-face) 1338 1369 (face font-lock-constant-face) 1369 1370 (face font-lock-string-face) 1370 1380 nil 1380 1381 (face font-lock-string-face) 1381 1419 (face font-lock-constant-face) 1419 1420 (face font-lock-string-face) 1420 1430 nil 1430 1431 (face font-lock-string-face) 1431 1467 (face font-lock-constant-face) 1467 1468 (face font-lock-string-face) 1468 1478 nil 1478 1479 (face font-lock-string-face) 1479 1507 (face font-lock-constant-face) 1507 1508 (face font-lock-string-face) 1508 1518 nil 1518 1519 (face font-lock-string-face) 1519 1546 (face font-lock-constant-face) 1546 1547 (face font-lock-string-face) 1547 1557 nil 1557 1558 (face font-lock-string-face) 1558 1574 (face font-lock-constant-face) 1574 1575 (face font-lock-string-face) 1575 1585 nil 1585 1586 (face font-lock-string-face) 1586 1617 (face font-lock-constant-face) 1617 1618 (face font-lock-string-face) 1618 1628 nil 1628 1629 (face font-lock-string-face) 1629 1659 (face font-lock-constant-face) 1659 1660 (face font-lock-string-face) 1660 1670 nil 1670 1671 (face font-lock-string-face) 1671 1703 (face font-lock-constant-face) 1703 1704 (face font-lock-string-face) 1704 1714 nil 1714 1715 (face font-lock-string-face) 1715 1746 (face font-lock-constant-face) 1746 1747 (face font-lock-string-face) 1747 1757 nil 1757 1758 (face font-lock-string-face) 1758 1784 (face font-lock-constant-face) 1784 1785 (face font-lock-string-face) 1785 1795 nil 1795 1796 (face font-lock-string-face) 1796 1821 (face font-lock-constant-face) 1821 1822 (face font-lock-string-face) 1822 1832 nil 1832 1833 (face font-lock-string-face) 1833 1855 (face font-lock-constant-face) 1855 1856 (face font-lock-string-face) 1856 1866 nil 1866 1867 (face font-lock-string-face) 1867 1888 (face font-lock-constant-face) 1888 1889 (face font-lock-string-face) 1889 1899 nil 1899 1900 (face font-lock-string-face) 1900 1927 (face font-lock-constant-face) 1927 1928 (face font-lock-string-face) 1928 1938 nil 1938 1939 (face font-lock-string-face) 1939 1965 (face font-lock-constant-face) 1965 1966 (face font-lock-string-face) 1966 1976 nil 1976 1977 (face font-lock-string-face) 1977 2009 (face font-lock-constant-face) 2009 2010 (face font-lock-string-face) 2010 2020 nil 2020 2021 (face font-lock-string-face) 2021 2052 (face font-lock-constant-face) 2052 2053 (face font-lock-string-face) 2053 2063 nil 2063 2064 (face font-lock-string-face) 2064 2096 (face font-lock-constant-face) 2096 2097 (face font-lock-string-face) 2097 2107 nil 2107 2108 (face font-lock-string-face) 2108 2139 (face font-lock-constant-face) 2139 2140 (face font-lock-string-face) 2140 2150 nil 2150 2151 (face font-lock-string-face) 2151 2188 (face font-lock-constant-face) 2188 2189 (face font-lock-string-face) 2189 2199 nil 2199 2200 (face font-lock-string-face) 2200 2236 (face font-lock-constant-face) 2236 2237 (face font-lock-string-face) 2237 2247 nil 2247 2248 (face font-lock-string-face) 2248 2275 (face font-lock-constant-face) 2275 2276 (face font-lock-string-face) 2276 2286 nil 2286 2287 (face font-lock-string-face) 2287 2313 (face font-lock-constant-face) 2313 2314 (face font-lock-string-face) 2314 2324 nil 2324 2325 (face font-lock-string-face) 2325 2352 (face font-lock-constant-face) 2352 2353 (face font-lock-string-face) 2353 2363 nil 2363 2364 (face font-lock-string-face) 2364 2390 (face font-lock-constant-face) 2390 2391 (face font-lock-string-face) 2391 2401 nil 2401 2402 (face font-lock-string-face) 2402 2427 (face font-lock-constant-face) 2427 2428 (face font-lock-string-face) 2428 2438 nil 2438 2439 (face font-lock-string-face) 2439 2463 (face font-lock-constant-face) 2463 2464 (face font-lock-string-face) 2464 2474 nil 2474 2475 (face font-lock-string-face) 2475 2494 (face font-lock-constant-face) 2494 2495 (face font-lock-string-face) 2495 2505 nil 2505 2506 (face font-lock-string-face) 2506 2524 (face font-lock-constant-face) 2524 2525 (face font-lock-string-face) 2525 2535 nil 2535 2536 (face font-lock-string-face) 2536 2571 (face font-lock-constant-face) 2571 2572 (face font-lock-string-face) 2572 2582 nil 2582 2583 (face font-lock-string-face) 2583 2617 (face font-lock-constant-face) 2617 2618 (face font-lock-string-face) 2618 2628 nil 2628 2629 (face font-lock-string-face) 2629 2668 (face font-lock-constant-face) 2668 2669 (face font-lock-string-face) 2669 2679 nil 2679 2680 (face font-lock-string-face) 2680 2721 (face font-lock-constant-face) 2721 2722 (face font-lock-string-face) 2722 2732 nil 2732 2733 (face font-lock-string-face) 2733 2765 (face font-lock-constant-face) 2765 2766 (face font-lock-string-face) 2766 2776 nil 2776 2777 (face font-lock-string-face) 2777 2808 (face font-lock-constant-face) 2808 2809 (face font-lock-string-face) 2809 2819 nil 2819 2820 (face font-lock-string-face) 2820 2853 (face font-lock-constant-face) 2853 2854 (face font-lock-string-face) 2854 2864 nil 2864 2865 (face font-lock-string-face) 2865 2897 (face font-lock-constant-face) 2897 2898 (face font-lock-string-face) 2898 2908 nil 2908 2909 (face font-lock-string-face) 2909 2943 (face font-lock-constant-face) 2943 2944 (face font-lock-string-face) 2944 2954 nil 2954 2955 (face font-lock-string-face) 2955 2988 (face font-lock-constant-face) 2988 2989 (face font-lock-string-face) 2989 2999 nil 2999 3000 (face font-lock-string-face) 3000 3025 (face font-lock-constant-face) 3025 3026 (face font-lock-string-face) 3026 3036 nil 3036 3037 (face font-lock-string-face) 3037 3061 (face font-lock-constant-face) 3061 3062 (face font-lock-string-face) 3062 3072 nil 3072 3073 (face font-lock-string-face) 3073 3099 (face font-lock-constant-face) 3099 3100 (face font-lock-string-face) 3100 3110 nil 3110 3111 (face font-lock-string-face) 3111 3136 (face font-lock-constant-face) 3136 3137 (face font-lock-string-face) 3137 3147 nil 3147 3148 (face font-lock-string-face) 3148 3172 (face font-lock-constant-face) 3172 3173 (face font-lock-string-face) 3173 3183 nil 3183 3184 (face font-lock-string-face) 3184 3207 (face font-lock-constant-face) 3207 3208 (face font-lock-string-face) 3208 3218 nil 3218 3219 (face font-lock-string-face) 3219 3246 (face font-lock-constant-face) 3246 3247 (face font-lock-string-face) 3247 3257 nil 3257 3258 (face font-lock-string-face) 3258 3284 (face font-lock-constant-face) 3284 3285 (face font-lock-string-face) 3285 3295 nil 3295 3296 (face font-lock-string-face) 3296 3322 (face font-lock-constant-face) 3322 3323 (face font-lock-string-face) 3323 3333 nil 3333 3334 (face font-lock-string-face) 3334 3359 (face font-lock-constant-face) 3359 3360 (face font-lock-string-face) 3360 3370 nil 3370 3371 (face font-lock-string-face) 3371 3409 (face font-lock-constant-face) 3409 3410 (face font-lock-string-face) 3410 3420 nil 3420 3421 (face font-lock-string-face) 3421 3458 (face font-lock-constant-face) 3458 3459 (face font-lock-string-face) 3459 3469 nil 3469 3470 (face font-lock-string-face) 3470 3498 (face font-lock-constant-face) 3498 3499 (face font-lock-string-face) 3499 3509 nil 3509 3510 (face font-lock-string-face) 3510 3537 (face font-lock-constant-face) 3537 3538 (face font-lock-string-face) 3538 3548 nil 3548 3549 (face font-lock-string-face) 3549 3589 (face font-lock-constant-face) 3589 3590 (face font-lock-string-face) 3590 3600 nil 3600 3601 (face font-lock-string-face) 3601 3640 (face font-lock-constant-face) 3640 3641 (face font-lock-string-face) 3641 3651 nil 3651 3652 (face font-lock-string-face) 3652 3693 (face font-lock-constant-face) 3693 3694 (face font-lock-string-face) 3694 3704 nil 3704 3705 (face font-lock-string-face) 3705 3745 (face font-lock-constant-face) 3745 3746 (face font-lock-string-face) 3746 3756 nil 3756 3757 (face font-lock-string-face) 3757 3787 (face font-lock-constant-face) 3787 3788 (face font-lock-string-face) 3788 3798 nil 3798 3799 (face font-lock-string-face) 3799 3828 (face font-lock-constant-face) 3828 3829 (face font-lock-string-face) 3829 3839 nil 3839 3840 (face font-lock-string-face) 3840 3869 (face font-lock-constant-face) 3869 3870 (face font-lock-string-face) 3870 3880 nil 3880 3881 (face font-lock-string-face) 3881 3909 (face font-lock-constant-face) 3909 3910 (face font-lock-string-face) 3910 3920 nil 3920 3921 (face font-lock-string-face) 3921 3945 (face font-lock-constant-face) 3945 3946 (face font-lock-string-face) 3946 3956 nil 3956 3957 (face font-lock-string-face) 3957 3980 (face font-lock-constant-face) 3980 3981 (face font-lock-string-face) 3981 3991 nil 3991 3992 (face font-lock-string-face) 3992 4019 (face font-lock-constant-face) 4019 4020 (face font-lock-string-face) 4020 4030 nil 4030 4031 (face font-lock-string-face) 4031 4057 (face font-lock-constant-face) 4057 4058 (face font-lock-string-face) 4058 4068 nil 4068 4069 (face font-lock-string-face) 4069 4090 (face font-lock-constant-face) 4090 4091 (face font-lock-string-face) 4091 4101 nil 4101 4102 (face font-lock-string-face) 4102 4122 (face font-lock-constant-face) 4122 4123 (face font-lock-string-face) 4123 4133 nil 4133 4134 (face font-lock-string-face) 4134 4157 (face font-lock-constant-face) 4157 4158 (face font-lock-string-face) 4158 4168 nil 4168 4169 (face font-lock-string-face) 4169 4191 (face font-lock-constant-face) 4191 4192 (face font-lock-string-face) 4192 4202 nil 4202 4203 (face font-lock-string-face) 4203 4243 (face font-lock-constant-face) 4243 4244 (face font-lock-string-face) 4244 4254 nil 4254 4255 (face font-lock-string-face) 4255 4294 (face font-lock-constant-face) 4294 4295 (face font-lock-string-face) 4295 4305 nil 4305 4306 (face font-lock-string-face) 4306 4347 (face font-lock-constant-face) 4347 4348 (face font-lock-string-face) 4348 4358 nil 4358 4359 (face font-lock-string-face) 4359 4399 (face font-lock-constant-face) 4399 4400 (face font-lock-string-face) 4400 4410 nil 4410 4411 (face font-lock-string-face) 4411 4441 (face font-lock-constant-face) 4441 4442 (face font-lock-string-face) 4442 4452 nil 4452 4453 (face font-lock-string-face) 4453 4482 (face font-lock-constant-face) 4482 4483 (face font-lock-string-face) 4483 4493 nil 4493 4494 (face font-lock-string-face) 4494 4523 (face font-lock-constant-face) 4523 4524 (face font-lock-string-face) 4524 4534 nil 4534 4535 (face font-lock-string-face) 4535 4563 (face font-lock-constant-face) 4563 4564 (face font-lock-string-face) 4564 4574 nil 4574 4575 (face font-lock-string-face) 4575 4610 (face font-lock-constant-face) 4610 4611 (face font-lock-string-face) 4611 4621 nil 4621 4622 (face font-lock-string-face) 4622 4656 (face font-lock-constant-face) 4656 4657 (face font-lock-string-face) 4657 4667 nil 4667 4668 (face font-lock-string-face) 4668 4697 (face font-lock-constant-face) 4697 4698 (face font-lock-string-face) 4698 4708 nil 4708 4709 (face font-lock-string-face) 4709 4737 (face font-lock-constant-face) 4737 4738 (face font-lock-string-face) 4738 4748 nil 4748 4749 (face font-lock-string-face) 4749 4780 (face font-lock-constant-face) 4780 4781 (face font-lock-string-face) 4781 4791 nil 4791 4792 (face font-lock-string-face) 4792 4822 (face font-lock-constant-face) 4822 4823 (face font-lock-string-face) 4823 4833 nil 4833 4834 (face font-lock-string-face) 4834 4869 (face font-lock-constant-face) 4869 4870 (face font-lock-string-face) 4870 4880 nil 4880 4881 (face font-lock-string-face) 4881 4915 (face font-lock-constant-face) 4915 4916 (face font-lock-string-face) 4916 4926 nil 4926 4927 (face font-lock-string-face) 4927 4948 (face font-lock-constant-face) 4948 4949 (face font-lock-string-face) 4949 4959 nil 4959 4960 (face font-lock-string-face) 4960 4980 (face font-lock-constant-face) 4980 4981 (face font-lock-string-face) 4981 4991 nil 4991 4992 (face font-lock-string-face) 4992 5020 (face font-lock-constant-face) 5020 5021 (face font-lock-string-face) 5021 5031 nil 5031 5032 (face font-lock-string-face) 5032 5059 (face font-lock-constant-face) 5059 5060 (face font-lock-string-face) 5060 5070 nil 5070 5071 (face font-lock-string-face) 5071 5092 (face font-lock-constant-face) 5092 5093 (face font-lock-string-face) 5093 5103 nil 5103 5104 (face font-lock-string-face) 5104 5132 (face font-lock-constant-face) 5132 5133 (face font-lock-string-face) 5133 5143 nil 5143 5144 (face font-lock-string-face) 5144 5171 (face font-lock-constant-face) 5171 5172 (face font-lock-string-face) 5172 5182 nil 5182 5183 (face font-lock-string-face) 5183 5217 (face font-lock-constant-face) 5217 5218 (face font-lock-string-face) 5218 5228 nil 5228 5229 (face font-lock-string-face) 5229 5262 (face font-lock-constant-face) 5262 5263 (face font-lock-string-face) 5263 5273 nil 5273 5274 (face font-lock-string-face) 5274 5297 (face font-lock-constant-face) 5297 5298 (face font-lock-string-face) 5298 5308 nil 5308 5309 (face font-lock-string-face) 5309 5324 (face font-lock-constant-face) 5324 5325 (face font-lock-string-face) 5325 5335 nil 5335 5336 (face font-lock-string-face) 5336 5350 (face font-lock-constant-face) 5350 5351 (face font-lock-string-face) 5351 5361 nil 5361 5362 (face font-lock-string-face) 5362 5380 (face font-lock-constant-face) 5380 5381 (face font-lock-string-face) 5381 5391 nil 5391 5392 (face font-lock-string-face) 5392 5409 (face font-lock-constant-face) 5409 5410 (face font-lock-string-face) 5410 5420 nil 5420 5421 (face font-lock-string-face) 5421 5443 (face font-lock-constant-face) 5443 5444 (face font-lock-string-face) 5444 5454 nil 5454 5455 (face font-lock-string-face) 5455 5476 (face font-lock-constant-face) 5476 5477 (face font-lock-string-face) 5477 5487 nil 5487 5488 (face font-lock-string-face) 5488 5501 (face font-lock-constant-face) 5501 5502 (face font-lock-string-face) 5502 5512 nil 5512 5513 (face font-lock-string-face) 5513 5525 (face font-lock-constant-face) 5525 5526 (face font-lock-string-face) 5526 5536 nil 5536 5537 (face font-lock-string-face) 5537 5561 (face font-lock-constant-face) 5561 5562 (face font-lock-string-face) 5562 5572 nil 5572 5573 (face font-lock-string-face) 5573 5596 (face font-lock-constant-face) 5596 5597 (face font-lock-string-face) 5597 5607 nil 5607 5608 (face font-lock-string-face) 5608 5627 (face font-lock-constant-face) 5627 5628 (face font-lock-string-face) 5628 5638 nil 5638 5639 (face font-lock-string-face) 5639 5657 (face font-lock-constant-face) 5657 5658 (face font-lock-string-face) 5658 5668 nil 5668 5669 (face font-lock-string-face) 5669 5688 (face font-lock-constant-face) 5688 5689 (face font-lock-string-face) 5689 5699 nil 5699 5700 (face font-lock-string-face) 5700 5718 (face font-lock-constant-face) 5718 5719 (face font-lock-string-face) 5719 5729 nil 5729 5730 (face font-lock-string-face) 5730 5752 (face font-lock-constant-face) 5752 5753 (face font-lock-string-face) 5753 5763 nil 5763 5764 (face font-lock-string-face) 5764 5785 (face font-lock-constant-face) 5785 5786 (face font-lock-string-face) 5786 5796 nil 5796 5797 (face font-lock-string-face) 5797 5819 (face font-lock-constant-face) 5819 5820 (face font-lock-string-face) 5820 5830 nil 5830 5831 (face font-lock-string-face) 5831 5852 (face font-lock-constant-face) 5852 5853 (face font-lock-string-face) 5853 5863 nil 5863 5864 (face font-lock-string-face) 5864 5880 (face font-lock-constant-face) 5880 5881 (face font-lock-string-face) 5881 5891 nil 5891 5892 (face font-lock-string-face) 5892 5915 (face font-lock-constant-face) 5915 5916 (face font-lock-string-face) 5916 5926 nil 5926 5927 (face font-lock-string-face) 5927 5942 (face font-lock-constant-face) 5942 5943 (face font-lock-string-face) 5943 5953 nil 5953 5954 (face font-lock-string-face) 5954 5968 (face font-lock-constant-face) 5968 5969 (face font-lock-string-face) 5969 5979 nil 5979 5980 (face font-lock-string-face) 5980 6002 (face font-lock-constant-face) 6002 6003 (face font-lock-string-face) 6003 6013 nil 6013 6014 (face font-lock-string-face) 6014 6035 (face font-lock-constant-face) 6035 6036 (face font-lock-string-face) 6036 6046 nil 6046 6047 (face font-lock-string-face) 6047 6059 (face font-lock-constant-face) 6059 6060 (face font-lock-string-face) 6060 6070 nil 6070 6071 (face font-lock-string-face) 6071 6082 (face font-lock-constant-face) 6082 6083 (face font-lock-string-face) 6083 6093 nil 6093 6094 (face font-lock-string-face) 6094 6119 (face font-lock-constant-face) 6119 6120 (face font-lock-string-face) 6120 6130 nil 6130 6131 (face font-lock-string-face) 6131 6155 (face font-lock-constant-face) 6155 6156 (face font-lock-string-face) 6156 6166 nil 6166 6167 (face font-lock-string-face) 6167 6185 (face font-lock-constant-face) 6185 6186 (face font-lock-string-face) 6186 6196 nil 6196 6197 (face font-lock-string-face) 6197 6212 (face font-lock-constant-face) 6212 6213 (face font-lock-string-face) 6213 6223 nil 6223 6224 (face font-lock-string-face) 6224 6238 (face font-lock-constant-face) 6238 6239 (face font-lock-string-face) 6239 6249 nil 6249 6250 (face font-lock-string-face) 6250 6282 (face font-lock-constant-face) 6282 6283 (face font-lock-string-face) 6283 6293 nil 6293 6294 (face font-lock-string-face) 6294 6325 (face font-lock-constant-face) 6325 6326 (face font-lock-string-face) 6326 6336 nil 6336 6337 (face font-lock-string-face) 6337 6349 (face font-lock-constant-face) 6349 6350 (face font-lock-string-face) 6350 6360 nil 6360 6361 (face font-lock-string-face) 6361 6382 (face font-lock-constant-face) 6382 6383 (face font-lock-string-face) 6383 6393 nil 6393 6394 (face font-lock-string-face) 6394 6413 (face font-lock-constant-face) 6413 6414 (face font-lock-string-face) 6414 6424 nil 6424 6425 (face font-lock-string-face) 6425 6442 (face font-lock-constant-face) 6442 6443 (face font-lock-string-face) 6443 6453 nil 6453 6454 (face font-lock-string-face) 6454 6470 (face font-lock-constant-face) 6470 6471 (face font-lock-string-face) 6471 6481 nil 6481 6482 (face font-lock-string-face) 6482 6504 (face font-lock-constant-face) 6504 6505 (face font-lock-string-face) 6505 6515 nil 6515 6516 (face font-lock-string-face) 6516 6535 (face font-lock-constant-face) 6535 6536 (face font-lock-string-face) 6536 6546 nil 6546 6547 (face font-lock-string-face) 6547 6569 (face font-lock-constant-face) 6569 6570 (face font-lock-string-face) 6570 6580 nil 6580 6581 (face font-lock-string-face) 6581 6602 (face font-lock-constant-face) 6602 6603 (face font-lock-string-face) 6603 6613 nil 6613 6614 (face font-lock-string-face) 6614 6631 (face font-lock-constant-face) 6631 6632 (face font-lock-string-face) 6632 6642 nil 6642 6643 (face font-lock-string-face) 6643 6671 (face font-lock-constant-face) 6671 6672 (face font-lock-string-face) 6672 6682 nil 6682 6683 (face font-lock-string-face) 6683 6710 (face font-lock-constant-face) 6710 6711 (face font-lock-string-face) 6711 6721 nil 6721 6722 (face font-lock-string-face) 6722 6738 (face font-lock-constant-face) 6738 6739 (face font-lock-string-face) 6739 6749 nil 6749 6750 (face font-lock-string-face) 6750 6765 (face font-lock-constant-face) 6765 6766 (face font-lock-string-face) 6766 6776 nil 6776 6777 (face font-lock-string-face) 6777 6800 (face font-lock-constant-face) 6800 6801 (face font-lock-string-face) 6801 6811 nil 6811 6812 (face font-lock-string-face) 6812 6834 (face font-lock-constant-face) 6834 6835 (face font-lock-string-face) 6835 6845 nil 6845 6846 (face font-lock-string-face) 6846 6860 (face font-lock-constant-face) 6860 6861 (face font-lock-string-face) 6861 6871 nil 6871 6872 (face font-lock-string-face) 6872 6885 (face font-lock-constant-face) 6885 6886 (face font-lock-string-face) 6886 6896 nil 6896 6897 (face font-lock-string-face) 6897 6920 (face font-lock-constant-face) 6920 6921 (face font-lock-string-face) 6921 6931 nil 6931 6932 (face font-lock-string-face) 6932 6954 (face font-lock-constant-face) 6954 6955 (face font-lock-string-face) 6955 6965 nil 6965 6966 (face font-lock-string-face) 6966 6986 (face font-lock-constant-face) 6986 6987 (face font-lock-string-face) 6987 6997 nil 6997 6998 (face font-lock-string-face) 6998 7017 (face font-lock-constant-face) 7017 7018 (face font-lock-string-face) 7018 7028 nil 7028 7029 (face font-lock-string-face) 7029 7050 (face font-lock-constant-face) 7050 7051 (face font-lock-string-face) 7051 7061 nil 7061 7062 (face font-lock-string-face) 7062 7082 (face font-lock-constant-face) 7082 7083 (face font-lock-string-face) 7083 7093 nil 7093 7094 (face font-lock-string-face) 7094 7122 (face font-lock-constant-face) 7122 7123 (face font-lock-string-face) 7123 7133 nil 7133 7134 (face font-lock-string-face) 7134 7161 (face font-lock-constant-face) 7161 7162 (face font-lock-string-face) 7162 7172 nil 7172 7173 (face font-lock-string-face) 7173 7194 (face font-lock-constant-face) 7194 7195 (face font-lock-string-face) 7195 7205 nil 7205 7206 (face font-lock-string-face) 7206 7226 (face font-lock-constant-face) 7226 7227 (face font-lock-string-face) 7227 7237 nil 7237 7238 (face font-lock-string-face) 7238 7266 (face font-lock-constant-face) 7266 7267 (face font-lock-string-face) 7267 7277 nil 7277 7278 (face font-lock-string-face) 7278 7305 (face font-lock-constant-face) 7305 7306 (face font-lock-string-face) 7306 7316 nil 7316 7317 (face font-lock-string-face) 7317 7336 (face font-lock-constant-face) 7336 7337 (face font-lock-string-face) 7337 7347 nil 7347 7348 (face font-lock-string-face) 7348 7366 (face font-lock-constant-face) 7366 7367 (face font-lock-string-face) 7367 7377 nil 7377 7378 (face font-lock-string-face) 7378 7399 (face font-lock-constant-face) 7399 7400 (face font-lock-string-face) 7400 7410 nil 7410 7411 (face font-lock-string-face) 7411 7429 (face font-lock-constant-face) 7429 7430 (face font-lock-string-face) 7430 7440 nil 7440 7441 (face font-lock-string-face) 7441 7458 (face font-lock-constant-face) 7458 7459 (face font-lock-string-face) 7459 7469 nil 7469 7470 (face font-lock-string-face) 7470 7493 (face font-lock-constant-face) 7493 7494 (face font-lock-string-face) 7494 7504 nil 7504 7505 (face font-lock-string-face) 7505 7527 (face font-lock-constant-face) 7527 7528 (face font-lock-string-face) 7528 7538 nil 7538 7539 (face font-lock-string-face) 7539 7562 (face font-lock-constant-face) 7562 7563 (face font-lock-string-face) 7563 7573 nil 7573 7574 (face font-lock-string-face) 7574 7596 (face font-lock-constant-face) 7596 7597 (face font-lock-string-face) 7597 7607 nil 7607 7608 (face font-lock-string-face) 7608 7631 (face font-lock-constant-face) 7631 7632 (face font-lock-string-face) 7632 7642 nil 7642 7643 (face font-lock-string-face) 7643 7665 (face font-lock-constant-face) 7665 7666 (face font-lock-string-face) 7666 7676 nil 7676 7677 (face font-lock-string-face) 7677 7705 (face font-lock-constant-face) 7705 7706 (face font-lock-string-face) 7706 7716 nil 7716 7717 (face font-lock-string-face) 7717 7744 (face font-lock-constant-face) 7744 7745 (face font-lock-string-face) 7745 7755 nil 7755 7756 (face font-lock-string-face) 7756 7791 (face font-lock-constant-face) 7791 7792 (face font-lock-string-face) 7792 7802 nil 7802 7803 (face font-lock-string-face) 7803 7837 (face font-lock-constant-face) 7837 7838 (face font-lock-string-face) 7838 7848 nil 7848 7849 (face font-lock-string-face) 7849 7879 (face font-lock-constant-face) 7879 7880 (face font-lock-string-face) 7880 7890 nil 7890 7891 (face font-lock-string-face) 7891 7920 (face font-lock-constant-face) 7920 7921 (face font-lock-string-face) 7921 7931 nil 7931 7932 (face font-lock-string-face) 7932 7962 (face font-lock-constant-face) 7962 7963 (face font-lock-string-face) 7963 7973 nil 7973 7974 (face font-lock-string-face) 7974 8003 (face font-lock-constant-face) 8003 8004 (face font-lock-string-face) 8004 8014 nil 8014 8015 (face font-lock-string-face) 8015 8039 (face font-lock-constant-face) 8039 8040 (face font-lock-string-face) 8040 8050 nil 8050 8051 (face font-lock-string-face) 8051 8074 (face font-lock-constant-face) 8074 8075 (face font-lock-string-face) 8075 8085 nil 8085 8086 (face font-lock-string-face) 8086 8116 (face font-lock-constant-face) 8116 8117 (face font-lock-string-face) 8117 8127 nil 8127 8128 (face font-lock-string-face) 8128 8152 (face font-lock-constant-face) 8152 8153 (face font-lock-string-face) 8153 8163 nil 8163 8164 (face font-lock-string-face) 8164 8187 (face font-lock-constant-face) 8187 8188 (face font-lock-string-face) 8188 8198 nil 8198 8199 (face font-lock-string-face) 8199 8230 (face font-lock-constant-face) 8230 8231 (face font-lock-string-face) 8231 8241 nil 8241 8242 (face font-lock-string-face) 8242 8272 (face font-lock-constant-face) 8272 8273 (face font-lock-string-face) 8273 8283 nil 8283 8284 (face font-lock-string-face) 8284 8309 (face font-lock-constant-face) 8309 8310 (face font-lock-string-face) 8310 8320 nil 8320 8321 (face font-lock-string-face) 8321 8345 (face font-lock-constant-face) 8345 8346 (face font-lock-string-face) 8346 8356 nil 8356 8357 (face font-lock-string-face) 8357 8399 (face font-lock-constant-face) 8399 8400 (face font-lock-string-face) 8400 8410 nil 8410 8411 (face font-lock-string-face) 8411 8452 (face font-lock-constant-face) 8452 8453 (face font-lock-string-face) 8453 8463 nil 8463 8464 (face font-lock-string-face) 8464 8486 (face font-lock-constant-face) 8486 8487 (face font-lock-string-face) 8487 8497 nil 8497 8498 (face font-lock-string-face) 8498 8519 (face font-lock-constant-face) 8519 8520 (face font-lock-string-face) 8520 8530 nil 8530 8531 (face font-lock-string-face) 8531 8562 (face font-lock-constant-face) 8562 8563 (face font-lock-string-face) 8563 8573 nil 8573 8574 (face font-lock-string-face) 8574 8604 (face font-lock-constant-face) 8604 8605 (face font-lock-string-face) 8605 8615 nil 8615 8616 (face font-lock-string-face) 8616 8643 (face font-lock-constant-face) 8643 8644 (face font-lock-string-face) 8644 8654 nil 8654 8655 (face font-lock-string-face) 8655 8681 (face font-lock-constant-face) 8681 8682 (face font-lock-string-face) 8682 8692 nil 8692 8693 (face font-lock-string-face) 8693 8721 (face font-lock-constant-face) 8721 8722 (face font-lock-string-face) 8722 8732 nil 8732 8733 (face font-lock-string-face) 8733 8760 (face font-lock-constant-face) 8760 8761 (face font-lock-string-face) 8761 8771 nil 8771 8772 (face font-lock-string-face) 8772 8805 (face font-lock-constant-face) 8805 8806 (face font-lock-string-face) 8806 8816 nil 8816 8817 (face font-lock-string-face) 8817 8849 (face font-lock-constant-face) 8849 8850 (face font-lock-string-face) 8850 8860 nil 8860 8861 (face font-lock-string-face) 8861 8892 (face font-lock-constant-face) 8892 8893 (face font-lock-string-face) 8893 8903 nil 8903 8904 (face font-lock-string-face) 8904 8934 (face font-lock-constant-face) 8934 8935 (face font-lock-string-face) 8935 8945 nil 8945 8946 (face font-lock-string-face) 8946 8978 (face font-lock-constant-face) 8978 8979 (face font-lock-string-face) 8979 8989 nil 8989 8990 (face font-lock-string-face) 8990 9021 (face font-lock-constant-face) 9021 9022 (face font-lock-string-face) 9022 9032 nil 9032 9033 (face font-lock-string-face) 9033 9063 (face font-lock-constant-face) 9063 9064 (face font-lock-string-face) 9064 9074 nil 9074 9075 (face font-lock-string-face) 9075 9104 (face font-lock-constant-face) 9104 9105 (face font-lock-string-face) 9105 9115 nil 9115 9116 (face font-lock-string-face) 9116 9158 (face font-lock-constant-face) 9158 9159 (face font-lock-string-face) 9159 9169 nil 9169 9170 (face font-lock-string-face) 9170 9211 (face font-lock-constant-face) 9211 9212 (face font-lock-string-face) 9212 9222 nil 9222 9223 (face font-lock-string-face) 9223 9272 (face font-lock-constant-face) 9272 9273 (face font-lock-string-face) 9273 9283 nil 9283 9284 (face font-lock-string-face) 9284 9332 (face font-lock-constant-face) 9332 9333 (face font-lock-string-face) 9333 9343 nil 9343 9344 (face font-lock-string-face) 9344 9388 (face font-lock-constant-face) 9388 9389 (face font-lock-string-face) 9389 9399 nil 9399 9400 (face font-lock-string-face) 9400 9445 (face font-lock-constant-face) 9445 9446 (face font-lock-string-face) 9446 9456 nil 9456 9457 (face font-lock-string-face) 9457 9507 (face font-lock-constant-face) 9507 9508 (face font-lock-string-face) 9508 9518 nil 9518 9519 (face font-lock-string-face) 9519 9570 (face font-lock-constant-face) 9570 9571 (face font-lock-string-face) 9571 9581 nil 9581 9582 (face font-lock-string-face) 9582 9611 (face font-lock-constant-face) 9611 9612 (face font-lock-string-face) 9612 9622 nil 9622 9623 (face font-lock-string-face) 9623 9659 (face font-lock-constant-face) 9659 9660 (face font-lock-string-face) 9660 9670 nil 9670 9671 (face font-lock-string-face) 9671 9714 (face font-lock-constant-face) 9714 9715 (face font-lock-string-face) 9715 9725 nil 9725 9726 (face font-lock-string-face) 9726 9768 (face font-lock-constant-face) 9768 9769 (face font-lock-string-face) 9769 9779 nil 9779 9780 (face font-lock-string-face) 9780 9816 (face font-lock-constant-face) 9816 9817 (face font-lock-string-face) 9817 9827 nil 9827 9828 (face font-lock-string-face) 9828 9863 (face font-lock-constant-face) 9863 9864 (face font-lock-string-face) 9864 9874 nil 9874 9875 (face font-lock-string-face) 9875 9910 (face font-lock-constant-face) 9910 9911 (face font-lock-string-face) 9911 9921 nil 9921 9922 (face font-lock-string-face) 9922 9958 (face font-lock-constant-face) 9958 9959 (face font-lock-string-face) 9959 9969 nil 9969 9970 (face font-lock-string-face) 9970 10005 (face font-lock-constant-face) 10005 10006 (face font-lock-string-face) 10006 10016 nil 10016 10017 (face font-lock-string-face) 10017 10050 (face font-lock-constant-face) 10050 10051 (face font-lock-string-face) 10051 10061 nil 10061 10062 (face font-lock-string-face) 10062 10094 (face font-lock-constant-face) 10094 10095 (face font-lock-string-face) 10095 10105 nil 10105 10106 (face font-lock-string-face) 10106 10150 (face font-lock-constant-face) 10150 10151 (face font-lock-string-face) 10151 10161 nil 10161 10162 (face font-lock-string-face) 10162 10198 (face font-lock-constant-face) 10198 10199 (face font-lock-string-face) 10199 10209 nil 10209 10210 (face font-lock-string-face) 10210 10245 (face font-lock-constant-face) 10245 10246 (face font-lock-string-face) 10246 10256 nil 10256 10257 (face font-lock-string-face) 10257 10296 (face font-lock-constant-face) 10296 10297 (face font-lock-string-face) 10297 10307 nil 10307 10308 (face font-lock-string-face) 10308 10346 (face font-lock-constant-face) 10346 10347 (face font-lock-string-face) 10347 10357 nil 10357 10358 (face font-lock-string-face) 10358 10403 (face font-lock-constant-face) 10403 10404 (face font-lock-string-face) 10404 10414 nil 10414 10415 (face font-lock-string-face) 10415 10459 (face font-lock-constant-face) 10459 10460 (face font-lock-string-face) 10460 10470 nil 10470 10471 (face font-lock-string-face) 10471 10487 (face font-lock-constant-face) 10487 10488 (face font-lock-string-face) 10488 10498 nil 10498 10499 (face font-lock-string-face) 10499 10514 (face font-lock-constant-face) 10514 10515 (face font-lock-string-face) 10515 10525 nil 10525 10526 (face font-lock-string-face) 10526 10559 (face font-lock-constant-face) 10559 10560 (face font-lock-string-face) 10560 10570 nil 10570 10571 (face font-lock-string-face) 10571 10603 (face font-lock-constant-face) 10603 10604 (face font-lock-string-face) 10604 10614 nil 10614 10615 (face font-lock-string-face) 10615 10636 (face font-lock-constant-face) 10636 10637 (face font-lock-string-face) 10637 10647 nil 10647 10648 (face font-lock-string-face) 10648 10675 (face font-lock-constant-face) 10675 10676 (face font-lock-string-face) 10676 10686 nil 10686 10687 (face font-lock-string-face) 10687 10713 (face font-lock-constant-face) 10713 10714 (face font-lock-string-face) 10714 10724 nil 10724 10725 (face font-lock-string-face) 10725 10755 (face font-lock-constant-face) 10755 10756 (face font-lock-string-face) 10756 10766 nil 10766 10767 (face font-lock-string-face) 10767 10796 (face font-lock-constant-face) 10796 10797 (face font-lock-string-face) 10797 10807 nil 10807 10808 (face font-lock-string-face) 10808 10845 (face font-lock-constant-face) 10845 10846 (face font-lock-string-face) 10846 10856 nil 10856 10857 (face font-lock-string-face) 10857 10893 (face font-lock-constant-face) 10893 10894 (face font-lock-string-face) 10894 10904 nil 10904 10905 (face font-lock-string-face) 10905 10929 (face font-lock-constant-face) 10929 10930 (face font-lock-string-face) 10930 10940 nil 10940 10941 (face font-lock-string-face) 10941 10964 (face font-lock-constant-face) 10964 10965 (face font-lock-string-face) 10965 10975 nil 10975 10976 (face font-lock-string-face) 10976 10995 (face font-lock-constant-face) 10995 10996 (face font-lock-string-face) 10996 11006 nil 11006 11007 (face font-lock-string-face) 11007 11025 (face font-lock-constant-face) 11025 11026 (face font-lock-string-face) 11026 11036 nil 11036 11037 (face font-lock-string-face) 11037 11063 (face font-lock-constant-face) 11063 11064 (face font-lock-string-face) 11064 11074 nil 11074 11075 (face font-lock-string-face) 11075 11100 (face font-lock-constant-face) 11100 11101 (face font-lock-string-face) 11101 11111 nil 11111 11112 (face font-lock-string-face) 11112 11138 (face font-lock-constant-face) 11138 11139 (face font-lock-string-face) 11139 11149 nil 11149 11150 (face font-lock-string-face) 11150 11175 (face font-lock-constant-face) 11175 11176 (face font-lock-string-face) 11176 11193 nil 11193 11194 (face font-lock-string-face) 11194 11219 (face font-lock-keyword-face) 11219 11220 (face font-lock-string-face) 11220 11232 nil 11232 11233 (face font-lock-string-face) 11233 11245 (face font-lock-keyword-face) 11245 11246 (face font-lock-string-face) 11246 11260 nil 11260 11261 (face font-lock-string-face) 11261 11263 (face font-lock-constant-face) 11263 11264 (face font-lock-string-face) 11264 11292 nil 11292 11293 (face font-lock-string-face) 11293 11303 (face font-lock-keyword-face) 11303 11304 (face font-lock-string-face) 11304 11316 nil 11316 11381 (face font-lock-comment-face) 11381 11389 nil 11389 11439 (face font-lock-comment-face) 11439 11448 nil 11448 11449 (face font-lock-string-face) 11449 11464 (face font-lock-variable-name-face) 11464 11465 (face font-lock-string-face) 11465 11479 nil 11479 11480 (face font-lock-string-face) 11480 11492 (face font-lock-keyword-face) 11492 11493 (face font-lock-string-face) 11493 11509 nil 11509 11510 (face font-lock-string-face) 11510 11549 (face font-lock-function-name-face) 11549 11550 (face font-lock-string-face) 11550 11586 nil 11586 11587 (face font-lock-string-face) 11587 11602 (face font-lock-variable-name-face) 11602 11603 (face font-lock-string-face) 11603 11617 nil 11617 11618 (face font-lock-string-face) 11618 11626 (face font-lock-keyword-face) 11626 11627 (face font-lock-string-face) 11627 11643 nil 11643 11644 (face font-lock-string-face) 11644 11663 (face font-lock-constant-face) 11663 11664 (face font-lock-string-face) 11664 11678 nil 11678 11679 (face font-lock-string-face) 11679 11702 (face font-lock-constant-face) 11702 11703 (face font-lock-string-face) 11703 11717 nil 11717 11718 (face font-lock-string-face) 11718 11740 (face font-lock-constant-face) 11740 11741 (face font-lock-string-face) 11741 11755 nil 11755 11756 (face font-lock-string-face) 11756 11779 (face font-lock-constant-face) 11779 11780 (face font-lock-string-face) 11780 11794 nil 11794 11795 (face font-lock-string-face) 11795 11817 (face font-lock-constant-face) 11817 11818 (face font-lock-string-face) 11818 11832 nil 11832 11833 (face font-lock-string-face) 11833 11861 (face font-lock-constant-face) 11861 11862 (face font-lock-string-face) 11862 11876 nil 11876 11877 (face font-lock-string-face) 11877 11904 (face font-lock-constant-face) 11904 11905 (face font-lock-string-face) 11905 11919 nil 11919 11920 (face font-lock-string-face) 11920 11950 (face font-lock-constant-face) 11950 11951 (face font-lock-string-face) 11951 11965 nil 11965 11966 (face font-lock-string-face) 11966 11995 (face font-lock-constant-face) 11995 11996 (face font-lock-string-face) 11996 12010 nil 12010 12011 (face font-lock-string-face) 12011 12035 (face font-lock-constant-face) 12035 12036 (face font-lock-string-face) 12036 12050 nil 12050 12051 (face font-lock-string-face) 12051 12074 (face font-lock-constant-face) 12074 12075 (face font-lock-string-face) 12075 12089 nil 12089 12090 (face font-lock-string-face) 12090 12120 (face font-lock-constant-face) 12120 12121 (face font-lock-string-face) 12121 12135 nil 12135 12136 (face font-lock-string-face) 12136 12167 (face font-lock-constant-face) 12167 12168 (face font-lock-string-face) 12168 12182 nil 12182 12183 (face font-lock-string-face) 12183 12213 (face font-lock-constant-face) 12213 12214 (face font-lock-string-face) 12214 12228 nil 12228 12229 (face font-lock-string-face) 12229 12254 (face font-lock-constant-face) 12254 12255 (face font-lock-string-face) 12255 12269 nil 12269 12270 (face font-lock-string-face) 12270 12294 (face font-lock-constant-face) 12294 12295 (face font-lock-string-face) 12295 12309 nil 12309 12310 (face font-lock-string-face) 12310 12352 (face font-lock-constant-face) 12352 12353 (face font-lock-string-face) 12353 12367 nil 12367 12368 (face font-lock-string-face) 12368 12409 (face font-lock-constant-face) 12409 12410 (face font-lock-string-face) 12410 12424 nil 12424 12425 (face font-lock-string-face) 12425 12447 (face font-lock-constant-face) 12447 12448 (face font-lock-string-face) 12448 12462 nil 12462 12463 (face font-lock-string-face) 12463 12484 (face font-lock-constant-face) 12484 12485 (face font-lock-string-face) 12485 12499 nil 12499 12500 (face font-lock-string-face) 12500 12531 (face font-lock-constant-face) 12531 12532 (face font-lock-string-face) 12532 12546 nil 12546 12547 (face font-lock-string-face) 12547 12577 (face font-lock-constant-face) 12577 12578 (face font-lock-string-face) 12578 12592 nil 12592 12593 (face font-lock-string-face) 12593 12621 (face font-lock-constant-face) 12621 12622 (face font-lock-string-face) 12622 12636 nil 12636 12637 (face font-lock-string-face) 12637 12664 (face font-lock-constant-face) 12664 12665 (face font-lock-string-face) 12665 12679 nil 12679 12680 (face font-lock-string-face) 12680 12707 (face font-lock-constant-face) 12707 12708 (face font-lock-string-face) 12708 12722 nil 12722 12723 (face font-lock-string-face) 12723 12749 (face font-lock-constant-face) 12749 12750 (face font-lock-string-face) 12750 12764 nil 12764 12765 (face font-lock-string-face) 12765 12791 (face font-lock-constant-face) 12791 12792 (face font-lock-string-face) 12792 12806 nil 12806 12807 (face font-lock-string-face) 12807 12832 (face font-lock-constant-face) 12832 12833 (face font-lock-string-face) 12833 12868 nil 12868 12937 (face font-lock-comment-face) 12937 12945 nil 12945 13016 (face font-lock-comment-face) 13016 13024 nil 13024 13040 (face font-lock-comment-face) 13040 13049 nil 13049 13050 (face font-lock-string-face) 13050 13065 (face font-lock-variable-name-face) 13065 13066 (face font-lock-string-face) 13066 13080 nil 13080 13081 (face font-lock-string-face) 13081 13089 (face font-lock-keyword-face) 13089 13090 (face font-lock-string-face) 13090 13105 nil 13105 13106 (face font-lock-string-face) 13106 13149 (face font-lock-constant-face) 13149 13150 (face font-lock-string-face) 13150 13175 nil 13175 13176 (face font-lock-string-face) 13176 13183 (face font-lock-keyword-face) 13183 13184 (face font-lock-string-face) 13184 13199 nil 13199 13200 (face font-lock-string-face) 13200 13248 (face font-lock-constant-face) 13248 13249 (face font-lock-string-face) 13249 13274 nil 13274 13275 (face font-lock-string-face) 13275 13288 (face font-lock-keyword-face) 13288 13289 (face font-lock-string-face) 13289 13305 nil 13305 13306 (face font-lock-string-face) 13306 13315 (face font-lock-keyword-face) 13315 13316 (face font-lock-string-face) 13316 13334 nil 13334 13335 (face font-lock-string-face) 13335 13345 (face font-lock-constant-face) 13345 13346 (face font-lock-string-face) 13346 13397 nil 13397 13398 (face font-lock-string-face) 13398 13443 (face font-lock-variable-name-face) 13443 13444 (face font-lock-string-face) 13444 13458 nil 13458 13459 (face font-lock-string-face) 13459 13472 (face font-lock-keyword-face) 13472 13473 (face font-lock-string-face) 13473 13489 nil 13489 13490 (face font-lock-string-face) 13490 13499 (face font-lock-keyword-face) 13499 13500 (face font-lock-string-face) 13500 13518 nil 13518 13519 (face font-lock-string-face) 13519 13527 (face font-lock-constant-face) 13527 13528 (face font-lock-string-face) 13528 13579 nil 13579 13580 (face font-lock-string-face) 13580 13593 (face font-lock-variable-name-face) 13593 13594 (face font-lock-string-face) 13594 13608 nil 13608 13609 (face font-lock-string-face) 13609 13617 (face font-lock-keyword-face) 13617 13618 (face font-lock-string-face) 13618 13623 nil 13623 13624 (face font-lock-string-face) 13624 13631 (face font-lock-constant-face) 13631 13632 (face font-lock-string-face) 13632 13634 nil 13634 13635 (face font-lock-string-face) 13635 13641 (face font-lock-constant-face) 13641 13642 (face font-lock-string-face) 13642 13671 nil 13671 13672 (face font-lock-string-face) 13672 13679 (face font-lock-constant-face) 13679 13680 (face font-lock-string-face) 13680 13682 nil 13682 13683 (face font-lock-string-face) 13683 13703 (face font-lock-constant-face) 13703 13704 (face font-lock-string-face) 13704 13720 nil 13720 13721 (face font-lock-string-face) 13721 13734 (face font-lock-keyword-face) 13734 13735 (face font-lock-string-face) 13735 13751 nil 13751 13752 (face font-lock-string-face) 13752 13761 (face font-lock-keyword-face) 13761 13762 (face font-lock-string-face) 13762 13815 nil 13815 13816 (face font-lock-string-face) 13816 13829 (face font-lock-variable-name-face) 13829 13830 (face font-lock-string-face) 13830 13844 nil 13844 13845 (face font-lock-string-face) 13845 13853 (face font-lock-keyword-face) 13853 13854 (face font-lock-string-face) 13854 13870 nil 13870 13871 (face font-lock-string-face) 13871 13909 (face font-lock-constant-face) 13909 13910 (face font-lock-string-face) 13910 13924 nil 13924 13925 (face font-lock-string-face) 13925 13962 (face font-lock-constant-face) 13962 13963 (face font-lock-string-face) 13963 13999 nil 13999 14000 (face font-lock-string-face) 14000 14011 (face font-lock-variable-name-face) 14011 14012 (face font-lock-string-face) 14012 14026 nil 14026 14027 (face font-lock-string-face) 14027 14036 (face font-lock-keyword-face) 14036 14037 (face font-lock-string-face) 14037 14053 nil 14053 14054 (face font-lock-string-face) 14054 14064 (face font-lock-keyword-face) 14064 14065 (face font-lock-string-face) 14065 14084 nil 14084 14085 (face font-lock-string-face) 14085 14096 (face font-lock-variable-name-face) 14096 14097 (face font-lock-string-face) 14097 14117 nil 14117 14129 (face font-lock-string-face) 14129 14131 nil 14131 14169 (face font-lock-string-face) 14169 14176 (face font-lock-variable-name-face) 14176 14182 (face font-lock-string-face) 14182 14193 (face font-lock-variable-name-face) 14193 14196 (face font-lock-string-face) 14196 14233 nil 14233 14245 (face font-lock-string-face) 14245 14247 nil 14247 14259 (face font-lock-string-face) 14259 14316 nil 14316 14317 (face font-lock-string-face) 14317 14327 (face font-lock-keyword-face) 14327 14328 (face font-lock-string-face) 14328 14345 nil 14345 14346 (face font-lock-string-face) 14346 14359 (face font-lock-variable-name-face) 14359 14360 (face font-lock-string-face) 14360 14378 nil 14378 14379 (face font-lock-string-face) 14379 14385 (face font-lock-keyword-face) 14385 14386 (face font-lock-string-face) 14386 14406 nil 14406 14411 (face font-lock-string-face) 14411 14413 (face font-lock-variable-name-face) 14413 14423 (face font-lock-variable-name-face) 14423 14443 (face font-lock-string-face) 14443 14476 nil 14476 14477 (face font-lock-string-face) 14477 14490 (face font-lock-keyword-face) 14490 14491 (face font-lock-string-face) 14491 14511 nil 14511 14512 (face font-lock-string-face) 14512 14521 (face font-lock-keyword-face) 14521 14522 (face font-lock-string-face) 14522 14544 nil 14544 14545 (face font-lock-string-face) 14545 14549 (face font-lock-constant-face) 14549 14551 (face font-lock-variable-name-face) 14551 14561 (face font-lock-variable-name-face) 14561 14578 (face font-lock-constant-face) 14578 14579 (face font-lock-string-face) 14579 14631 nil 14631 14632 (face font-lock-string-face) 14632 14639 (face font-lock-keyword-face) 14639 14640 (face font-lock-string-face) 14640 14660 nil 14660 14661 (face font-lock-string-face) 14661 14669 (face font-lock-preprocessor-face) 14669 14670 (face font-lock-string-face) 14670 14707 nil 14707 14729 (face font-lock-comment-face) 14729 14743 nil 14743 14744 (face font-lock-string-face) 14744 14752 (face font-lock-keyword-face) 14752 14753 (face font-lock-string-face) 14753 14773 nil 14773 14774 (face font-lock-string-face) 14774 14800 (face font-lock-constant-face) 14800 14801 (face font-lock-string-face) 14801 14819 nil 14819 14820 (face font-lock-string-face) 14820 14845 (face font-lock-constant-face) 14845 14846 (face font-lock-string-face) 14846 14915 nil 14915 14916 (face font-lock-string-face) 14916 14929 (face font-lock-variable-name-face) 14929 14930 (face font-lock-string-face) 14930 14944 nil 14944 14945 (face font-lock-string-face) 14945 14955 (face font-lock-keyword-face) 14955 14956 (face font-lock-string-face) 14956 14973 nil 14973 14974 (face font-lock-string-face) 14974 14993 (face font-lock-variable-name-face) 14993 14994 (face font-lock-string-face) 14994 15012 nil 15012 15013 (face font-lock-string-face) 15013 15019 (face font-lock-keyword-face) 15019 15020 (face font-lock-string-face) 15020 15040 nil 15040 15075 (face font-lock-string-face) 15075 15108 nil 15108 15109 (face font-lock-string-face) 15109 15122 (face font-lock-keyword-face) 15122 15123 (face font-lock-string-face) 15123 15143 nil 15143 15144 (face font-lock-string-face) 15144 15153 (face font-lock-keyword-face) 15153 15154 (face font-lock-string-face) 15154 15176 nil 15176 15177 (face font-lock-string-face) 15177 15215 (face font-lock-constant-face) 15215 15216 (face font-lock-string-face) 15216 15268 nil 15268 15269 (face font-lock-string-face) 15269 15276 (face font-lock-keyword-face) 15276 15277 (face font-lock-string-face) 15277 15297 nil 15297 15298 (face font-lock-string-face) 15298 15312 (face font-lock-preprocessor-face) 15312 15313 (face font-lock-string-face) 15313 15350 nil 15350 15378 (face font-lock-comment-face) 15378 15392 nil 15392 15393 (face font-lock-string-face) 15393 15401 (face font-lock-keyword-face) 15401 15402 (face font-lock-string-face) 15402 15422 nil 15422 15423 (face font-lock-string-face) 15423 15450 (face font-lock-constant-face) 15450 15451 (face font-lock-string-face) 15451 15469 nil 15469 15470 (face font-lock-string-face) 15470 15496 (face font-lock-constant-face) 15496 15497 (face font-lock-string-face) 15497 15566 nil 15566 15567 (face font-lock-string-face) 15567 15600 (face font-lock-variable-name-face) 15600 15601 (face font-lock-string-face) 15601 15615 nil 15615 15663 (face font-lock-comment-face) 15663 15673 nil 15673 15674 (face font-lock-string-face) 15674 15682 (face font-lock-keyword-face) 15682 15683 (face font-lock-string-face) 15683 15699 nil 15699 15700 (face font-lock-string-face) 15700 15743 (face font-lock-constant-face) 15743 15744 (face font-lock-string-face) 15744 15758 nil 15758 15759 (face font-lock-string-face) 15759 15801 (face font-lock-constant-face) 15801 15802 (face font-lock-string-face) 15802 15838 nil 15838 15839 (face font-lock-string-face) 15839 15848 (face font-lock-variable-name-face) 15848 15849 (face font-lock-string-face) 15849 15863 nil 15863 15864 (face font-lock-string-face) 15864 15877 (face font-lock-keyword-face) 15877 15878 (face font-lock-string-face) 15878 15894 nil 15894 15895 (face font-lock-string-face) 15895 15904 (face font-lock-keyword-face) 15904 15905 (face font-lock-string-face) 15905 15923 nil 15923 15924 (face font-lock-string-face) 15924 15980 (face font-lock-constant-face) 15980 15981 (face font-lock-string-face) 15981 15997 nil 15997 15998 (face font-lock-string-face) 15998 16057 (face font-lock-constant-face) 16057 16058 (face font-lock-string-face) 16058 16074 nil 16074 16075 (face font-lock-string-face) 16075 16131 (face font-lock-constant-face) 16131 16132 (face font-lock-string-face) 16132 16148 nil 16148 16149 (face font-lock-string-face) 16149 16205 (face font-lock-constant-face) 16205 16206 (face font-lock-string-face) 16206 16222 nil 16222 16223 (face font-lock-string-face) 16223 16275 (face font-lock-constant-face) 16275 16276 (face font-lock-string-face) 16276 16327 nil 16327 16328 (face font-lock-string-face) 16328 16337 (face font-lock-variable-name-face) 16337 16338 (face font-lock-string-face) 16338 16352 nil 16352 16353 (face font-lock-string-face) 16353 16361 (face font-lock-keyword-face) 16361 16362 (face font-lock-string-face) 16362 16378 nil 16378 16379 (face font-lock-string-face) 16379 16406 (face font-lock-constant-face) 16406 16407 (face font-lock-string-face) 16407 16421 nil 16421 16422 (face font-lock-string-face) 16422 16448 (face font-lock-constant-face) 16448 16449 (face font-lock-string-face) 16449 16463 nil 16463 16464 (face font-lock-string-face) 16464 16507 (face font-lock-constant-face) 16507 16508 (face font-lock-string-face) 16508 16522 nil 16522 16523 (face font-lock-string-face) 16523 16565 (face font-lock-constant-face) 16565 16566 (face font-lock-string-face) 16566 16602 nil 16602 16603 (face font-lock-string-face) 16603 16646 (face font-lock-variable-name-face) 16646 16647 (face font-lock-string-face) 16647 16661 nil 16661 16662 (face font-lock-string-face) 16662 16669 (face font-lock-keyword-face) 16669 16670 (face font-lock-string-face) 16670 16686 nil 16686 16687 (face font-lock-string-face) 16687 16697 (face font-lock-constant-face) 16697 16698 (face font-lock-string-face) 16698 16712 nil 16712 16713 (face font-lock-string-face) 16713 16722 (face font-lock-constant-face) 16722 16723 (face font-lock-string-face) 16723 16737 nil 16737 16738 (face font-lock-string-face) 16738 16760 (face font-lock-constant-face) 16760 16761 (face font-lock-string-face) 16761 16775 nil 16775 16776 (face font-lock-string-face) 16776 16797 (face font-lock-constant-face) 16797 16798 (face font-lock-string-face) 16798 16812 nil 16812 16813 (face font-lock-string-face) 16813 16830 (face font-lock-constant-face) 16830 16831 (face font-lock-string-face) 16831 16845 nil 16845 16846 (face font-lock-string-face) 16846 16862 (face font-lock-constant-face) 16862 16863 (face font-lock-string-face) 16863 16877 nil 16877 16878 (face font-lock-string-face) 16878 16889 (face font-lock-constant-face) 16889 16890 (face font-lock-string-face) 16890 16904 nil 16904 16905 (face font-lock-string-face) 16905 16915 (face font-lock-constant-face) 16915 16916 (face font-lock-string-face) 16916 16930 nil 16930 16931 (face font-lock-string-face) 16931 16955 (face font-lock-constant-face) 16955 16956 (face font-lock-string-face) 16956 16970 nil 16970 16971 (face font-lock-string-face) 16971 16994 (face font-lock-constant-face) 16994 16995 (face font-lock-string-face) 16995 17009 nil 17009 17010 (face font-lock-string-face) 17010 17034 (face font-lock-constant-face) 17034 17035 (face font-lock-string-face) 17035 17049 nil 17049 17050 (face font-lock-string-face) 17050 17073 (face font-lock-constant-face) 17073 17074 (face font-lock-string-face) 17074 17088 nil 17088 17089 (face font-lock-string-face) 17089 17114 (face font-lock-constant-face) 17114 17115 (face font-lock-string-face) 17115 17129 nil 17129 17130 (face font-lock-string-face) 17130 17154 (face font-lock-constant-face) 17154 17155 (face font-lock-string-face) 17155 17210 nil 17210 17211 (face font-lock-string-face) 17211 17222 (face font-lock-keyword-face) 17222 17223 (face font-lock-string-face) 17223 17225 nil 17225 17226 (face font-lock-string-face) 17226 17237 (face font-lock-function-name-face) 17237 17238 (face font-lock-string-face) 17238 17246 nil 17246 17247 (face font-lock-string-face) 17247 17251 (face font-lock-keyword-face) 17251 17252 (face font-lock-string-face) 17252 17254 nil 17254 17255 (face font-lock-string-face) 17255 17269 (face font-lock-type-face) 17269 17270 (face font-lock-string-face) 17270 17278 nil 17278 17279 (face font-lock-string-face) 17279 17291 (face font-lock-keyword-face) 17291 17292 (face font-lock-string-face) 17292 17304 nil 17304 17305 (face font-lock-string-face) 17305 17307 (face font-lock-constant-face) 17307 17308 (face font-lock-string-face) 17308 17325 nil 17325 17326 (face font-lock-string-face) 17326 17336 (face font-lock-keyword-face) 17336 17337 (face font-lock-string-face) 17337 17350 nil 17350 17351 (face font-lock-string-face) 17351 17371 (face font-lock-variable-name-face) 17371 17372 (face font-lock-string-face) 17372 17386 nil 17386 17387 (face font-lock-string-face) 17387 17404 (face font-lock-keyword-face) 17404 17405 (face font-lock-string-face) 17405 17423 nil 17423 17424 (face font-lock-string-face) 17424 17442 (face font-lock-variable-name-face) 17442 17443 (face font-lock-string-face) 17443 17461 nil 17461 17462 (face font-lock-string-face) 17462 17469 (face font-lock-keyword-face) 17469 17470 (face font-lock-string-face) 17470 17474 nil 17474 17498 (face font-lock-string-face) 17498 17553 nil 17553 17554 (face font-lock-string-face) 17554 17599 (face font-lock-variable-name-face) 17599 17600 (face font-lock-string-face) 17600 17614 nil 17614 17615 (face font-lock-string-face) 17615 17627 (face font-lock-keyword-face) 17627 17628 (face font-lock-string-face) 17628 17644 nil 17644 17645 (face font-lock-string-face) 17645 17665 (face font-lock-function-name-face) 17665 17666 (face font-lock-string-face) 17666 17703 nil 17703 17704 (face font-lock-string-face) 17704 17724 (face font-lock-variable-name-face) 17724 17725 (face font-lock-string-face) 17725 17739 nil 17739 17740 (face font-lock-string-face) 17740 17752 (face font-lock-keyword-face) 17752 17753 (face font-lock-string-face) 17753 17769 nil 17769 17770 (face font-lock-string-face) 17770 17790 (face font-lock-function-name-face) 17790 17791 (face font-lock-string-face) 17791 17833 nil 17833 17834 (face font-lock-string-face) 17834 17841 (face font-lock-keyword-face) 17841 17842 (face font-lock-string-face) 17842 17854 nil 17854 17855 (face font-lock-string-face) 17855 17874 (face font-lock-constant-face) 17874 17875 (face font-lock-string-face) 17875 17885 nil 17885 17886 (face font-lock-string-face) 17886 17904 (face font-lock-constant-face) 17904 17905 (face font-lock-string-face) 17905 17935 nil 17935 17936 (face font-lock-string-face) 17936 17947 (face font-lock-keyword-face) 17947 17948 (face font-lock-string-face) 17948 17950 nil 17950 17951 (face font-lock-string-face) 17951 17971 (face font-lock-function-name-face) 17971 17972 (face font-lock-string-face) 17972 17980 nil 17980 17981 (face font-lock-string-face) 17981 17985 (face font-lock-keyword-face) 17985 17986 (face font-lock-string-face) 17986 17988 nil 17988 17989 (face font-lock-string-face) 17989 18003 (face font-lock-type-face) 18003 18004 (face font-lock-string-face) 18004 18012 nil 18012 18013 (face font-lock-string-face) 18013 18025 (face font-lock-keyword-face) 18025 18026 (face font-lock-string-face) 18026 18038 nil 18038 18039 (face font-lock-string-face) 18039 18041 (face font-lock-constant-face) 18041 18042 (face font-lock-string-face) 18042 18059 nil 18059 18060 (face font-lock-string-face) 18060 18067 (face font-lock-keyword-face) 18067 18068 (face font-lock-string-face) 18068 18080 nil 18080 18081 (face font-lock-string-face) 18081 18114 (face font-lock-constant-face) 18114 18115 (face font-lock-string-face) 18115 18125 nil 18125 18126 (face font-lock-string-face) 18126 18162 (face font-lock-constant-face) 18162 18163 (face font-lock-string-face) 18163 18173 nil 18173 18174 (face font-lock-string-face) 18174 18212 (face font-lock-constant-face) 18212 18213 (face font-lock-string-face) 18213 18223 nil 18223 18224 (face font-lock-string-face) 18224 18261 (face font-lock-constant-face) 18261 18262 (face font-lock-string-face) 18262 18272 nil 18272 18273 (face font-lock-string-face) 18273 18311 (face font-lock-constant-face) 18311 18312 (face font-lock-string-face) 18312 18322 nil 18322 18323 (face font-lock-string-face) 18323 18356 (face font-lock-constant-face) 18356 18357 (face font-lock-string-face) 18357 18367 nil 18367 18368 (face font-lock-string-face) 18368 18403 (face font-lock-constant-face) 18403 18404 (face font-lock-string-face) 18404 18414 nil 18414 18415 (face font-lock-string-face) 18415 18451 (face font-lock-constant-face) 18451 18452 (face font-lock-string-face) 18452 18462 nil 18462 18463 (face font-lock-string-face) 18463 18499 (face font-lock-constant-face) 18499 18500 (face font-lock-string-face) 18500 18510 nil 18510 18511 (face font-lock-string-face) 18511 18547 (face font-lock-constant-face) 18547 18548 (face font-lock-string-face) 18548 18558 nil 18558 18559 (face font-lock-string-face) 18559 18581 (face font-lock-constant-face) 18581 18582 (face font-lock-string-face) 18582 18592 nil 18592 18593 (face font-lock-string-face) 18593 18618 (face font-lock-constant-face) 18618 18619 (face font-lock-string-face) 18619 18629 nil 18629 18630 (face font-lock-string-face) 18630 18657 (face font-lock-constant-face) 18657 18658 (face font-lock-string-face) 18658 18668 nil 18668 18669 (face font-lock-string-face) 18669 18697 (face font-lock-constant-face) 18697 18698 (face font-lock-string-face) 18698 18708 nil 18708 18709 (face font-lock-string-face) 18709 18750 (face font-lock-constant-face) 18750 18751 (face font-lock-string-face) 18751 18761 nil 18761 18762 (face font-lock-string-face) 18762 18803 (face font-lock-constant-face) 18803 18804 (face font-lock-string-face) 18804 18814 nil 18814 18815 (face font-lock-string-face) 18815 18856 (face font-lock-constant-face) 18856 18857 (face font-lock-string-face) 18857 18867 nil 18867 18868 (face font-lock-string-face) 18868 18902 (face font-lock-constant-face) 18902 18903 (face font-lock-string-face) 18903 18913 nil 18913 18914 (face font-lock-string-face) 18914 18948 (face font-lock-constant-face) 18948 18949 (face font-lock-string-face) 18949 18959 nil 18959 18960 (face font-lock-string-face) 18960 18994 (face font-lock-constant-face) 18994 18995 (face font-lock-string-face) 18995 19005 nil 19005 19006 (face font-lock-string-face) 19006 19035 (face font-lock-constant-face) 19035 19036 (face font-lock-string-face) 19036 19046 nil 19046 19047 (face font-lock-string-face) 19047 19075 (face font-lock-constant-face) 19075 19076 (face font-lock-string-face) 19076 19093 nil 19093 19094 (face font-lock-string-face) 19094 19104 (face font-lock-keyword-face) 19104 19105 (face font-lock-string-face) 19105 19118 nil 19118 19119 (face font-lock-string-face) 19119 19139 (face font-lock-variable-name-face) 19139 19140 (face font-lock-string-face) 19140 19154 nil 19154 19155 (face font-lock-string-face) 19155 19172 (face font-lock-keyword-face) 19172 19173 (face font-lock-string-face) 19173 19191 nil 19191 19192 (face font-lock-string-face) 19192 19210 (face font-lock-variable-name-face) 19210 19211 (face font-lock-string-face) 19211 19229 nil 19229 19230 (face font-lock-string-face) 19230 19237 (face font-lock-keyword-face) 19237 19238 (face font-lock-string-face) 19238 19242 nil 19242 19266 (face font-lock-string-face) 19266 19321 nil 19321 19322 (face font-lock-string-face) 19322 19342 (face font-lock-variable-name-face) 19342 19343 (face font-lock-string-face) 19343 19357 nil 19357 19399 (face font-lock-comment-face) 19399 19409 nil 19409 19410 (face font-lock-string-face) 19410 19417 (face font-lock-keyword-face) 19417 19418 (face font-lock-string-face) 19418 19434 nil 19434 19435 (face font-lock-string-face) 19435 19480 (face font-lock-constant-face) 19480 19481 (face font-lock-string-face) 19481 19495 nil 19495 19496 (face font-lock-string-face) 19496 19535 (face font-lock-constant-face) 19535 19536 (face font-lock-string-face) 19536 19573 nil 19573 19574 (face font-lock-string-face) 19574 19623 (face font-lock-variable-name-face) 19623 19624 (face font-lock-string-face) 19624 19638 nil 19638 19639 (face font-lock-string-face) 19639 19645 (face font-lock-keyword-face) 19645 19646 (face font-lock-string-face) 19646 19662 nil 19662 19670 (face font-lock-string-face) 19670 19707 nil 19707 19708 (face font-lock-string-face) 19708 19719 (face font-lock-variable-name-face) 19719 19720 (face font-lock-string-face) 19720 19734 nil 19734 19735 (face font-lock-string-face) 19735 19749 (face font-lock-keyword-face) 19749 19750 (face font-lock-string-face) 19750 19766 nil 19766 19773 (face font-lock-string-face) 19773 19791 nil 19791 19792 (face font-lock-string-face) 19792 19806 (face font-lock-keyword-face) 19806 19807 (face font-lock-string-face) 19807 19827 nil 19827 19890 (face font-lock-comment-face) 19890 19906 nil 19906 19971 (face font-lock-comment-face) 19971 19987 nil 19987 20032 (face font-lock-comment-face) 20032 20048 nil 20048 20072 (face font-lock-string-face) 20072 20074 nil 20074 20077 (face font-lock-string-face) 20077 20080 nil 20080 20086 (face font-lock-comment-face) 20086 20155 nil 20155 20156 (face font-lock-string-face) 20156 20165 (face font-lock-variable-name-face) 20165 20166 (face font-lock-string-face) 20166 20180 nil 20180 20181 (face font-lock-string-face) 20181 20190 (face font-lock-keyword-face) 20190 20191 (face font-lock-string-face) 20191 20207 nil 20207 20208 (face font-lock-string-face) 20208 20218 (face font-lock-variable-name-face) 20218 20219 (face font-lock-string-face) 20219 20237 nil 20237 20246 (face font-lock-string-face) 20246 20262 nil 20262 20270 (face font-lock-string-face) 20270 20286 nil 20286 20298 (face font-lock-string-face) 20298 20314 nil 20314 20322 (face font-lock-string-face) 20322 20374 nil 20374 20375 (face font-lock-string-face) 20375 20384 (face font-lock-variable-name-face) 20384 20385 (face font-lock-string-face) 20385 20399 nil 20399 20400 (face font-lock-string-face) 20400 20409 (face font-lock-keyword-face) 20409 20410 (face font-lock-string-face) 20410 20426 nil 20426 20427 (face font-lock-string-face) 20427 20437 (face font-lock-variable-name-face) 20437 20438 (face font-lock-string-face) 20438 20456 nil 20456 20466 (face font-lock-string-face) 20466 20482 nil 20482 20491 (face font-lock-string-face) 20491 20507 nil 20507 20519 (face font-lock-string-face) 20519 20535 nil 20535 20543 (face font-lock-string-face) 20543 20595 nil 20595 20596 (face font-lock-string-face) 20596 20621 (face font-lock-variable-name-face) 20621 20622 (face font-lock-string-face) 20622 20636 nil 20636 20637 (face font-lock-string-face) 20637 20646 (face font-lock-keyword-face) 20646 20647 (face font-lock-string-face) 20647 20663 nil 20663 20664 (face font-lock-string-face) 20664 20674 (face font-lock-keyword-face) 20674 20675 (face font-lock-string-face) 20675 20695 nil 20695 20696 (face font-lock-string-face) 20696 20715 (face font-lock-variable-name-face) 20715 20716 (face font-lock-string-face) 20716 20736 nil 20736 20748 (face font-lock-string-face) 20748 20770 nil 20770 20780 (face font-lock-string-face) 20780 20800 nil 20800 20807 (face font-lock-string-face) 20807 20827 nil 20827 20839 (face font-lock-string-face) 20839 20859 nil 20859 20867 (face font-lock-string-face) 20867 20923 nil 20923 20935 (face font-lock-string-face) 20935 20957 nil 20957 20972 (face font-lock-string-face) 20972 20992 nil 20992 20999 (face font-lock-string-face) 20999 21019 nil 21019 21026 (face font-lock-string-face) 21026 21046 nil 21046 21058 (face font-lock-string-face) 21058 21078 nil 21078 21086 (face font-lock-string-face) 21086 21180 nil 21180 21181 (face font-lock-string-face) 21181 21190 (face font-lock-keyword-face) 21190 21191 (face font-lock-string-face) 21191 21203 nil 21203 21204 (face font-lock-string-face) 21204 21220 (face font-lock-variable-name-face) 21220 21221 (face font-lock-string-face) 21221 21223 nil 21223 21224 (face font-lock-string-face) 21224 21256 (face font-lock-variable-name-face) 21256 21257 (face font-lock-string-face) 21257 21274 nil 21274 21314 (face font-lock-string-face) 21314 21325 nil 21325 21326 (face font-lock-string-face) 21326 21334 (face font-lock-keyword-face) 21334 21335 (face font-lock-string-face) 21335 21347 nil 21347 21348 (face font-lock-string-face) 21348 21385 (face font-lock-constant-face) 21385 21386 (face font-lock-string-face) 21386 21416 nil 21416 21417 (face font-lock-string-face) 21417 21428 (face font-lock-keyword-face) 21428 21429 (face font-lock-string-face) 21429 21431 nil 21431 21432 (face font-lock-string-face) 21432 21452 (face font-lock-function-name-face) 21452 21453 (face font-lock-string-face) 21453 21461 nil 21461 21462 (face font-lock-string-face) 21462 21466 (face font-lock-keyword-face) 21466 21467 (face font-lock-string-face) 21467 21469 nil 21469 21470 (face font-lock-string-face) 21470 21484 (face font-lock-type-face) 21484 21485 (face font-lock-string-face) 21485 21493 nil 21493 21494 (face font-lock-string-face) 21494 21506 (face font-lock-keyword-face) 21506 21507 (face font-lock-string-face) 21507 21519 nil 21519 21520 (face font-lock-string-face) 21520 21522 (face font-lock-constant-face) 21522 21523 (face font-lock-string-face) 21523 21540 nil 21540 21541 (face font-lock-string-face) 21541 21548 (face font-lock-keyword-face) 21548 21549 (face font-lock-string-face) 21549 21561 nil 21561 21562 (face font-lock-string-face) 21562 21595 (face font-lock-constant-face) 21595 21596 (face font-lock-string-face) 21596 21606 nil 21606 21607 (face font-lock-string-face) 21607 21637 (face font-lock-constant-face) 21637 21638 (face font-lock-string-face) 21638 21648 nil 21648 21649 (face font-lock-string-face) 21649 21682 (face font-lock-constant-face) 21682 21683 (face font-lock-string-face) 21683 21693 nil 21693 21694 (face font-lock-string-face) 21694 21724 (face font-lock-constant-face) 21724 21725 (face font-lock-string-face) 21725 21735 nil 21735 21736 (face font-lock-string-face) 21736 21758 (face font-lock-constant-face) 21758 21759 (face font-lock-string-face) 21759 21769 nil 21769 21770 (face font-lock-string-face) 21770 21795 (face font-lock-constant-face) 21795 21796 (face font-lock-string-face) 21796 21806 nil 21806 21807 (face font-lock-string-face) 21807 21836 (face font-lock-constant-face) 21836 21837 (face font-lock-string-face) 21837 21847 nil 21847 21848 (face font-lock-string-face) 21848 21876 (face font-lock-constant-face) 21876 21877 (face font-lock-string-face) 21877 21907 nil 21907 21908 (face font-lock-string-face) 21908 21919 (face font-lock-keyword-face) 21919 21920 (face font-lock-string-face) 21920 21922 nil 21922 21923 (face font-lock-string-face) 21923 21938 (face font-lock-function-name-face) 21938 21939 (face font-lock-string-face) 21939 21947 nil 21947 21948 (face font-lock-string-face) 21948 21952 (face font-lock-keyword-face) 21952 21953 (face font-lock-string-face) 21953 21955 nil 21955 21956 (face font-lock-string-face) 21956 21966 (face font-lock-type-face) 21966 21967 (face font-lock-string-face) 21967 21975 nil 21975 21976 (face font-lock-string-face) 21976 21988 (face font-lock-keyword-face) 21988 21989 (face font-lock-string-face) 21989 22001 nil 22001 22002 (face font-lock-string-face) 22002 22007 (face font-lock-function-name-face) 22007 22008 (face font-lock-string-face) 22008 22018 nil 22018 22019 (face font-lock-string-face) 22019 22037 (face font-lock-function-name-face) 22037 22038 (face font-lock-string-face) 22038 22048 nil 22048 22049 (face font-lock-string-face) 22049 22060 (face font-lock-function-name-face) 22060 22061 (face font-lock-string-face) 22061 22071 nil 22071 22072 (face font-lock-string-face) 22072 22093 (face font-lock-function-name-face) 22093 22094 (face font-lock-string-face) 22094 22104 nil 22104 22105 (face font-lock-string-face) 22105 22131 (face font-lock-function-name-face) 22131 22132 (face font-lock-string-face) 22132 22142 nil 22142 22143 (face font-lock-string-face) 22143 22177 (face font-lock-function-name-face) 22177 22178 (face font-lock-string-face) 22178 22188 nil 22188 22189 (face font-lock-string-face) 22189 22215 (face font-lock-function-name-face) 22215 22216 (face font-lock-string-face) 22216 22226 nil 22226 22227 (face font-lock-string-face) 22227 22253 (face font-lock-function-name-face) 22253 22254 (face font-lock-string-face) 22254 22264 nil 22264 22265 (face font-lock-string-face) 22265 22280 (face font-lock-function-name-face) 22280 22281 (face font-lock-string-face) 22281 22298 nil 22298 22299 (face font-lock-string-face) 22299 22306 (face font-lock-keyword-face) 22306 22307 (face font-lock-string-face) 22307 22319 nil 22319 22320 (face font-lock-string-face) 22320 22361 (face font-lock-constant-face) 22361 22362 (face font-lock-string-face) 22362 22372 nil 22372 22373 (face font-lock-string-face) 22373 22413 (face font-lock-constant-face) 22413 22414 (face font-lock-string-face) 22414 22424 nil 22424 22425 (face font-lock-string-face) 22425 22461 (face font-lock-constant-face) 22461 22462 (face font-lock-string-face) 22462 22472 nil 22472 22473 (face font-lock-string-face) 22473 22502 (face font-lock-constant-face) 22502 22503 (face font-lock-string-face) 22503 22513 nil 22513 22514 (face font-lock-string-face) 22514 22550 (face font-lock-constant-face) 22550 22551 (face font-lock-string-face) 22551 22561 nil 22561 22562 (face font-lock-string-face) 22562 22610 (face font-lock-constant-face) 22610 22611 (face font-lock-string-face) 22611 22621 nil 22621 22622 (face font-lock-string-face) 22622 22663 (face font-lock-constant-face) 22663 22664 (face font-lock-string-face) 22664 22674 nil 22674 22675 (face font-lock-string-face) 22675 22711 (face font-lock-constant-face) 22711 22712 (face font-lock-string-face) 22712 22722 nil 22722 22723 (face font-lock-string-face) 22723 22757 (face font-lock-constant-face) 22757 22758 (face font-lock-string-face) 22758 22768 nil 22768 22769 (face font-lock-string-face) 22769 22797 (face font-lock-constant-face) 22797 22798 (face font-lock-string-face) 22798 22808 nil 22808 22809 (face font-lock-string-face) 22809 22853 (face font-lock-constant-face) 22853 22854 (face font-lock-string-face) 22854 22864 nil 22864 22865 (face font-lock-string-face) 22865 22900 (face font-lock-constant-face) 22900 22901 (face font-lock-string-face) 22901 22911 nil 22911 22912 (face font-lock-string-face) 22912 22961 (face font-lock-constant-face) 22961 22962 (face font-lock-string-face) 22962 22972 nil 22972 22973 (face font-lock-string-face) 22973 23011 (face font-lock-constant-face) 23011 23012 (face font-lock-string-face) 23012 23022 nil 23022 23023 (face font-lock-string-face) 23023 23055 (face font-lock-constant-face) 23055 23056 (face font-lock-string-face) 23056 23066 nil 23066 23067 (face font-lock-string-face) 23067 23116 (face font-lock-constant-face) 23116 23117 (face font-lock-string-face) 23117 23127 nil 23127 23128 (face font-lock-string-face) 23128 23178 (face font-lock-constant-face) 23178 23179 (face font-lock-string-face) 23179 23189 nil 23189 23190 (face font-lock-string-face) 23190 23228 (face font-lock-constant-face) 23228 23229 (face font-lock-string-face) 23229 23239 nil 23239 23240 (face font-lock-string-face) 23240 23277 (face font-lock-constant-face) 23277 23278 (face font-lock-string-face) 23278 23288 nil 23288 23289 (face font-lock-string-face) 23289 23332 (face font-lock-constant-face) 23332 23333 (face font-lock-string-face) 23333 23343 nil 23343 23344 (face font-lock-string-face) 23344 23368 (face font-lock-constant-face) 23368 23369 (face font-lock-string-face) 23369 23379 nil 23379 23380 (face font-lock-string-face) 23380 23402 (face font-lock-constant-face) 23402 23403 (face font-lock-string-face) 23403 23413 nil 23413 23414 (face font-lock-string-face) 23414 23447 (face font-lock-constant-face) 23447 23448 (face font-lock-string-face) 23448 23458 nil 23458 23459 (face font-lock-string-face) 23459 23487 (face font-lock-constant-face) 23487 23488 (face font-lock-string-face) 23488 23498 nil 23498 23499 (face font-lock-string-face) 23499 23530 (face font-lock-constant-face) 23530 23531 (face font-lock-string-face) 23531 23541 nil 23541 23542 (face font-lock-string-face) 23542 23563 (face font-lock-constant-face) 23563 23564 (face font-lock-string-face) 23564 23574 nil 23574 23575 (face font-lock-string-face) 23575 23609 (face font-lock-constant-face) 23609 23610 (face font-lock-string-face) 23610 23620 nil 23620 23621 (face font-lock-string-face) 23621 23654 (face font-lock-constant-face) 23654 23655 (face font-lock-string-face) 23655 23665 nil 23665 23666 (face font-lock-string-face) 23666 23700 (face font-lock-constant-face) 23700 23701 (face font-lock-string-face) 23701 23711 nil 23711 23712 (face font-lock-string-face) 23712 23753 (face font-lock-constant-face) 23753 23754 (face font-lock-string-face) 23754 23764 nil 23764 23765 (face font-lock-string-face) 23765 23790 (face font-lock-constant-face) 23790 23791 (face font-lock-string-face) 23791 23801 nil 23801 23802 (face font-lock-string-face) 23802 23825 (face font-lock-constant-face) 23825 23826 (face font-lock-string-face) 23826 23836 nil 23836 23837 (face font-lock-string-face) 23837 23862 (face font-lock-constant-face) 23862 23863 (face font-lock-string-face) 23863 23873 nil 23873 23874 (face font-lock-string-face) 23874 23906 (face font-lock-constant-face) 23906 23907 (face font-lock-string-face) 23907 23917 nil 23917 23918 (face font-lock-string-face) 23918 23947 (face font-lock-constant-face) 23947 23948 (face font-lock-string-face) 23948 23958 nil 23958 23959 (face font-lock-string-face) 23959 23981 (face font-lock-constant-face) 23981 23982 (face font-lock-string-face) 23982 23992 nil 23992 23993 (face font-lock-string-face) 23993 24014 (face font-lock-constant-face) 24014 24015 (face font-lock-string-face) 24015 24025 nil 24025 24026 (face font-lock-string-face) 24026 24054 (face font-lock-constant-face) 24054 24055 (face font-lock-string-face) 24055 24065 nil 24065 24066 (face font-lock-string-face) 24066 24093 (face font-lock-constant-face) 24093 24094 (face font-lock-string-face) 24094 24104 nil 24104 24105 (face font-lock-string-face) 24105 24133 (face font-lock-constant-face) 24133 24134 (face font-lock-string-face) 24134 24144 nil 24144 24145 (face font-lock-string-face) 24145 24177 (face font-lock-constant-face) 24177 24178 (face font-lock-string-face) 24178 24188 nil 24188 24189 (face font-lock-string-face) 24189 24221 (face font-lock-constant-face) 24221 24222 (face font-lock-string-face) 24222 24232 nil 24232 24233 (face font-lock-string-face) 24233 24277 (face font-lock-constant-face) 24277 24278 (face font-lock-string-face) 24278 24288 nil 24288 24289 (face font-lock-string-face) 24289 24328 (face font-lock-constant-face) 24328 24329 (face font-lock-string-face) 24329 24339 nil 24339 24340 (face font-lock-string-face) 24340 24379 (face font-lock-constant-face) 24379 24380 (face font-lock-string-face) 24380 24390 nil 24390 24391 (face font-lock-string-face) 24391 24424 (face font-lock-constant-face) 24424 24425 (face font-lock-string-face) 24425 24435 nil 24435 24436 (face font-lock-string-face) 24436 24476 (face font-lock-constant-face) 24476 24477 (face font-lock-string-face) 24477 24487 nil 24487 24488 (face font-lock-string-face) 24488 24521 (face font-lock-constant-face) 24521 24522 (face font-lock-string-face) 24522 24532 nil 24532 24533 (face font-lock-string-face) 24533 24567 (face font-lock-constant-face) 24567 24568 (face font-lock-string-face) 24568 24578 nil 24578 24579 (face font-lock-string-face) 24579 24610 (face font-lock-constant-face) 24610 24611 (face font-lock-string-face) 24611 24621 nil 24621 24622 (face font-lock-string-face) 24622 24673 (face font-lock-constant-face) 24673 24674 (face font-lock-string-face) 24674 24684 nil 24684 24685 (face font-lock-string-face) 24685 24725 (face font-lock-constant-face) 24725 24726 (face font-lock-string-face) 24726 24736 nil 24736 24737 (face font-lock-string-face) 24737 24773 (face font-lock-constant-face) 24773 24774 (face font-lock-string-face) 24774 24784 nil 24784 24785 (face font-lock-string-face) 24785 24821 (face font-lock-constant-face) 24821 24822 (face font-lock-string-face) 24822 24832 nil 24832 24833 (face font-lock-string-face) 24833 24874 (face font-lock-constant-face) 24874 24875 (face font-lock-string-face) 24875 24885 nil 24885 24886 (face font-lock-string-face) 24886 24926 (face font-lock-constant-face) 24926 24927 (face font-lock-string-face) 24927 24937 nil 24937 24938 (face font-lock-string-face) 24938 24977 (face font-lock-constant-face) 24977 24978 (face font-lock-string-face) 24978 24988 nil 24988 24989 (face font-lock-string-face) 24989 25035 (face font-lock-constant-face) 25035 25036 (face font-lock-string-face) 25036 25046 nil 25046 25047 (face font-lock-string-face) 25047 25070 (face font-lock-constant-face) 25070 25071 (face font-lock-string-face) 25071 25081 nil 25081 25082 (face font-lock-string-face) 25082 25104 (face font-lock-constant-face) 25104 25105 (face font-lock-string-face) 25105 25115 nil 25115 25116 (face font-lock-string-face) 25116 25152 (face font-lock-constant-face) 25152 25153 (face font-lock-string-face) 25153 25163 nil 25163 25164 (face font-lock-string-face) 25164 25210 (face font-lock-constant-face) 25210 25211 (face font-lock-string-face) 25211 25221 nil 25221 25222 (face font-lock-string-face) 25222 25250 (face font-lock-constant-face) 25250 25251 (face font-lock-string-face) 25251 25268 nil 25268 25269 (face font-lock-string-face) 25269 25279 (face font-lock-keyword-face) 25279 25280 (face font-lock-string-face) 25280 25293 nil 25293 25294 (face font-lock-string-face) 25294 25319 (face font-lock-variable-name-face) 25319 25320 (face font-lock-string-face) 25320 25334 nil 25334 25335 (face font-lock-string-face) 25335 25345 (face font-lock-keyword-face) 25345 25346 (face font-lock-string-face) 25346 25363 nil 25363 25364 (face font-lock-string-face) 25364 25385 (face font-lock-variable-name-face) 25385 25386 (face font-lock-string-face) 25386 25404 nil 25404 25405 (face font-lock-string-face) 25405 25417 (face font-lock-keyword-face) 25417 25418 (face font-lock-string-face) 25418 25438 nil 25438 25439 (face font-lock-string-face) 25439 25480 (face font-lock-function-name-face) 25480 25481 (face font-lock-string-face) 25481 25550 nil 25550 25551 (face font-lock-string-face) 25551 25566 (face font-lock-variable-name-face) 25566 25567 (face font-lock-string-face) 25567 25581 nil 25581 25582 (face font-lock-string-face) 25582 25594 (face font-lock-keyword-face) 25594 25595 (face font-lock-string-face) 25595 25611 nil 25611 25612 (face font-lock-string-face) 25612 25651 (face font-lock-function-name-face) 25651 25652 (face font-lock-string-face) 25652 25688 nil 25688 25689 (face font-lock-string-face) 25689 25704 (face font-lock-variable-name-face) 25704 25705 (face font-lock-string-face) 25705 25719 nil 25719 25720 (face font-lock-string-face) 25720 25728 (face font-lock-keyword-face) 25728 25729 (face font-lock-string-face) 25729 25745 nil 25745 25746 (face font-lock-string-face) 25746 25782 (face font-lock-constant-face) 25782 25783 (face font-lock-string-face) 25783 25797 nil 25797 25798 (face font-lock-string-face) 25798 25820 (face font-lock-constant-face) 25820 25821 (face font-lock-string-face) 25821 25835 nil 25835 25836 (face font-lock-string-face) 25836 25857 (face font-lock-constant-face) 25857 25858 (face font-lock-string-face) 25858 25872 nil 25872 25873 (face font-lock-string-face) 25873 25905 (face font-lock-constant-face) 25905 25906 (face font-lock-string-face) 25906 25920 nil 25920 25921 (face font-lock-string-face) 25921 25961 (face font-lock-constant-face) 25961 25962 (face font-lock-string-face) 25962 25976 nil 25976 25977 (face font-lock-string-face) 25977 26016 (face font-lock-constant-face) 26016 26017 (face font-lock-string-face) 26017 26031 nil 26031 26032 (face font-lock-string-face) 26032 26065 (face font-lock-constant-face) 26065 26066 (face font-lock-string-face) 26066 26080 nil 26080 26081 (face font-lock-string-face) 26081 26115 (face font-lock-constant-face) 26115 26116 (face font-lock-string-face) 26116 26130 nil 26130 26131 (face font-lock-string-face) 26131 26162 (face font-lock-constant-face) 26162 26163 (face font-lock-string-face) 26163 26177 nil 26177 26178 (face font-lock-string-face) 26178 26229 (face font-lock-constant-face) 26229 26230 (face font-lock-string-face) 26230 26244 nil 26244 26245 (face font-lock-string-face) 26245 26285 (face font-lock-constant-face) 26285 26286 (face font-lock-string-face) 26286 26300 nil 26300 26301 (face font-lock-string-face) 26301 26337 (face font-lock-constant-face) 26337 26338 (face font-lock-string-face) 26338 26352 nil 26352 26353 (face font-lock-string-face) 26353 26394 (face font-lock-constant-face) 26394 26395 (face font-lock-string-face) 26395 26409 nil 26409 26410 (face font-lock-string-face) 26410 26443 (face font-lock-constant-face) 26443 26444 (face font-lock-string-face) 26444 26458 nil 26458 26459 (face font-lock-string-face) 26459 26495 (face font-lock-constant-face) 26495 26496 (face font-lock-string-face) 26496 26532 nil 26532 26533 (face font-lock-string-face) 26533 26546 (face font-lock-variable-name-face) 26546 26547 (face font-lock-string-face) 26547 26561 nil 26561 26562 (face font-lock-string-face) 26562 26572 (face font-lock-keyword-face) 26572 26573 (face font-lock-string-face) 26573 26590 nil 26590 26591 (face font-lock-string-face) 26591 26604 (face font-lock-variable-name-face) 26604 26605 (face font-lock-string-face) 26605 26623 nil 26623 26624 (face font-lock-string-face) 26624 26631 (face font-lock-keyword-face) 26631 26632 (face font-lock-string-face) 26632 26652 nil 26652 26653 (face font-lock-string-face) 26653 26688 (face font-lock-constant-face) 26688 26689 (face font-lock-string-face) 26689 26722 nil 26722 26723 (face font-lock-string-face) 26723 26730 (face font-lock-keyword-face) 26730 26731 (face font-lock-string-face) 26731 26751 nil 26751 26752 (face font-lock-string-face) 26752 26760 (face font-lock-preprocessor-face) 26760 26761 (face font-lock-string-face) 26761 26831 nil 26831 26832 (face font-lock-string-face) 26832 26873 (face font-lock-variable-name-face) 26873 26874 (face font-lock-string-face) 26874 26888 nil 26888 26889 (face font-lock-string-face) 26889 26896 (face font-lock-keyword-face) 26896 26897 (face font-lock-string-face) 26897 26913 nil 26913 26914 (face font-lock-string-face) 26914 26954 (face font-lock-constant-face) 26954 26955 (face font-lock-string-face) 26955 26991 nil 26991 26992 (face font-lock-string-face) 26992 27035 (face font-lock-variable-name-face) 27035 27036 (face font-lock-string-face) 27036 27050 nil 27050 27051 (face font-lock-string-face) 27051 27058 (face font-lock-keyword-face) 27058 27059 (face font-lock-string-face) 27059 27075 nil 27075 27076 (face font-lock-string-face) 27076 27095 (face font-lock-constant-face) 27095 27096 (face font-lock-string-face) 27096 27110 nil 27110 27111 (face font-lock-string-face) 27111 27137 (face font-lock-constant-face) 27137 27138 (face font-lock-string-face) 27138 27152 nil 27152 27153 (face font-lock-string-face) 27153 27186 (face font-lock-constant-face) 27186 27187 (face font-lock-string-face) 27187 27201 nil 27201 27202 (face font-lock-string-face) 27202 27235 (face font-lock-constant-face) 27235 27236 (face font-lock-string-face) 27236 27291 nil 27291 27292 (face font-lock-string-face) 27292 27303 (face font-lock-keyword-face) 27303 27304 (face font-lock-string-face) 27304 27306 nil 27306 27307 (face font-lock-string-face) 27307 27325 (face font-lock-function-name-face) 27325 27326 (face font-lock-string-face) 27326 27334 nil 27334 27335 (face font-lock-string-face) 27335 27339 (face font-lock-keyword-face) 27339 27340 (face font-lock-string-face) 27340 27342 nil 27342 27343 (face font-lock-string-face) 27343 27357 (face font-lock-type-face) 27357 27358 (face font-lock-string-face) 27358 27366 nil 27366 27367 (face font-lock-string-face) 27367 27379 (face font-lock-keyword-face) 27379 27380 (face font-lock-string-face) 27380 27392 nil 27392 27393 (face font-lock-string-face) 27393 27398 (face font-lock-function-name-face) 27398 27399 (face font-lock-string-face) 27399 27409 nil 27409 27410 (face font-lock-string-face) 27410 27431 (face font-lock-function-name-face) 27431 27432 (face font-lock-string-face) 27432 27442 nil 27442 27443 (face font-lock-string-face) 27443 27469 (face font-lock-function-name-face) 27469 27470 (face font-lock-string-face) 27470 27480 nil 27480 27481 (face font-lock-string-face) 27481 27507 (face font-lock-function-name-face) 27507 27508 (face font-lock-string-face) 27508 27525 nil 27525 27526 (face font-lock-string-face) 27526 27533 (face font-lock-keyword-face) 27533 27534 (face font-lock-string-face) 27534 27546 nil 27546 27547 (face font-lock-string-face) 27547 27591 (face font-lock-constant-face) 27591 27592 (face font-lock-string-face) 27592 27602 nil 27602 27603 (face font-lock-string-face) 27603 27646 (face font-lock-constant-face) 27646 27647 (face font-lock-string-face) 27647 27657 nil 27657 27658 (face font-lock-string-face) 27658 27679 (face font-lock-constant-face) 27679 27680 (face font-lock-string-face) 27680 27690 nil 27690 27691 (face font-lock-string-face) 27691 27711 (face font-lock-constant-face) 27711 27712 (face font-lock-string-face) 27712 27722 nil 27722 27723 (face font-lock-string-face) 27723 27752 (face font-lock-constant-face) 27752 27753 (face font-lock-string-face) 27753 27763 nil 27763 27764 (face font-lock-string-face) 27764 27792 (face font-lock-constant-face) 27792 27793 (face font-lock-string-face) 27793 27803 nil 27803 27804 (face font-lock-string-face) 27804 27829 (face font-lock-constant-face) 27829 27830 (face font-lock-string-face) 27830 27840 nil 27840 27841 (face font-lock-string-face) 27841 27865 (face font-lock-constant-face) 27865 27866 (face font-lock-string-face) 27866 27876 nil 27876 27877 (face font-lock-string-face) 27877 27901 (face font-lock-constant-face) 27901 27902 (face font-lock-string-face) 27902 27912 nil 27912 27913 (face font-lock-string-face) 27913 27936 (face font-lock-constant-face) 27936 27937 (face font-lock-string-face) 27937 27947 nil 27947 27948 (face font-lock-string-face) 27948 27968 (face font-lock-constant-face) 27968 27969 (face font-lock-string-face) 27969 27979 nil 27979 27980 (face font-lock-string-face) 27980 27999 (face font-lock-constant-face) 27999 28000 (face font-lock-string-face) 28000 28030 nil 28030 28031 (face font-lock-string-face) 28031 28042 (face font-lock-keyword-face) 28042 28043 (face font-lock-string-face) 28043 28045 nil 28045 28046 (face font-lock-string-face) 28046 28058 (face font-lock-function-name-face) 28058 28059 (face font-lock-string-face) 28059 28067 nil 28067 28068 (face font-lock-string-face) 28068 28072 (face font-lock-keyword-face) 28072 28073 (face font-lock-string-face) 28073 28075 nil 28075 28076 (face font-lock-string-face) 28076 28086 (face font-lock-type-face) 28086 28087 (face font-lock-string-face) 28087 28095 nil 28095 28096 (face font-lock-string-face) 28096 28108 (face font-lock-keyword-face) 28108 28109 (face font-lock-string-face) 28109 28121 nil 28121 28122 (face font-lock-string-face) 28122 28127 (face font-lock-function-name-face) 28127 28128 (face font-lock-string-face) 28128 28138 nil 28138 28139 (face font-lock-string-face) 28139 28150 (face font-lock-function-name-face) 28150 28151 (face font-lock-string-face) 28151 28161 nil 28161 28162 (face font-lock-string-face) 28162 28183 (face font-lock-function-name-face) 28183 28184 (face font-lock-string-face) 28184 28194 nil 28194 28195 (face font-lock-string-face) 28195 28216 (face font-lock-function-name-face) 28216 28217 (face font-lock-string-face) 28217 28234 nil 28234 28235 (face font-lock-string-face) 28235 28242 (face font-lock-keyword-face) 28242 28243 (face font-lock-string-face) 28243 28255 nil 28255 28256 (face font-lock-string-face) 28256 28290 (face font-lock-constant-face) 28290 28291 (face font-lock-string-face) 28291 28321 nil 28321 28322 (face font-lock-string-face) 28322 28333 (face font-lock-keyword-face) 28333 28334 (face font-lock-string-face) 28334 28336 nil 28336 28337 (face font-lock-string-face) 28337 28349 (face font-lock-function-name-face) 28349 28350 (face font-lock-string-face) 28350 28358 nil 28358 28359 (face font-lock-string-face) 28359 28363 (face font-lock-keyword-face) 28363 28364 (face font-lock-string-face) 28364 28366 nil 28366 28367 (face font-lock-string-face) 28367 28377 (face font-lock-type-face) 28377 28378 (face font-lock-string-face) 28378 28386 nil 28386 28387 (face font-lock-string-face) 28387 28394 (face font-lock-keyword-face) 28394 28395 (face font-lock-string-face) 28395 28407 nil 28407 28408 (face font-lock-string-face) 28408 28441 (face font-lock-constant-face) 28441 28442 (face font-lock-string-face) 28442 28471 nil 28471 28472 (face font-lock-string-face) 28472 28483 (face font-lock-keyword-face) 28483 28484 (face font-lock-string-face) 28484 28486 nil 28486 28487 (face font-lock-string-face) 28487 28498 (face font-lock-function-name-face) 28498 28499 (face font-lock-string-face) 28499 28507 nil 28507 28508 (face font-lock-string-face) 28508 28512 (face font-lock-keyword-face) 28512 28513 (face font-lock-string-face) 28513 28515 nil 28515 28516 (face font-lock-string-face) 28516 28526 (face font-lock-type-face) 28526 28527 (face font-lock-string-face) 28527 28535 nil 28535 28536 (face font-lock-string-face) 28536 28548 (face font-lock-keyword-face) 28548 28549 (face font-lock-string-face) 28549 28561 nil 28561 28562 (face font-lock-string-face) 28562 28567 (face font-lock-function-name-face) 28567 28568 (face font-lock-string-face) 28568 28578 nil 28578 28579 (face font-lock-string-face) 28579 28600 (face font-lock-function-name-face) 28600 28601 (face font-lock-string-face) 28601 28618 nil 28618 28619 (face font-lock-string-face) 28619 28626 (face font-lock-keyword-face) 28626 28627 (face font-lock-string-face) 28627 28639 nil 28639 28640 (face font-lock-string-face) 28640 28672 (face font-lock-constant-face) 28672 28673 (face font-lock-string-face) 28673 28698 nil 28698 28699 (face font-lock-string-face) 28699 28709 (face font-lock-keyword-face) 28709 28710 (face font-lock-string-face) 28710 28719 nil 28719 28720 (face font-lock-string-face) 28720 28729 (face font-lock-variable-name-face) 28729 28730 (face font-lock-string-face) 28730 28740 nil 28740 28741 (face font-lock-string-face) 28741 28748 (face font-lock-keyword-face) 28748 28749 (face font-lock-string-face) 28749 28773 nil 28773 28774 (face font-lock-string-face) 28774 28785 (face font-lock-keyword-face) 28785 28786 (face font-lock-string-face) 28786 28788 nil 28788 28789 (face font-lock-string-face) 28789 28799 (face font-lock-function-name-face) 28799 28800 (face font-lock-string-face) 28800 28812 nil 28812 28813 (face font-lock-string-face) 28813 28817 (face font-lock-keyword-face) 28817 28818 (face font-lock-string-face) 28818 28820 nil 28820 28821 (face font-lock-string-face) 28821 28831 (face font-lock-type-face) 28831 28832 (face font-lock-string-face) 28832 28844 nil 28844 28845 (face font-lock-string-face) 28845 28857 (face font-lock-keyword-face) 28857 28858 (face font-lock-string-face) 28858 28874 nil 28874 28875 (face font-lock-string-face) 28875 28880 (face font-lock-function-name-face) 28880 28881 (face font-lock-string-face) 28881 28895 nil 28895 28896 (face font-lock-string-face) 28896 28907 (face font-lock-function-name-face) 28907 28908 (face font-lock-string-face) 28908 28922 nil 28922 28923 (face font-lock-string-face) 28923 28944 (face font-lock-function-name-face) 28944 28945 (face font-lock-string-face) 28945 28959 nil 28959 28960 (face font-lock-string-face) 28960 29043 (face font-lock-function-name-face) 29043 29044 (face font-lock-string-face) 29044 29058 nil 29058 29059 (face font-lock-string-face) 29059 29074 (face font-lock-function-name-face) 29074 29075 (face font-lock-string-face) 29075 29100 nil 29100 29101 (face font-lock-string-face) 29101 29113 (face font-lock-keyword-face) 29113 29114 (face font-lock-string-face) 29114 29130 nil 29130 29131 (face font-lock-string-face) 29131 29133 (face font-lock-constant-face) 29133 29138 (face font-lock-variable-name-face) 29138 29163 (face font-lock-constant-face) 29163 29164 (face font-lock-string-face) 29164 29189 nil 29189 29190 (face font-lock-string-face) 29190 29197 (face font-lock-keyword-face) 29197 29198 (face font-lock-string-face) 29198 29214 nil 29214 29215 (face font-lock-string-face) 29215 29238 (face font-lock-constant-face) 29238 29239 (face font-lock-string-face) 29239 29253 nil 29253 29254 (face font-lock-string-face) 29254 29280 (face font-lock-constant-face) 29280 29281 (face font-lock-string-face) 29281 29295 nil 29295 29296 (face font-lock-string-face) 29296 29321 (face font-lock-constant-face) 29321 29322 (face font-lock-string-face) 29322 29336 nil 29336 29337 (face font-lock-string-face) 29337 29361 (face font-lock-constant-face) 29361 29362 (face font-lock-string-face) 29362 29376 nil 29376 29377 (face font-lock-string-face) 29377 29407 (face font-lock-constant-face) 29407 29408 (face font-lock-string-face) 29408 29422 nil 29422 29423 (face font-lock-string-face) 29423 29453 (face font-lock-constant-face) 29453 29454 (face font-lock-string-face) 29454 29468 nil 29468 29469 (face font-lock-string-face) 29469 29493 (face font-lock-constant-face) 29493 29494 (face font-lock-string-face) 29494 29508 nil 29508 29509 (face font-lock-string-face) 29509 29532 (face font-lock-constant-face) 29532 29533 (face font-lock-string-face) 29533 29547 nil 29547 29548 (face font-lock-string-face) 29548 29575 (face font-lock-constant-face) 29575 29576 (face font-lock-string-face) 29576 29590 nil 29590 29591 (face font-lock-string-face) 29591 29614 (face font-lock-constant-face) 29614 29615 (face font-lock-string-face) 29615 29640 nil 29640 29655 (face font-lock-string-face) 29655 29671 nil 29671 29685 (face font-lock-string-face) 29685 29703 nil 29703 29714 (face font-lock-string-face) 29714 29716 nil 29716 29719 (face font-lock-string-face) 29719 29729 nil 29729 29754 (face font-lock-comment-face) 29754 29792 nil 29792 29793 (face font-lock-string-face) 29793 29800 (face font-lock-keyword-face) 29800 29801 (face font-lock-string-face) 29801 29817 nil 29817 29818 (face font-lock-string-face) 29818 29843 (face font-lock-preprocessor-face) 29843 29844 (face font-lock-string-face) 29844 29892 nil 29892 29893 (face font-lock-string-face) 29893 29929 (face font-lock-variable-name-face) 29929 29930 (face font-lock-string-face) 29930 29940 nil 29940 29941 (face font-lock-string-face) 29941 29948 (face font-lock-keyword-face) 29948 29949 (face font-lock-string-face) 29949 29973 nil 29973 29974 (face font-lock-string-face) 29974 29985 (face font-lock-keyword-face) 29985 29986 (face font-lock-string-face) 29986 29988 nil 29988 29989 (face font-lock-string-face) 29989 30001 (face font-lock-function-name-face) 30001 30002 (face font-lock-string-face) 30002 30014 nil 30014 30015 (face font-lock-string-face) 30015 30019 (face font-lock-keyword-face) 30019 30020 (face font-lock-string-face) 30020 30022 nil 30022 30023 (face font-lock-string-face) 30023 30033 (face font-lock-type-face) 30033 30034 (face font-lock-string-face) 30034 30046 nil 30046 30047 (face font-lock-string-face) 30047 30059 (face font-lock-keyword-face) 30059 30060 (face font-lock-string-face) 30060 30076 nil 30076 30077 (face font-lock-string-face) 30077 30082 (face font-lock-function-name-face) 30082 30083 (face font-lock-string-face) 30083 30097 nil 30097 30098 (face font-lock-string-face) 30098 30109 (face font-lock-function-name-face) 30109 30110 (face font-lock-string-face) 30110 30124 nil 30124 30125 (face font-lock-string-face) 30125 30146 (face font-lock-function-name-face) 30146 30147 (face font-lock-string-face) 30147 30161 nil 30161 30162 (face font-lock-string-face) 30162 30180 (face font-lock-function-name-face) 30180 30181 (face font-lock-string-face) 30181 30206 nil 30206 30207 (face font-lock-string-face) 30207 30214 (face font-lock-keyword-face) 30214 30215 (face font-lock-string-face) 30215 30231 nil 30231 30232 (face font-lock-string-face) 30232 30266 (face font-lock-constant-face) 30266 30267 (face font-lock-string-face) 30267 30281 nil 30281 30282 (face font-lock-string-face) 30282 30321 (face font-lock-constant-face) 30321 30322 (face font-lock-string-face) 30322 30336 nil 30336 30337 (face font-lock-string-face) 30337 30375 (face font-lock-constant-face) 30375 30376 (face font-lock-string-face) 30376 30390 nil 30390 30391 (face font-lock-string-face) 30391 30430 (face font-lock-constant-face) 30430 30431 (face font-lock-string-face) 30431 30445 nil 30445 30446 (face font-lock-string-face) 30446 30484 (face font-lock-constant-face) 30484 30485 (face font-lock-string-face) 30485 30499 nil 30499 30500 (face font-lock-string-face) 30500 30533 (face font-lock-constant-face) 30533 30534 (face font-lock-string-face) 30534 30548 nil 30548 30549 (face font-lock-string-face) 30549 30581 (face font-lock-constant-face) 30581 30582 (face font-lock-string-face) 30582 30596 nil 30596 30597 (face font-lock-string-face) 30597 30626 (face font-lock-constant-face) 30626 30627 (face font-lock-string-face) 30627 30641 nil 30641 30642 (face font-lock-string-face) 30642 30670 (face font-lock-constant-face) 30670 30671 (face font-lock-string-face) 30671 30685 nil 30685 30686 (face font-lock-string-face) 30686 30714 (face font-lock-constant-face) 30714 30715 (face font-lock-string-face) 30715 30729 nil 30729 30730 (face font-lock-string-face) 30730 30757 (face font-lock-constant-face) 30757 30758 (face font-lock-string-face) 30758 30783 nil 30783 30784 (face font-lock-string-face) 30784 30794 (face font-lock-keyword-face) 30794 30795 (face font-lock-string-face) 30795 30812 nil 30812 30813 (face font-lock-string-face) 30813 30834 (face font-lock-variable-name-face) 30834 30835 (face font-lock-string-face) 30835 30853 nil 30853 30854 (face font-lock-string-face) 30854 30866 (face font-lock-keyword-face) 30866 30867 (face font-lock-string-face) 30867 30887 nil 30887 30888 (face font-lock-string-face) 30888 30917 (face font-lock-function-name-face) 30917 30918 (face font-lock-string-face) 30918 30951 nil 30951 30952 (face font-lock-string-face) 30952 30959 (face font-lock-keyword-face) 30959 30960 (face font-lock-string-face) 30960 30980 nil 30980 30981 (face font-lock-string-face) 30981 31015 (face font-lock-constant-face) 31015 31016 (face font-lock-string-face) 31016 31064 nil 31064 31065 (face font-lock-string-face) 31065 31074 (face font-lock-variable-name-face) 31074 31075 (face font-lock-string-face) 31075 31093 nil 31093 31094 (face font-lock-string-face) 31094 31106 (face font-lock-keyword-face) 31106 31107 (face font-lock-string-face) 31107 31127 nil 31127 31128 (face font-lock-string-face) 31128 31175 (face font-lock-function-name-face) 31175 31176 (face font-lock-string-face) 31176 31194 nil 31194 31195 (face font-lock-string-face) 31195 31245 (face font-lock-function-name-face) 31245 31246 (face font-lock-string-face) 31246 31279 nil 31279 31280 (face font-lock-string-face) 31280 31287 (face font-lock-keyword-face) 31287 31288 (face font-lock-string-face) 31288 31308 nil 31308 31309 (face font-lock-string-face) 31309 31341 (face font-lock-constant-face) 31341 31342 (face font-lock-string-face) 31342 31423 nil 31423 31424 (face font-lock-string-face) 31424 31462 (face font-lock-variable-name-face) 31462 31463 (face font-lock-string-face) 31463 31473 nil 31473 31474 (face font-lock-string-face) 31474 31481 (face font-lock-keyword-face) 31481 31482 (face font-lock-string-face) 31482 31506 nil 31506 31507 (face font-lock-string-face) 31507 31518 (face font-lock-keyword-face) 31518 31519 (face font-lock-string-face) 31519 31521 nil 31521 31522 (face font-lock-string-face) 31522 31539 (face font-lock-function-name-face) 31539 31540 (face font-lock-string-face) 31540 31552 nil 31552 31553 (face font-lock-string-face) 31553 31557 (face font-lock-keyword-face) 31557 31558 (face font-lock-string-face) 31558 31560 nil 31560 31561 (face font-lock-string-face) 31561 31571 (face font-lock-type-face) 31571 31572 (face font-lock-string-face) 31572 31584 nil 31584 31585 (face font-lock-string-face) 31585 31597 (face font-lock-keyword-face) 31597 31598 (face font-lock-string-face) 31598 31614 nil 31614 31615 (face font-lock-string-face) 31615 31636 (face font-lock-function-name-face) 31636 31637 (face font-lock-string-face) 31637 31651 nil 31651 31652 (face font-lock-string-face) 31652 31670 (face font-lock-function-name-face) 31670 31671 (face font-lock-string-face) 31671 31696 nil 31696 31697 (face font-lock-string-face) 31697 31706 (face font-lock-keyword-face) 31706 31707 (face font-lock-string-face) 31707 31723 nil 31723 31724 (face font-lock-string-face) 31724 31728 (face font-lock-constant-face) 31728 31729 (face font-lock-string-face) 31729 31743 nil 31743 31744 (face font-lock-string-face) 31744 31748 (face font-lock-constant-face) 31748 31749 (face font-lock-string-face) 31749 31774 nil 31774 31775 (face font-lock-string-face) 31775 31782 (face font-lock-keyword-face) 31782 31783 (face font-lock-string-face) 31783 31799 nil 31799 31800 (face font-lock-string-face) 31800 31844 (face font-lock-constant-face) 31844 31845 (face font-lock-string-face) 31845 31893 nil 31893 31894 (face font-lock-string-face) 31894 31943 (face font-lock-variable-name-face) 31943 31944 (face font-lock-string-face) 31944 31954 nil 31954 31955 (face font-lock-string-face) 31955 31962 (face font-lock-keyword-face) 31962 31963 (face font-lock-string-face) 31963 31987 nil 31987 31988 (face font-lock-string-face) 31988 31999 (face font-lock-keyword-face) 31999 32000 (face font-lock-string-face) 32000 32002 nil 32002 32003 (face font-lock-string-face) 32003 32013 (face font-lock-function-name-face) 32013 32014 (face font-lock-string-face) 32014 32026 nil 32026 32027 (face font-lock-string-face) 32027 32031 (face font-lock-keyword-face) 32031 32032 (face font-lock-string-face) 32032 32034 nil 32034 32035 (face font-lock-string-face) 32035 32045 (face font-lock-type-face) 32045 32046 (face font-lock-string-face) 32046 32058 nil 32058 32059 (face font-lock-string-face) 32059 32071 (face font-lock-keyword-face) 32071 32072 (face font-lock-string-face) 32072 32088 nil 32088 32089 (face font-lock-string-face) 32089 32094 (face font-lock-function-name-face) 32094 32095 (face font-lock-string-face) 32095 32109 nil 32109 32110 (face font-lock-string-face) 32110 32121 (face font-lock-function-name-face) 32121 32122 (face font-lock-string-face) 32122 32136 nil 32136 32137 (face font-lock-string-face) 32137 32158 (face font-lock-function-name-face) 32158 32159 (face font-lock-string-face) 32159 32173 nil 32173 32174 (face font-lock-string-face) 32174 32192 (face font-lock-function-name-face) 32192 32193 (face font-lock-string-face) 32193 32218 nil 32218 32219 (face font-lock-string-face) 32219 32232 (face font-lock-keyword-face) 32232 32233 (face font-lock-string-face) 32233 32249 nil 32249 32250 (face font-lock-string-face) 32250 32259 (face font-lock-keyword-face) 32259 32260 (face font-lock-string-face) 32260 32278 nil 32278 32279 (face font-lock-string-face) 32279 32283 (face font-lock-constant-face) 32283 32284 (face font-lock-string-face) 32284 32300 nil 32300 32301 (face font-lock-string-face) 32301 32306 (face font-lock-constant-face) 32306 32307 (face font-lock-string-face) 32307 32323 nil 32323 32324 (face font-lock-string-face) 32324 32333 (face font-lock-constant-face) 32333 32334 (face font-lock-string-face) 32334 32350 nil 32350 32351 (face font-lock-string-face) 32351 32357 (face font-lock-constant-face) 32357 32358 (face font-lock-string-face) 32358 32398 nil 32398 32399 (face font-lock-string-face) 32399 32406 (face font-lock-keyword-face) 32406 32407 (face font-lock-string-face) 32407 32423 nil 32423 32424 (face font-lock-string-face) 32424 32462 (face font-lock-constant-face) 32462 32463 (face font-lock-string-face) 32463 32477 nil 32477 32478 (face font-lock-string-face) 32478 32515 (face font-lock-constant-face) 32515 32516 (face font-lock-string-face) 32516 32530 nil 32530 32531 (face font-lock-string-face) 32531 32568 (face font-lock-constant-face) 32568 32569 (face font-lock-string-face) 32569 32583 nil 32583 32584 (face font-lock-string-face) 32584 32620 (face font-lock-constant-face) 32620 32621 (face font-lock-string-face) 32621 32635 nil 32635 32636 (face font-lock-string-face) 32636 32666 (face font-lock-constant-face) 32666 32667 (face font-lock-string-face) 32667 32681 nil 32681 32682 (face font-lock-string-face) 32682 32720 (face font-lock-constant-face) 32720 32721 (face font-lock-string-face) 32721 32735 nil 32735 32736 (face font-lock-string-face) 32736 32773 (face font-lock-constant-face) 32773 32774 (face font-lock-string-face) 32774 32822 nil 32822 32823 (face font-lock-string-face) 32823 32838 (face font-lock-variable-name-face) 32838 32839 (face font-lock-string-face) 32839 32849 nil 32849 32850 (face font-lock-string-face) 32850 32857 (face font-lock-keyword-face) 32857 32858 (face font-lock-string-face) 32858 32882 nil 32882 32883 (face font-lock-string-face) 32883 32894 (face font-lock-keyword-face) 32894 32895 (face font-lock-string-face) 32895 32897 nil 32897 32898 (face font-lock-string-face) 32898 32912 (face font-lock-function-name-face) 32912 32913 (face font-lock-string-face) 32913 32925 nil 32925 32926 (face font-lock-string-face) 32926 32930 (face font-lock-keyword-face) 32930 32931 (face font-lock-string-face) 32931 32933 nil 32933 32934 (face font-lock-string-face) 32934 32948 (face font-lock-type-face) 32948 32949 (face font-lock-string-face) 32949 32961 nil 32961 32962 (face font-lock-string-face) 32962 32969 (face font-lock-keyword-face) 32969 32970 (face font-lock-string-face) 32970 32986 nil 32986 32987 (face font-lock-string-face) 32987 33022 (face font-lock-constant-face) 33022 33023 (face font-lock-string-face) 33023 33037 nil 33037 33038 (face font-lock-string-face) 33038 33072 (face font-lock-constant-face) 33072 33073 (face font-lock-string-face) 33073 33098 nil 33098 33099 (face font-lock-string-face) 33099 33111 (face font-lock-keyword-face) 33111 33112 (face font-lock-string-face) 33112 33128 nil 33128 33129 (face font-lock-string-face) 33129 33150 (face font-lock-function-name-face) 33150 33151 (face font-lock-string-face) 33151 33176 nil 33176 33177 (face font-lock-string-face) 33177 33189 (face font-lock-keyword-face) 33189 33190 (face font-lock-string-face) 33190 33206 nil 33206 33207 (face font-lock-string-face) 33207 33209 (face font-lock-constant-face) 33209 33232 (face font-lock-variable-name-face) 33232 33239 (face font-lock-constant-face) 33239 33240 (face font-lock-string-face) 33240 33265 nil 33265 33266 (face font-lock-string-face) 33266 33273 (face font-lock-keyword-face) 33273 33274 (face font-lock-string-face) 33274 33306 nil 33306 33307 (face font-lock-string-face) 33307 33318 (face font-lock-keyword-face) 33318 33319 (face font-lock-string-face) 33319 33321 nil 33321 33322 (face font-lock-string-face) 33322 33342 (face font-lock-function-name-face) 33342 33343 (face font-lock-string-face) 33343 33359 nil 33359 33360 (face font-lock-string-face) 33360 33366 (face font-lock-keyword-face) 33366 33367 (face font-lock-string-face) 33367 33387 nil 33387 33388 (face font-lock-string-face) 33388 33434 (face font-lock-constant-face) 33434 33435 (face font-lock-string-face) 33435 33453 nil 33453 33454 (face font-lock-string-face) 33454 33519 (face font-lock-constant-face) 33519 33520 (face font-lock-string-face) 33520 33553 nil 33553 33554 (face font-lock-string-face) 33554 33561 (face font-lock-keyword-face) 33561 33562 (face font-lock-string-face) 33562 33582 nil 33582 33583 (face font-lock-string-face) 33583 33585 (face font-lock-constant-face) 33585 33608 (face font-lock-variable-name-face) 33608 33647 (face font-lock-constant-face) 33647 33648 (face font-lock-string-face) 33648 33681 nil 33681 33682 (face font-lock-string-face) 33682 33688 (face font-lock-keyword-face) 33688 33689 (face font-lock-string-face) 33689 33709 nil 33709 33710 (face font-lock-string-face) 33710 33716 (face font-lock-constant-face) 33716 33717 (face font-lock-string-face) 33717 33735 nil 33735 33736 (face font-lock-string-face) 33736 33738 (face font-lock-constant-face) 33738 33743 (face font-lock-variable-name-face) 33743 33788 (face font-lock-constant-face) 33788 33789 (face font-lock-string-face) 33789 33807 nil 33807 33808 (face font-lock-string-face) 33808 33810 (face font-lock-constant-face) 33810 33811 (face font-lock-string-face) 33811 33829 nil 33829 33830 (face font-lock-string-face) 33830 33833 (face font-lock-constant-face) 33833 33840 (face font-lock-variable-name-face) 33840 33841 (face font-lock-constant-face) 33841 33842 (face font-lock-string-face) 33842 33860 nil 33860 33861 (face font-lock-string-face) 33861 33864 (face font-lock-constant-face) 33864 33872 (face font-lock-variable-name-face) 33872 33873 (face font-lock-constant-face) 33873 33874 (face font-lock-string-face) 33874 33952 nil 33952 33953 (face font-lock-string-face) 33953 33964 (face font-lock-keyword-face) 33964 33965 (face font-lock-string-face) 33965 33967 nil 33967 33968 (face font-lock-string-face) 33968 33978 (face font-lock-function-name-face) 33978 33979 (face font-lock-string-face) 33979 33991 nil 33991 33992 (face font-lock-string-face) 33992 33996 (face font-lock-keyword-face) 33996 33997 (face font-lock-string-face) 33997 33999 nil 33999 34000 (face font-lock-string-face) 34000 34004 (face font-lock-type-face) 34004 34005 (face font-lock-string-face) 34005 34017 nil 34017 34018 (face font-lock-string-face) 34018 34030 (face font-lock-keyword-face) 34030 34031 (face font-lock-string-face) 34031 34035 nil 34035 34036 (face font-lock-string-face) 34036 34062 (face font-lock-function-name-face) 34062 34063 (face font-lock-string-face) 34063 34077 nil 34077 34078 (face font-lock-string-face) 34078 34087 (face font-lock-keyword-face) 34087 34088 (face font-lock-string-face) 34088 34104 nil 34104 34105 (face font-lock-string-face) 34105 34117 (face font-lock-variable-name-face) 34117 34118 (face font-lock-string-face) 34118 34120 nil 34120 34121 (face font-lock-string-face) 34121 34126 (face font-lock-variable-name-face) 34126 34127 (face font-lock-string-face) 34127 34141 nil 34141 34142 (face font-lock-string-face) 34142 34153 (face font-lock-variable-name-face) 34153 34154 (face font-lock-string-face) 34154 34156 nil 34156 34157 (face font-lock-string-face) 34157 34174 (face font-lock-variable-name-face) 34174 34175 (face font-lock-string-face) 34175 34200 nil 34200 34201 (face font-lock-string-face) 34201 34209 (face font-lock-keyword-face) 34209 34210 (face font-lock-string-face) 34210 34214 nil 34214 34215 (face font-lock-string-face) 34215 34233 (face font-lock-constant-face) 34233 34234 (face font-lock-string-face) 34234 34268 nil 34268 34287 (face font-lock-comment-face) 34287 34293 nil 34293 34365 (face font-lock-comment-face) 34365 34371 nil 34371 34372 (face font-lock-string-face) 34372 34379 (face font-lock-keyword-face) 34379 34380 (face font-lock-string-face) 34380 34404 nil 34404 34405 (face font-lock-string-face) 34405 34416 (face font-lock-keyword-face) 34416 34417 (face font-lock-string-face) 34417 34419 nil 34419 34420 (face font-lock-string-face) 34420 34436 (face font-lock-function-name-face) 34436 34437 (face font-lock-string-face) 34437 34449 nil 34449 34450 (face font-lock-string-face) 34450 34454 (face font-lock-keyword-face) 34454 34455 (face font-lock-string-face) 34455 34457 nil 34457 34458 (face font-lock-string-face) 34458 34468 (face font-lock-type-face) 34468 34469 (face font-lock-string-face) 34469 34481 nil 34481 34482 (face font-lock-string-face) 34482 34494 (face font-lock-keyword-face) 34494 34495 (face font-lock-string-face) 34495 34511 nil 34511 34512 (face font-lock-string-face) 34512 34517 (face font-lock-function-name-face) 34517 34518 (face font-lock-string-face) 34518 34532 nil 34532 34533 (face font-lock-string-face) 34533 34551 (face font-lock-function-name-face) 34551 34552 (face font-lock-string-face) 34552 34566 nil 34566 34567 (face font-lock-string-face) 34567 34588 (face font-lock-function-name-face) 34588 34589 (face font-lock-string-face) 34589 34603 nil 34603 34604 (face font-lock-string-face) 34604 34630 (face font-lock-function-name-face) 34630 34631 (face font-lock-string-face) 34631 34645 nil 34645 34646 (face font-lock-string-face) 34646 34680 (face font-lock-function-name-face) 34680 34681 (face font-lock-string-face) 34681 34695 nil 34695 34696 (face font-lock-string-face) 34696 34730 (face font-lock-function-name-face) 34730 34731 (face font-lock-string-face) 34731 34745 nil 34745 34746 (face font-lock-string-face) 34746 34772 (face font-lock-function-name-face) 34772 34773 (face font-lock-string-face) 34773 34787 nil 34787 34788 (face font-lock-string-face) 34788 34827 (face font-lock-function-name-face) 34827 34828 (face font-lock-string-face) 34828 34853 nil 34853 34854 (face font-lock-string-face) 34854 34861 (face font-lock-keyword-face) 34861 34862 (face font-lock-string-face) 34862 34878 nil 34878 34879 (face font-lock-string-face) 34879 34904 (face font-lock-constant-face) 34904 34905 (face font-lock-string-face) 34905 34930 nil 34930 34931 (face font-lock-string-face) 34931 34941 (face font-lock-keyword-face) 34941 34942 (face font-lock-string-face) 34942 34959 nil 34959 34960 (face font-lock-string-face) 34960 34981 (face font-lock-variable-name-face) 34981 34982 (face font-lock-string-face) 34982 35000 nil 35000 35001 (face font-lock-string-face) 35001 35013 (face font-lock-keyword-face) 35013 35014 (face font-lock-string-face) 35014 35034 nil 35034 35077 (face font-lock-comment-face) 35077 35093 nil 35093 35123 (face font-lock-comment-face) 35123 35139 nil 35139 35164 (face font-lock-comment-face) 35164 35180 nil 35180 35194 (face font-lock-comment-face) 35194 35210 nil 35210 35211 (face font-lock-string-face) 35211 35240 (face font-lock-function-name-face) 35240 35241 (face font-lock-string-face) 35241 35274 nil 35274 35275 (face font-lock-string-face) 35275 35285 (face font-lock-keyword-face) 35285 35286 (face font-lock-string-face) 35286 35307 nil 35307 35308 (face font-lock-string-face) 35308 35329 (face font-lock-variable-name-face) 35329 35330 (face font-lock-string-face) 35330 35352 nil 35352 35353 (face font-lock-string-face) 35353 35365 (face font-lock-keyword-face) 35365 35366 (face font-lock-string-face) 35366 35390 nil 35390 35391 (face font-lock-string-face) 35391 35432 (face font-lock-function-name-face) 35432 35433 (face font-lock-string-face) 35433 35553 nil 35553 35554 (face font-lock-string-face) 35554 35565 (face font-lock-keyword-face) 35565 35566 (face font-lock-string-face) 35566 35568 nil 35568 35569 (face font-lock-string-face) 35569 35592 (face font-lock-function-name-face) 35592 35593 (face font-lock-string-face) 35593 35605 nil 35605 35606 (face font-lock-string-face) 35606 35610 (face font-lock-keyword-face) 35610 35611 (face font-lock-string-face) 35611 35613 nil 35613 35614 (face font-lock-string-face) 35614 35624 (face font-lock-type-face) 35624 35625 (face font-lock-string-face) 35625 35637 nil 35637 35638 (face font-lock-string-face) 35638 35650 (face font-lock-keyword-face) 35650 35651 (face font-lock-string-face) 35651 35667 nil 35667 35668 (face font-lock-string-face) 35668 35673 (face font-lock-function-name-face) 35673 35674 (face font-lock-string-face) 35674 35688 nil 35688 35689 (face font-lock-string-face) 35689 35707 (face font-lock-function-name-face) 35707 35708 (face font-lock-string-face) 35708 35722 nil 35722 35723 (face font-lock-string-face) 35723 35757 (face font-lock-function-name-face) 35757 35758 (face font-lock-string-face) 35758 35772 nil 35772 35773 (face font-lock-string-face) 35773 35799 (face font-lock-function-name-face) 35799 35800 (face font-lock-string-face) 35800 35814 nil 35814 35815 (face font-lock-string-face) 35815 35841 (face font-lock-function-name-face) 35841 35842 (face font-lock-string-face) 35842 35856 nil 35856 35857 (face font-lock-string-face) 35857 35896 (face font-lock-function-name-face) 35896 35897 (face font-lock-string-face) 35897 35922 nil 35922 35923 (face font-lock-string-face) 35923 35930 (face font-lock-keyword-face) 35930 35931 (face font-lock-string-face) 35931 35947 nil 35947 35948 (face font-lock-string-face) 35948 35970 (face font-lock-constant-face) 35970 35971 (face font-lock-string-face) 35971 35985 nil 35985 35986 (face font-lock-string-face) 35986 36011 (face font-lock-constant-face) 36011 36012 (face font-lock-string-face) 36012 36026 nil 36026 36027 (face font-lock-string-face) 36027 36060 (face font-lock-constant-face) 36060 36061 (face font-lock-string-face) 36061 36075 nil 36075 36076 (face font-lock-string-face) 36076 36117 (face font-lock-constant-face) 36117 36118 (face font-lock-string-face) 36118 36143 nil 36143 36144 (face font-lock-string-face) 36144 36154 (face font-lock-keyword-face) 36154 36155 (face font-lock-string-face) 36155 36172 nil 36172 36173 (face font-lock-string-face) 36173 36198 (face font-lock-variable-name-face) 36198 36199 (face font-lock-string-face) 36199 36217 nil 36217 36218 (face font-lock-string-face) 36218 36228 (face font-lock-keyword-face) 36228 36229 (face font-lock-string-face) 36229 36250 nil 36250 36251 (face font-lock-string-face) 36251 36272 (face font-lock-variable-name-face) 36272 36273 (face font-lock-string-face) 36273 36295 nil 36295 36296 (face font-lock-string-face) 36296 36308 (face font-lock-keyword-face) 36308 36309 (face font-lock-string-face) 36309 36333 nil 36333 36334 (face font-lock-string-face) 36334 36375 (face font-lock-function-name-face) 36375 36376 (face font-lock-string-face) 36376 36496 nil 36496 36497 (face font-lock-string-face) 36497 36508 (face font-lock-keyword-face) 36508 36509 (face font-lock-string-face) 36509 36511 nil 36511 36512 (face font-lock-string-face) 36512 36524 (face font-lock-function-name-face) 36524 36525 (face font-lock-string-face) 36525 36537 nil 36537 36538 (face font-lock-string-face) 36538 36542 (face font-lock-keyword-face) 36542 36543 (face font-lock-string-face) 36543 36545 nil 36545 36546 (face font-lock-string-face) 36546 36556 (face font-lock-type-face) 36556 36557 (face font-lock-string-face) 36557 36569 nil 36569 36570 (face font-lock-string-face) 36570 36582 (face font-lock-keyword-face) 36582 36583 (face font-lock-string-face) 36583 36599 nil 36599 36600 (face font-lock-string-face) 36600 36605 (face font-lock-function-name-face) 36605 36606 (face font-lock-string-face) 36606 36620 nil 36620 36621 (face font-lock-string-face) 36621 36642 (face font-lock-function-name-face) 36642 36643 (face font-lock-string-face) 36643 36657 nil 36657 36658 (face font-lock-string-face) 36658 36697 (face font-lock-function-name-face) 36697 36698 (face font-lock-string-face) 36698 36723 nil 36723 36724 (face font-lock-string-face) 36724 36731 (face font-lock-keyword-face) 36731 36732 (face font-lock-string-face) 36732 36748 nil 36748 36749 (face font-lock-string-face) 36749 36782 (face font-lock-constant-face) 36782 36783 (face font-lock-string-face) 36783 36829 nil 36829 36830 (face font-lock-string-face) 36830 36841 (face font-lock-keyword-face) 36841 36842 (face font-lock-string-face) 36842 36844 nil 36844 36845 (face font-lock-string-face) 36845 36856 (face font-lock-function-name-face) 36856 36857 (face font-lock-string-face) 36857 36869 nil 36869 36870 (face font-lock-string-face) 36870 36874 (face font-lock-keyword-face) 36874 36875 (face font-lock-string-face) 36875 36877 nil 36877 36878 (face font-lock-string-face) 36878 36888 (face font-lock-type-face) 36888 36889 (face font-lock-string-face) 36889 36901 nil 36901 36902 (face font-lock-string-face) 36902 36914 (face font-lock-keyword-face) 36914 36915 (face font-lock-string-face) 36915 36931 nil 36931 36932 (face font-lock-string-face) 36932 36937 (face font-lock-function-name-face) 36937 36938 (face font-lock-string-face) 36938 36952 nil 36952 36953 (face font-lock-string-face) 36953 36974 (face font-lock-function-name-face) 36974 36975 (face font-lock-string-face) 36975 36989 nil 36989 36990 (face font-lock-string-face) 36990 37029 (face font-lock-function-name-face) 37029 37030 (face font-lock-string-face) 37030 37055 nil 37055 37056 (face font-lock-string-face) 37056 37063 (face font-lock-keyword-face) 37063 37064 (face font-lock-string-face) 37064 37080 nil 37080 37081 (face font-lock-string-face) 37081 37113 (face font-lock-constant-face) 37113 37114 (face font-lock-string-face) 37114 37163 nil)\n"
  },
  {
    "path": "gyp/tools/graphviz.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2011 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Using the JSON dumped by the dump-dependency-json generator,\ngenerate input suitable for graphviz to render a dependency graph of\ntargets.\"\"\"\n\nimport collections\nimport json\nimport sys\n\n\ndef ParseTarget(target):\n    target, _, suffix = target.partition(\"#\")\n    filename, _, target = target.partition(\":\")\n    return filename, target, suffix\n\n\ndef LoadEdges(filename, targets):\n    \"\"\"Load the edges map from the dump file, and filter it to only\n    show targets in |targets| and their depedendents.\"\"\"\n\n    file = open(\"dump.json\")\n    edges = json.load(file)\n    file.close()\n\n    # Copy out only the edges we're interested in from the full edge list.\n    target_edges = {}\n    to_visit = targets[:]\n    while to_visit:\n        src = to_visit.pop()\n        if src in target_edges:\n            continue\n        target_edges[src] = edges[src]\n        to_visit.extend(edges[src])\n\n    return target_edges\n\n\ndef WriteGraph(edges):\n    \"\"\"Print a graphviz graph to stdout.\n    |edges| is a map of target to a list of other targets it depends on.\"\"\"\n\n    # Bucket targets by file.\n    files = collections.defaultdict(list)\n    for src, dst in edges.items():\n        build_file, target_name, _toolset = ParseTarget(src)\n        files[build_file].append(src)\n\n    print(\"digraph D {\")\n    print(\"  fontsize=8\")  # Used by subgraphs.\n    print(\"  node [fontsize=8]\")\n\n    # Output nodes by file.  We must first write out each node within\n    # its file grouping before writing out any edges that may refer\n    # to those nodes.\n    for filename, targets in files.items():\n        if len(targets) == 1:\n            # If there's only one node for this file, simplify\n            # the display by making it a box without an internal node.\n            target = targets[0]\n            build_file, target_name, _toolset = ParseTarget(target)\n            print(f'  \"{target}\" [shape=box, label=\"{filename}\\\\n{target_name}\"]')\n        else:\n            # Group multiple nodes together in a subgraph.\n            print('  subgraph \"cluster_%s\" {' % filename)\n            print('    label = \"%s\"' % filename)\n            for target in targets:\n                build_file, target_name, _toolset = ParseTarget(target)\n                print(f'    \"{target}\" [label=\"{target_name}\"]')\n            print(\"  }\")\n\n    # Now that we've placed all the nodes within subgraphs, output all\n    # the edges between nodes.\n    for src, dsts in edges.items():\n        for dst in dsts:\n            print(f'  \"{src}\" -> \"{dst}\"')\n\n    print(\"}\")\n\n\ndef main():\n    if len(sys.argv) < 2:\n        print(__doc__, file=sys.stderr)\n        print(file=sys.stderr)\n        print(\"usage: %s target1 target2...\" % (sys.argv[0]), file=sys.stderr)\n        return 1\n\n    edges = LoadEdges(\"dump.json\", sys.argv[1:])\n\n    WriteGraph(edges)\n    return 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n"
  },
  {
    "path": "gyp/tools/pretty_gyp.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Pretty-prints the contents of a GYP file.\"\"\"\n\nimport re\nimport sys\n\n# Regex to remove comments when we're counting braces.\nCOMMENT_RE = re.compile(r\"\\s*#.*\")\n\n# Regex to remove quoted strings when we're counting braces.\n# It takes into account quoted quotes, and makes sure that the quotes match.\n# NOTE: It does not handle quotes that span more than one line, or\n# cases where an escaped quote is preceded by an escaped backslash.\nQUOTE_RE_STR = r'(?P<q>[\\'\"])(.*?)(?<![^\\\\][\\\\])(?P=q)'\nQUOTE_RE = re.compile(QUOTE_RE_STR)\n\n\ndef comment_replace(matchobj):\n    return matchobj.group(1) + matchobj.group(2) + \"#\" * len(matchobj.group(3))\n\n\ndef mask_comments(input):\n    \"\"\"Mask the quoted strings so we skip braces inside quoted strings.\"\"\"\n    search_re = re.compile(r\"(.*?)(#)(.*)\")\n    return [search_re.sub(comment_replace, line) for line in input]\n\n\ndef quote_replace(matchobj):\n    return \"{}{}{}{}\".format(\n        matchobj.group(1),\n        matchobj.group(2),\n        \"x\" * len(matchobj.group(3)),\n        matchobj.group(2),\n    )\n\n\ndef mask_quotes(input):\n    \"\"\"Mask the quoted strings so we skip braces inside quoted strings.\"\"\"\n    search_re = re.compile(r\"(.*?)\" + QUOTE_RE_STR)\n    return [search_re.sub(quote_replace, line) for line in input]\n\n\ndef do_split(input, masked_input, search_re):\n    output = []\n    mask_output = []\n    for line, masked_line in zip(input, masked_input):\n        m = search_re.match(masked_line)\n        while m:\n            split = len(m.group(1))\n            line = line[:split] + r\"\\n\" + line[split:]\n            masked_line = masked_line[:split] + r\"\\n\" + masked_line[split:]\n            m = search_re.match(masked_line)\n        output.extend(line.split(r\"\\n\"))\n        mask_output.extend(masked_line.split(r\"\\n\"))\n    return (output, mask_output)\n\n\ndef split_double_braces(input):\n    \"\"\"Masks out the quotes and comments, and then splits appropriate\n    lines (lines that matche the double_*_brace re's above) before\n    indenting them below.\n\n    These are used to split lines which have multiple braces on them, so\n    that the indentation looks prettier when all laid out (e.g. closing\n    braces make a nice diagonal line).\n    \"\"\"\n    double_open_brace_re = re.compile(r\"(.*?[\\[\\{\\(,])(\\s*)([\\[\\{\\(])\")\n    double_close_brace_re = re.compile(r\"(.*?[\\]\\}\\)],?)(\\s*)([\\]\\}\\)])\")\n\n    masked_input = mask_quotes(input)\n    masked_input = mask_comments(masked_input)\n\n    (output, mask_output) = do_split(input, masked_input, double_open_brace_re)\n    (output, mask_output) = do_split(output, mask_output, double_close_brace_re)\n\n    return output\n\n\ndef count_braces(line):\n    \"\"\"keeps track of the number of braces on a given line and returns the result.\n\n    It starts at zero and subtracts for closed braces, and adds for open braces.\n    \"\"\"\n    open_braces = [\"[\", \"(\", \"{\"]\n    close_braces = [\"]\", \")\", \"}\"]\n    closing_prefix_re = re.compile(r\"[^\\s\\]\\}\\)]\\s*[\\]\\}\\)]+,?\\s*$\")\n    cnt = 0\n    stripline = COMMENT_RE.sub(r\"\", line)\n    stripline = QUOTE_RE.sub(r\"''\", stripline)\n    for char in stripline:\n        for brace in open_braces:\n            if char == brace:\n                cnt += 1\n        for brace in close_braces:\n            if char == brace:\n                cnt -= 1\n\n    after = False\n    if cnt > 0:\n        after = True\n\n    # This catches the special case of a closing brace having something\n    # other than just whitespace ahead of it -- we don't want to\n    # unindent that until after this line is printed so it stays with\n    # the previous indentation level.\n    if cnt < 0 and closing_prefix_re.match(stripline):\n        after = True\n    return (cnt, after)\n\n\ndef prettyprint_input(lines):\n    \"\"\"Does the main work of indenting the input based on the brace counts.\"\"\"\n    indent = 0\n    basic_offset = 2\n    for line in lines:\n        if COMMENT_RE.match(line):\n            print(line)\n        else:\n            line = line.strip(\"\\r\\n\\t \")  # Otherwise doesn't strip \\r on Unix.\n            if len(line) > 0:\n                (brace_diff, after) = count_braces(line)\n                if brace_diff != 0:\n                    if after:\n                        print(\" \" * (basic_offset * indent) + line)\n                        indent += brace_diff\n                    else:\n                        indent += brace_diff\n                        print(\" \" * (basic_offset * indent) + line)\n                else:\n                    print(\" \" * (basic_offset * indent) + line)\n            else:\n                print()\n\n\ndef main():\n    if len(sys.argv) > 1:\n        data = open(sys.argv[1]).read().splitlines()\n    else:\n        data = sys.stdin.read().splitlines()\n    # Split up the double braces.\n    lines = split_double_braces(data)\n\n    # Indent and print the output.\n    prettyprint_input(lines)\n    return 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n"
  },
  {
    "path": "gyp/tools/pretty_sln.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Prints the information in a sln file in a diffable way.\n\nIt first outputs each projects in alphabetical order with their\ndependencies.\n\nThen it outputs a possible build order.\n\"\"\"\n\nimport os\nimport re\nimport sys\n\nimport pretty_vcproj\n\n__author__ = \"nsylvain (Nicolas Sylvain)\"\n\n\ndef BuildProject(project, built, projects, deps):\n    # if all dependencies are done, we can build it, otherwise we try to build the\n    # dependency.\n    # This is not infinite-recursion proof.\n    for dep in deps[project]:\n        if dep not in built:\n            BuildProject(dep, built, projects, deps)\n    print(project)\n    built.append(project)\n\n\ndef ParseSolution(solution_file):\n    # All projects, their clsid and paths.\n    projects = {}\n\n    # A list of dependencies associated with a project.\n    dependencies = {}\n\n    # Regular expressions that matches the SLN format.\n    # The first line of a project definition.\n    begin_project = re.compile(\n        r'^Project\\(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942'\n        r'}\"\\) = \"(.*)\", \"(.*)\", \"(.*)\"$'\n    )\n    # The last line of a project definition.\n    end_project = re.compile(\"^EndProject$\")\n    # The first line of a dependency list.\n    begin_dep = re.compile(r\"ProjectSection\\(ProjectDependencies\\) = postProject$\")\n    # The last line of a dependency list.\n    end_dep = re.compile(\"EndProjectSection$\")\n    # A line describing a dependency.\n    dep_line = re.compile(\" *({.*}) = ({.*})$\")\n\n    in_deps = False\n    solution = open(solution_file)\n    for line in solution:\n        results = begin_project.search(line)\n        if results:\n            # Hack to remove icu because the diff is too different.\n            if results.group(1).find(\"icu\") != -1:\n                continue\n            # We remove \"_gyp\" from the names because it helps to diff them.\n            current_project = results.group(1).replace(\"_gyp\", \"\")\n            projects[current_project] = [\n                results.group(2).replace(\"_gyp\", \"\"),\n                results.group(3),\n                results.group(2),\n            ]\n            dependencies[current_project] = []\n            continue\n\n        results = end_project.search(line)\n        if results:\n            current_project = None\n            continue\n\n        results = begin_dep.search(line)\n        if results:\n            in_deps = True\n            continue\n\n        results = end_dep.search(line)\n        if results:\n            in_deps = False\n            continue\n\n        results = dep_line.search(line)\n        if results and in_deps and current_project:\n            dependencies[current_project].append(results.group(1))\n            continue\n\n    # Change all dependencies clsid to name instead.\n    for project, deps in dependencies.items():\n        # For each dependencies in this project\n        new_dep_array = []\n        for dep in deps:\n            # Look for the project name matching this cldis\n            for project_info in projects:\n                if projects[project_info][1] == dep:\n                    new_dep_array.append(project_info)\n        dependencies[project] = sorted(new_dep_array)\n\n    return (projects, dependencies)\n\n\ndef PrintDependencies(projects, deps):\n    print(\"---------------------------------------\")\n    print(\"Dependencies for all projects\")\n    print(\"---------------------------------------\")\n    print(\"--                                   --\")\n\n    for project, dep_list in sorted(deps.items()):\n        print(\"Project : %s\" % project)\n        print(\"Path : %s\" % projects[project][0])\n        if dep_list:\n            for dep in dep_list:\n                print(\"  - %s\" % dep)\n        print()\n\n    print(\"--                                   --\")\n\n\ndef PrintBuildOrder(projects, deps):\n    print(\"---------------------------------------\")\n    print(\"Build order                            \")\n    print(\"---------------------------------------\")\n    print(\"--                                   --\")\n\n    built = []\n    for project, _ in sorted(deps.items()):\n        if project not in built:\n            BuildProject(project, built, projects, deps)\n\n    print(\"--                                   --\")\n\n\ndef PrintVCProj(projects):\n    for project in projects:\n        print(\"-------------------------------------\")\n        print(\"-------------------------------------\")\n        print(project)\n        print(project)\n        print(project)\n        print(\"-------------------------------------\")\n        print(\"-------------------------------------\")\n\n        project_path = os.path.abspath(\n            os.path.join(os.path.dirname(sys.argv[1]), projects[project][2])\n        )\n\n        pretty = pretty_vcproj\n        argv = [\n            \"\",\n            project_path,\n            \"$(SolutionDir)=%s\\\\\" % os.path.dirname(sys.argv[1]),\n        ]\n        argv.extend(sys.argv[3:])\n        pretty.main(argv)\n\n\ndef main():\n    # check if we have exactly 1 parameter.\n    if len(sys.argv) < 2:\n        print('Usage: %s \"c:\\\\path\\\\to\\\\project.sln\"' % sys.argv[0])\n        return 1\n\n    (projects, deps) = ParseSolution(sys.argv[1])\n    PrintDependencies(projects, deps)\n    PrintBuildOrder(projects, deps)\n\n    if \"--recursive\" in sys.argv:\n        PrintVCProj(projects)\n    return 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n"
  },
  {
    "path": "gyp/tools/pretty_vcproj.py",
    "content": "#!/usr/bin/env python3\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"Make the format of a vcproj really pretty.\n\nThis script normalize and sort an xml. It also fetches all the properties\ninside linked vsprops and include them explicitly in the vcproj.\n\nIt outputs the resulting xml to stdout.\n\"\"\"\n\nimport os\nimport sys\nfrom xml.dom.minidom import Node, parse\n\n__author__ = \"nsylvain (Nicolas Sylvain)\"\nARGUMENTS = None\nREPLACEMENTS = {}\n\n\ndef cmp(x, y):\n    return (x > y) - (x < y)\n\n\nclass CmpTuple:\n    \"\"\"Compare function between 2 tuple.\"\"\"\n\n    def __call__(self, x, y):\n        return cmp(x[0], y[0])\n\n\nclass CmpNode:\n    \"\"\"Compare function between 2 xml nodes.\"\"\"\n\n    def __call__(self, x, y):\n        def get_string(node):\n            node_string = \"node\"\n            node_string += node.nodeName\n            if node.nodeValue:\n                node_string += node.nodeValue\n\n            if node.attributes:\n                # We first sort by name, if present.\n                node_string += node.getAttribute(\"Name\")\n\n                all_nodes = []\n                for name, value in node.attributes.items():\n                    all_nodes.append((name, value))\n\n                all_nodes.sort(CmpTuple())\n                for name, value in all_nodes:\n                    node_string += name\n                    node_string += value\n\n            return node_string\n\n        return cmp(get_string(x), get_string(y))\n\n\ndef PrettyPrintNode(node, indent=0):\n    if node.nodeType == Node.TEXT_NODE:\n        if node.data.strip():\n            print(\"{}{}\".format(\" \" * indent, node.data.strip()))\n        return\n\n    if node.childNodes:\n        node.normalize()\n    # Get the number of attributes\n    attr_count = 0\n    if node.attributes:\n        attr_count = node.attributes.length\n\n    # Print the main tag\n    if attr_count == 0:\n        print(\"{}<{}>\".format(\" \" * indent, node.nodeName))\n    else:\n        print(\"{}<{}\".format(\" \" * indent, node.nodeName))\n\n        all_attributes = []\n        for name, value in node.attributes.items():\n            all_attributes.append((name, value))\n            all_attributes.sort(CmpTuple())\n        for name, value in all_attributes:\n            print('{}  {}=\"{}\"'.format(\" \" * indent, name, value))\n        print(\"%s>\" % (\" \" * indent))\n    if node.nodeValue:\n        print(\"{}  {}\".format(\" \" * indent, node.nodeValue))\n\n    for sub_node in node.childNodes:\n        PrettyPrintNode(sub_node, indent=indent + 2)\n    print(\"{}</{}>\".format(\" \" * indent, node.nodeName))\n\n\ndef FlattenFilter(node):\n    \"\"\"Returns a list of all the node and sub nodes.\"\"\"\n    node_list = []\n\n    if node.attributes and node.getAttribute(\"Name\") == \"_excluded_files\":\n        # We don't add the \"_excluded_files\" filter.\n        return []\n\n    for current in node.childNodes:\n        if current.nodeName == \"Filter\":\n            node_list.extend(FlattenFilter(current))\n        else:\n            node_list.append(current)\n\n    return node_list\n\n\ndef FixFilenames(filenames, current_directory):\n    new_list = []\n    for filename in filenames:\n        if filename:\n            for key, value in REPLACEMENTS.items():\n                filename = filename.replace(key, value)\n            os.chdir(current_directory)\n            filename = filename.strip(\"\\\"' \")\n            if filename.startswith(\"$\"):\n                new_list.append(filename)\n            else:\n                new_list.append(os.path.abspath(filename))\n    return new_list\n\n\ndef AbsoluteNode(node):\n    \"\"\"Makes all the properties we know about in this node absolute.\"\"\"\n    if node.attributes:\n        for name, value in node.attributes.items():\n            if name in [\n                \"InheritedPropertySheets\",\n                \"RelativePath\",\n                \"AdditionalIncludeDirectories\",\n                \"IntermediateDirectory\",\n                \"OutputDirectory\",\n                \"AdditionalLibraryDirectories\",\n            ]:\n                # We want to fix up these paths\n                path_list = value.split(\";\")\n                new_list = FixFilenames(path_list, os.path.dirname(ARGUMENTS[1]))\n                node.setAttribute(name, \";\".join(new_list))\n            if not value:\n                node.removeAttribute(name)\n\n\ndef CleanupVcproj(node):\n    \"\"\"For each sub node, we call recursively this function.\"\"\"\n    for sub_node in node.childNodes:\n        AbsoluteNode(sub_node)\n        CleanupVcproj(sub_node)\n\n    # Normalize the node, and remove all extraneous whitespaces.\n    for sub_node in node.childNodes:\n        if sub_node.nodeType == Node.TEXT_NODE:\n            sub_node.data = sub_node.data.replace(\"\\r\", \"\")\n            sub_node.data = sub_node.data.replace(\"\\n\", \"\")\n            sub_node.data = sub_node.data.rstrip()\n\n    # Fix all the semicolon separated attributes to be sorted, and we also\n    # remove the dups.\n    if node.attributes:\n        for name, value in node.attributes.items():\n            sorted_list = sorted(value.split(\";\"))\n            unique_list = []\n            for i in sorted_list:\n                if not unique_list.count(i):\n                    unique_list.append(i)\n            node.setAttribute(name, \";\".join(unique_list))\n            if not value:\n                node.removeAttribute(name)\n\n    if node.childNodes:\n        node.normalize()\n\n    # For each node, take a copy, and remove it from the list.\n    node_array = []\n    while node.childNodes and node.childNodes[0]:\n        # Take a copy of the node and remove it from the list.\n        current = node.childNodes[0]\n        node.removeChild(current)\n\n        # If the child is a filter, we want to append all its children\n        # to this same list.\n        if current.nodeName == \"Filter\":\n            node_array.extend(FlattenFilter(current))\n        else:\n            node_array.append(current)\n\n    # Sort the list.\n    node_array.sort(CmpNode())\n\n    # Insert the nodes in the correct order.\n    for new_node in node_array:\n        # But don't append empty tool node.\n        if new_node.nodeName == \"Tool\":\n            if new_node.attributes and new_node.attributes.length == 1:\n                # This one was empty.\n                continue\n        if new_node.nodeName == \"UserMacro\":\n            continue\n        node.appendChild(new_node)\n\n\ndef GetConfigurationNodes(vcproj):\n    # TODO(nsylvain): Find a better way to navigate the xml.\n    nodes = []\n    for node in vcproj.childNodes:\n        if node.nodeName == \"Configurations\":\n            for sub_node in node.childNodes:\n                if sub_node.nodeName == \"Configuration\":\n                    nodes.append(sub_node)\n\n    return nodes\n\n\ndef GetChildrenVsprops(filename):\n    dom = parse(filename)\n    if dom.documentElement.attributes:\n        vsprops = dom.documentElement.getAttribute(\"InheritedPropertySheets\")\n        return FixFilenames(vsprops.split(\";\"), os.path.dirname(filename))\n    return []\n\n\ndef SeekToNode(node1, child2):\n    # A text node does not have properties.\n    if child2.nodeType == Node.TEXT_NODE:\n        return None\n\n    # Get the name of the current node.\n    current_name = child2.getAttribute(\"Name\")\n    if not current_name:\n        # There is no name. We don't know how to merge.\n        return None\n\n    # Look through all the nodes to find a match.\n    for sub_node in node1.childNodes:\n        if sub_node.nodeName == child2.nodeName:\n            name = sub_node.getAttribute(\"Name\")\n            if name == current_name:\n                return sub_node\n\n    # No match. We give up.\n    return None\n\n\ndef MergeAttributes(node1, node2):\n    # No attributes to merge?\n    if not node2.attributes:\n        return\n\n    for name, value2 in node2.attributes.items():\n        # Don't merge the 'Name' attribute.\n        if name == \"Name\":\n            continue\n        value1 = node1.getAttribute(name)\n        if value1:\n            # The attribute exist in the main node. If it's equal, we leave it\n            # untouched, otherwise we concatenate it.\n            if value1 != value2:\n                node1.setAttribute(name, \";\".join([value1, value2]))\n        else:\n            # The attribute does not exist in the main node. We append this one.\n            node1.setAttribute(name, value2)\n\n        # If the attribute was a property sheet attributes, we remove it, since\n        # they are useless.\n        if name == \"InheritedPropertySheets\":\n            node1.removeAttribute(name)\n\n\ndef MergeProperties(node1, node2):\n    MergeAttributes(node1, node2)\n    for child2 in node2.childNodes:\n        child1 = SeekToNode(node1, child2)\n        if child1:\n            MergeProperties(child1, child2)\n        else:\n            node1.appendChild(child2.cloneNode(True))\n\n\ndef main(argv):\n    \"\"\"Main function of this vcproj prettifier.\"\"\"\n    global ARGUMENTS\n    ARGUMENTS = argv\n\n    # check if we have exactly 1 parameter.\n    if len(argv) < 2:\n        print(\n            'Usage: %s \"c:\\\\path\\\\to\\\\vcproj.vcproj\" [key1=value1] '\n            \"[key2=value2]\" % argv[0]\n        )\n        return 1\n\n    # Parse the keys\n    for i in range(2, len(argv)):\n        (key, value) = argv[i].split(\"=\")\n        REPLACEMENTS[key] = value\n\n    # Open the vcproj and parse the xml.\n    dom = parse(argv[1])\n\n    # First thing we need to do is find the Configuration Node and merge them\n    # with the vsprops they include.\n    for configuration_node in GetConfigurationNodes(dom.documentElement):\n        # Get the property sheets associated with this configuration.\n        vsprops = configuration_node.getAttribute(\"InheritedPropertySheets\")\n\n        # Fix the filenames to be absolute.\n        vsprops_list = FixFilenames(\n            vsprops.strip().split(\";\"), os.path.dirname(argv[1])\n        )\n\n        # Extend the list of vsprops with all vsprops contained in the current\n        # vsprops.\n        for current_vsprops in vsprops_list:\n            vsprops_list.extend(GetChildrenVsprops(current_vsprops))\n\n        # Now that we have all the vsprops, we need to merge them.\n        for current_vsprops in vsprops_list:\n            MergeProperties(configuration_node, parse(current_vsprops).documentElement)\n\n    # Now that everything is merged, we need to cleanup the xml.\n    CleanupVcproj(dom.documentElement)\n\n    # Finally, we use the prett xml function to print the vcproj back to the\n    # user.\n    # print dom.toprettyxml(newl=\"\\n\")\n    PrettyPrintNode(dom.documentElement)\n    return 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main(sys.argv))\n"
  },
  {
    "path": "lib/Find-VisualStudio.cs",
    "content": "// Copyright 2017 - Refael Ackermann\n// Distributed under MIT style license\n// See accompanying file LICENSE at https://github.com/node4good/windows-autoconf\n\n// Usage:\n// powershell -ExecutionPolicy Unrestricted -Command \"Add-Type -Path Find-VisualStudio.cs; [VisualStudioConfiguration.Main]::PrintJson()\"\n// This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7.\n\nusing System;\nusing System.Text;\nusing System.Runtime.InteropServices;\nusing System.Collections.Generic;\n\nnamespace VisualStudioConfiguration\n{\n    [Flags]\n    public enum InstanceState : uint\n    {\n        None = 0,\n        Local = 1,\n        Registered = 2,\n        NoRebootRequired = 4,\n        NoErrors = 8,\n        Complete = 4294967295,\n    }\n\n    [Guid(\"6380BCFF-41D3-4B2E-8B2E-BF8A6810C848\")]\n    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n    [ComImport]\n    public interface IEnumSetupInstances\n    {\n\n        void Next([MarshalAs(UnmanagedType.U4), In] int celt,\n            [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface), Out] ISetupInstance[] rgelt,\n            [MarshalAs(UnmanagedType.U4)] out int pceltFetched);\n\n        void Skip([MarshalAs(UnmanagedType.U4), In] int celt);\n\n        void Reset();\n\n        [return: MarshalAs(UnmanagedType.Interface)]\n        IEnumSetupInstances Clone();\n    }\n\n    [Guid(\"42843719-DB4C-46C2-8E7C-64F1816EFD5B\")]\n    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n    [ComImport]\n    public interface ISetupConfiguration\n    {\n    }\n\n    [Guid(\"26AAB78C-4A60-49D6-AF3B-3C35BC93365D\")]\n    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n    [ComImport]\n    public interface ISetupConfiguration2 : ISetupConfiguration\n    {\n\n        [return: MarshalAs(UnmanagedType.Interface)]\n        IEnumSetupInstances EnumInstances();\n\n        [return: MarshalAs(UnmanagedType.Interface)]\n        ISetupInstance GetInstanceForCurrentProcess();\n\n        [return: MarshalAs(UnmanagedType.Interface)]\n        ISetupInstance GetInstanceForPath([MarshalAs(UnmanagedType.LPWStr), In] string path);\n\n        [return: MarshalAs(UnmanagedType.Interface)]\n        IEnumSetupInstances EnumAllInstances();\n    }\n\n    [Guid(\"B41463C3-8866-43B5-BC33-2B0676F7F42E\")]\n    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n    [ComImport]\n    public interface ISetupInstance\n    {\n    }\n\n    [Guid(\"89143C9A-05AF-49B0-B717-72E218A2185C\")]\n    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n    [ComImport]\n    public interface ISetupInstance2 : ISetupInstance\n    {\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetInstanceId();\n\n        [return: MarshalAs(UnmanagedType.Struct)]\n        System.Runtime.InteropServices.ComTypes.FILETIME GetInstallDate();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetInstallationName();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetInstallationPath();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetInstallationVersion();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetDisplayName([MarshalAs(UnmanagedType.U4), In] int lcid);\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetDescription([MarshalAs(UnmanagedType.U4), In] int lcid);\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string ResolvePath([MarshalAs(UnmanagedType.LPWStr), In] string pwszRelativePath);\n\n        [return: MarshalAs(UnmanagedType.U4)]\n        InstanceState GetState();\n\n        [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]\n        ISetupPackageReference[] GetPackages();\n\n        ISetupPackageReference GetProduct();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetProductPath();\n\n        [return: MarshalAs(UnmanagedType.VariantBool)]\n        bool IsLaunchable();\n\n        [return: MarshalAs(UnmanagedType.VariantBool)]\n        bool IsComplete();\n\n        [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]\n        ISetupPropertyStore GetProperties();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetEnginePath();\n    }\n\n    [Guid(\"DA8D8A16-B2B6-4487-A2F1-594CCCCD6BF5\")]\n    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n    [ComImport]\n    public interface ISetupPackageReference\n    {\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetId();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetVersion();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetChip();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetLanguage();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetBranch();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetType();\n\n        [return: MarshalAs(UnmanagedType.BStr)]\n        string GetUniqueId();\n\n        [return: MarshalAs(UnmanagedType.VariantBool)]\n        bool GetIsExtension();\n    }\n\n    [Guid(\"c601c175-a3be-44bc-91f6-4568d230fc83\")]\n    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n    [ComImport]\n    public interface ISetupPropertyStore\n    {\n\n        [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)]\n        string[] GetNames();\n\n        object GetValue([MarshalAs(UnmanagedType.LPWStr), In] string pwszName);\n    }\n\n    [Guid(\"42843719-DB4C-46C2-8E7C-64F1816EFD5B\")]\n    [CoClass(typeof(SetupConfigurationClass))]\n    [ComImport]\n    public interface SetupConfiguration : ISetupConfiguration2, ISetupConfiguration\n    {\n    }\n\n    [Guid(\"177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D\")]\n    [ClassInterface(ClassInterfaceType.None)]\n    [ComImport]\n    public class SetupConfigurationClass\n    {\n    }\n\n    public static class Main\n    {\n        public static void PrintJson()\n        {\n            ISetupConfiguration query = new SetupConfiguration();\n            ISetupConfiguration2 query2 = (ISetupConfiguration2)query;\n            IEnumSetupInstances e = query2.EnumAllInstances();\n\n            int pceltFetched;\n            ISetupInstance2[] rgelt = new ISetupInstance2[1];\n            List<string> instances = new List<string>();\n            while (true)\n            {\n                e.Next(1, rgelt, out pceltFetched);\n                if (pceltFetched <= 0)\n                {\n                    Console.WriteLine(String.Format(\"[{0}]\", string.Join(\",\", instances.ToArray())));\n                    return;\n                }\n\n                try\n                {\n                    instances.Add(InstanceJson(rgelt[0]));\n                }\n                catch (COMException)\n                {\n                    // Ignore instances that can't be queried.\n                }\n            }\n        }\n\n        private static string JsonString(string s)\n        {\n            return \"\\\"\" + s.Replace(\"\\\\\", \"\\\\\\\\\").Replace(\"\\\"\", \"\\\\\\\"\") + \"\\\"\";\n        }\n\n        private static string InstanceJson(ISetupInstance2 setupInstance2)\n        {\n            // Visual Studio component directory:\n            // https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids\n\n            StringBuilder json = new StringBuilder();\n            json.Append(\"{\");\n\n            string path = JsonString(setupInstance2.GetInstallationPath());\n            json.Append(String.Format(\"\\\"path\\\":{0},\", path));\n\n            string version = JsonString(setupInstance2.GetInstallationVersion());\n            json.Append(String.Format(\"\\\"version\\\":{0},\", version));\n\n            List<string> packages = new List<string>();\n            foreach (ISetupPackageReference package in setupInstance2.GetPackages())\n            {\n                string id = JsonString(package.GetId());\n                packages.Add(id);\n            }\n            json.Append(String.Format(\"\\\"packages\\\":[{0}]\", string.Join(\",\", packages.ToArray())));\n\n            json.Append(\"}\");\n            return json.ToString();\n        }\n    }\n}\n"
  },
  {
    "path": "lib/build.js",
    "content": "'use strict'\n\nconst gracefulFs = require('graceful-fs')\nconst fs = gracefulFs.promises\nconst path = require('path')\nconst { glob } = require('tinyglobby')\nconst log = require('./log')\nconst which = require('which')\nconst win = process.platform === 'win32'\n\nasync function build (gyp, argv) {\n  let platformMake = 'make'\n  if (process.platform === 'aix') {\n    platformMake = 'gmake'\n  } else if (process.platform === 'os400') {\n    platformMake = 'gmake'\n  } else if (process.platform.indexOf('bsd') !== -1) {\n    platformMake = 'gmake'\n  } else if (win && argv.length > 0) {\n    argv = argv.map(function (target) {\n      return '/t:' + target\n    })\n  }\n\n  const makeCommand = gyp.opts.make || process.env.MAKE || platformMake\n  let command = win ? 'msbuild' : makeCommand\n  const jobs = gyp.opts.jobs || process.env.JOBS\n  let buildType\n  let config\n  let arch\n  let nodeDir\n  let guessedSolution\n  let python\n  let buildBinsDir\n\n  await loadConfigGypi()\n\n  /**\n   * Load the \"config.gypi\" file that was generated during \"configure\".\n   */\n\n  async function loadConfigGypi () {\n    let data\n    try {\n      const configPath = path.resolve('build', 'config.gypi')\n      data = await fs.readFile(configPath, 'utf8')\n    } catch (err) {\n      if (err.code === 'ENOENT') {\n        throw new Error('You must run `node-gyp configure` first!')\n      } else {\n        throw err\n      }\n    }\n\n    config = JSON.parse(data.replace(/#.+\\n/, ''))\n\n    // get the 'arch', 'buildType', and 'nodeDir' vars from the config\n    buildType = config.target_defaults.default_configuration\n    arch = config.variables.target_arch\n    nodeDir = config.variables.nodedir\n    python = config.variables.python\n\n    if ('debug' in gyp.opts) {\n      buildType = gyp.opts.debug ? 'Debug' : 'Release'\n    }\n    if (!buildType) {\n      buildType = 'Release'\n    }\n\n    log.verbose('build type', buildType)\n    log.verbose('architecture', arch)\n    log.verbose('node dev dir', nodeDir)\n    log.verbose('python', python)\n\n    if (win) {\n      await findSolutionFile()\n    } else {\n      await doWhich()\n    }\n  }\n\n  /**\n   * On Windows, find the first build/*.sln file.\n   */\n\n  async function findSolutionFile () {\n    const files = await glob('build/*.sln', { expandDirectories: false })\n    if (files.length === 0) {\n      if (gracefulFs.existsSync('build/Makefile') ||\n          (await glob('build/*.mk', { expandDirectories: false })).length !== 0) {\n        command = makeCommand\n        await doWhich(false)\n        return\n      } else {\n        throw new Error('Could not find *.sln file or Makefile. Did you run \"configure\"?')\n      }\n    }\n    guessedSolution = files[0]\n    log.verbose('found first Solution file', guessedSolution)\n    await doWhich(true)\n  }\n\n  /**\n   * Uses node-which to locate the msbuild / make executable.\n   */\n\n  async function doWhich (msvs) {\n    // On Windows use msbuild provided by node-gyp configure\n    if (msvs) {\n      if (!config.variables.msbuild_path) {\n        throw new Error('MSBuild is not set, please run `node-gyp configure`.')\n      }\n      command = config.variables.msbuild_path\n      log.verbose('using MSBuild:', command)\n      await doBuild(msvs)\n      return\n    }\n\n    // First make sure we have the build command in the PATH\n    const execPath = await which(command)\n    log.verbose('`which` succeeded for `' + command + '`', execPath)\n    await doBuild(msvs)\n  }\n\n  /**\n   * Actually spawn the process and compile the module.\n   */\n\n  async function doBuild (msvs) {\n    // Enable Verbose build\n    const verbose = log.logger.isVisible('verbose')\n    let j\n\n    if (!msvs && verbose) {\n      argv.push('V=1')\n    }\n\n    if (msvs && !verbose) {\n      argv.push('/clp:Verbosity=minimal')\n    }\n\n    if (msvs) {\n      // Turn off the Microsoft logo on Windows\n      argv.push('/nologo')\n      // No lingering msbuild processes and open file handles\n      argv.push('/nodeReuse:false')\n    }\n\n    // Specify the build type, Release by default\n    if (msvs) {\n      // Convert .gypi config target_arch to MSBuild /Platform\n      // Since there are many ways to state '32-bit Intel', default to it.\n      // N.B. msbuild's Condition string equality tests are case-insensitive.\n      const archLower = arch.toLowerCase()\n      const p = archLower === 'x64'\n        ? 'x64'\n        : (archLower === 'arm'\n            ? 'ARM'\n            : (archLower === 'arm64' ? 'ARM64' : 'Win32'))\n      argv.push('/p:Configuration=' + buildType + ';Platform=' + p)\n      if (jobs) {\n        j = parseInt(jobs, 10)\n        if (!isNaN(j) && j > 0) {\n          argv.push('/m:' + j)\n        } else if (jobs.toUpperCase() === 'MAX') {\n          argv.push('/m:' + require('os').availableParallelism())\n        }\n      }\n    } else {\n      argv.push('BUILDTYPE=' + buildType)\n      // Invoke the Makefile in the 'build' dir.\n      argv.push('-C')\n      argv.push('build')\n      if (jobs) {\n        j = parseInt(jobs, 10)\n        if (!isNaN(j) && j > 0) {\n          argv.push('--jobs')\n          argv.push(j)\n        } else if (jobs.toUpperCase() === 'MAX') {\n          argv.push('--jobs')\n          argv.push(require('os').availableParallelism())\n        }\n      }\n    }\n\n    if (msvs) {\n      // did the user specify their own .sln file?\n      const hasSln = argv.some(function (arg) {\n        return path.extname(arg) === '.sln'\n      })\n      if (!hasSln) {\n        argv.unshift(gyp.opts.solution || guessedSolution)\n      }\n    }\n\n    if (!win) {\n      // Add build-time dependency symlinks (such as Python) to PATH\n      buildBinsDir = path.resolve('build', 'node_gyp_bins')\n      process.env.PATH = `${buildBinsDir}:${process.env.PATH}`\n      await fs.mkdir(buildBinsDir, { recursive: true })\n      const symlinkDestination = path.join(buildBinsDir, 'python3')\n      try {\n        await fs.unlink(symlinkDestination)\n      } catch (err) {\n        if (err.code !== 'ENOENT') throw err\n      }\n      await fs.symlink(python, symlinkDestination)\n      log.verbose('bin symlinks', `created symlink to \"${python}\" in \"${buildBinsDir}\" and added to PATH`)\n    }\n\n    const proc = gyp.spawn(command, argv)\n    await new Promise((resolve, reject) => proc.on('exit', async (code, signal) => {\n      if (buildBinsDir) {\n        // Clean up the build-time dependency symlinks:\n        await fs.rm(buildBinsDir, { recursive: true, maxRetries: 3 })\n      }\n\n      if (code !== 0) {\n        return reject(new Error('`' + command + '` failed with exit code: ' + code))\n      }\n      if (signal) {\n        return reject(new Error('`' + command + '` got signal: ' + signal))\n      }\n      resolve()\n    }))\n  }\n}\n\nmodule.exports = build\nmodule.exports.usage = 'Invokes `' + (win ? 'msbuild' : 'make') + '` and builds the module'\n"
  },
  {
    "path": "lib/clean.js",
    "content": "'use strict'\n\nconst fs = require('graceful-fs').promises\nconst log = require('./log')\n\nasync function clean (gyp, argv) {\n  // Remove the 'build' dir\n  const buildDir = 'build'\n\n  log.verbose('clean', 'removing \"%s\" directory', buildDir)\n  await fs.rm(buildDir, { recursive: true, force: true, maxRetries: 3 })\n}\n\nmodule.exports = clean\nmodule.exports.usage = 'Removes any generated build files and the \"out\" dir'\n"
  },
  {
    "path": "lib/configure.js",
    "content": "'use strict'\n\nconst { promises: fs, readFileSync } = require('graceful-fs')\nconst path = require('path')\nconst log = require('./log')\nconst os = require('os')\nconst processRelease = require('./process-release')\nconst win = process.platform === 'win32'\nconst findNodeDirectory = require('./find-node-directory')\nconst { createConfigGypi } = require('./create-config-gypi')\nconst { format: msgFormat } = require('util')\nconst { findAccessibleSync } = require('./util')\nconst { findPython } = require('./find-python')\nconst { findVisualStudio } = win ? require('./find-visualstudio') : {}\n\nconst majorRe = /^#define NODE_MAJOR_VERSION (\\d+)/m\nconst minorRe = /^#define NODE_MINOR_VERSION (\\d+)/m\nconst patchRe = /^#define NODE_PATCH_VERSION (\\d+)/m\n\nasync function configure (gyp, argv) {\n  const buildDir = path.resolve('build')\n  const configNames = ['config.gypi', 'common.gypi']\n  const configs = []\n  let nodeDir\n  const release = processRelease(argv, gyp, process.version, process.release)\n\n  const python = await findPython(gyp.opts.python)\n  return getNodeDir()\n\n  async function getNodeDir () {\n    // 'python' should be set by now\n    process.env.PYTHON = python\n\n    if (!gyp.opts.nodedir &&\n        process.config.variables.use_prefix_to_find_headers) {\n      // check if the headers can be found using the prefix specified\n      // at build time. Use them if they match the version expected\n      const prefix = process.config.variables.node_prefix\n      let availVersion\n      try {\n        const nodeVersionH = readFileSync(path.join(prefix,\n          'include', 'node', 'node_version.h'), { encoding: 'utf8' })\n        const major = nodeVersionH.match(majorRe)[1]\n        const minor = nodeVersionH.match(minorRe)[1]\n        const patch = nodeVersionH.match(patchRe)[1]\n        availVersion = major + '.' + minor + '.' + patch\n      } catch {}\n      if (availVersion === release.version) {\n        // ok version matches, use the headers\n        gyp.opts.nodedir = prefix\n        log.verbose('using local node headers based on prefix',\n          'setting nodedir to ' + gyp.opts.nodedir)\n      }\n    }\n\n    if (gyp.opts.nodedir) {\n      // --nodedir was specified. use that for the dev files\n      nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir())\n      log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir)\n    } else {\n      // if no --nodedir specified, ensure node dependencies are installed\n      if ('v' + release.version !== process.version) {\n        // if --target was given, then determine a target version to compile for\n        log.verbose('get node dir', 'compiling against --target node version: %s', release.version)\n      } else {\n        // if no --target was specified then use the current host node version\n        log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version)\n      }\n\n      if (!release.semver) {\n        // could not parse the version string with semver\n        throw new Error('Invalid version number: ' + release.version)\n      }\n\n      // If the tarball option is set, always remove and reinstall the headers\n      // into devdir. Otherwise only install if they're not already there.\n      gyp.opts.ensure = !gyp.opts.tarball\n\n      await gyp.commands.install([release.version])\n\n      log.verbose('get node dir', 'target node version installed:', release.versionDir)\n      nodeDir = path.resolve(gyp.devDir, release.versionDir)\n    }\n\n    return createBuildDir()\n  }\n\n  async function createBuildDir () {\n    log.verbose('build dir', 'attempting to create \"build\" dir: %s', buildDir)\n\n    const isNew = await fs.mkdir(buildDir, { recursive: true })\n    log.verbose(\n      'build dir', '\"build\" dir needed to be created?', isNew ? 'Yes' : 'No'\n    )\n    if (win) {\n      let usingMakeGenerator = false\n      for (let i = argv.length - 1; i >= 0; --i) {\n        const arg = argv[i]\n        if (arg === '-f' || arg === '--format') {\n          const format = argv[i + 1]\n          if (typeof format === 'string' && format.startsWith('make')) {\n            usingMakeGenerator = true\n            break\n          }\n        } else if (arg.startsWith('--format=make')) {\n          usingMakeGenerator = true\n          break\n        }\n      }\n      let vsInfo = {}\n      if (!usingMakeGenerator) {\n        vsInfo = await findVisualStudio(release.semver, gyp.opts['msvs-version'])\n      }\n      return createConfigFile(vsInfo)\n    }\n    return createConfigFile(null)\n  }\n\n  async function createConfigFile (vsInfo) {\n    if (win) {\n      process.env.GYP_MSVS_VERSION = Math.min(vsInfo.versionYear, 2015)\n      process.env.GYP_MSVS_OVERRIDE_PATH = vsInfo.path\n    }\n    const configPath = await createConfigGypi({ gyp, buildDir, nodeDir, vsInfo, python })\n    configs.push(configPath)\n    return findConfigs()\n  }\n\n  async function findConfigs () {\n    const name = configNames.shift()\n    if (!name) {\n      return runGyp()\n    }\n\n    const fullPath = path.resolve(name)\n    log.verbose(name, 'checking for gypi file: %s', fullPath)\n    try {\n      await fs.stat(fullPath)\n      log.verbose(name, 'found gypi file')\n      configs.push(fullPath)\n    } catch (err) {\n      // ENOENT will check next gypi filename\n      if (err.code !== 'ENOENT') {\n        throw err\n      }\n    }\n\n    return findConfigs()\n  }\n\n  async function runGyp () {\n    if (!~argv.indexOf('-f') && !~argv.indexOf('--format')) {\n      if (win) {\n        log.verbose('gyp', 'gyp format was not specified; forcing \"msvs\"')\n        // force the 'make' target for non-Windows\n        argv.push('-f', 'msvs')\n      } else {\n        log.verbose('gyp', 'gyp format was not specified; forcing \"make\"')\n        // force the 'make' target for non-Windows\n        argv.push('-f', 'make')\n      }\n    }\n\n    // include all the \".gypi\" files that were found\n    configs.forEach(function (config) {\n      argv.push('-I', config)\n    })\n\n    // For AIX and z/OS we need to set up the path to the exports file\n    // which contains the symbols needed for linking.\n    let nodeExpFile\n    let nodeRootDir\n    let candidates\n    let logprefix = 'find exports file'\n    if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') {\n      const ext = process.platform === 'os390' ? 'x' : 'exp'\n      nodeRootDir = findNodeDirectory()\n\n      if (process.platform === 'aix' || process.platform === 'os400') {\n        candidates = [\n          'include/node/node',\n          'out/Release/node',\n          'out/Debug/node',\n          'node'\n        ].map(function (file) {\n          return file + '.' + ext\n        })\n      } else {\n        candidates = [\n          'out/Release/lib.target/libnode',\n          'out/Debug/lib.target/libnode',\n          'out/Release/obj.target/libnode',\n          'out/Debug/obj.target/libnode',\n          'lib/libnode'\n        ].map(function (file) {\n          return file + '.' + ext\n        })\n      }\n\n      nodeExpFile = findAccessibleSync(logprefix, nodeRootDir, candidates)\n      if (nodeExpFile !== undefined) {\n        log.verbose(logprefix, 'Found exports file: %s', nodeExpFile)\n      } else {\n        const msg = msgFormat('Could not find node.%s file in %s', ext, nodeRootDir)\n        log.error(logprefix, 'Could not find exports file')\n        throw new Error(msg)\n      }\n    }\n\n    // For z/OS we need to set up the path to zoslib include directory,\n    // which contains headers included in v8config.h.\n    let zoslibIncDir\n    if (process.platform === 'os390') {\n      logprefix = \"find zoslib's zos-base.h:\"\n      let msg\n      let zoslibIncPath = process.env.ZOSLIB_INCLUDES\n      if (zoslibIncPath) {\n        zoslibIncPath = findAccessibleSync(logprefix, zoslibIncPath, ['zos-base.h'])\n        if (zoslibIncPath === undefined) {\n          msg = msgFormat('Could not find zos-base.h file in the directory set ' +\n                          'in ZOSLIB_INCLUDES environment variable: %s; set it ' +\n                          'to the correct path, or unset it to search %s', process.env.ZOSLIB_INCLUDES, nodeRootDir)\n        }\n      } else {\n        candidates = [\n          'include/node/zoslib/zos-base.h',\n          'include/zoslib/zos-base.h',\n          'zoslib/include/zos-base.h',\n          'install/include/node/zoslib/zos-base.h'\n        ]\n        zoslibIncPath = findAccessibleSync(logprefix, nodeRootDir, candidates)\n        if (zoslibIncPath === undefined) {\n          msg = msgFormat('Could not find any of %s in directory %s; set ' +\n                          'environmant variable ZOSLIB_INCLUDES to the path ' +\n                          'that contains zos-base.h', candidates.toString(), nodeRootDir)\n        }\n      }\n      if (zoslibIncPath !== undefined) {\n        zoslibIncDir = path.dirname(zoslibIncPath)\n        log.verbose(logprefix, \"Found zoslib's zos-base.h in: %s\", zoslibIncDir)\n      } else if (release.version.split('.')[0] >= 16) {\n        // zoslib is only shipped in Node v16 and above.\n        log.error(logprefix, msg)\n        throw new Error(msg)\n      }\n    }\n\n    // this logic ported from the old `gyp_addon` python file\n    const gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')\n    const addonGypi = path.resolve(__dirname, '..', 'addon.gypi')\n    let commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')\n    try {\n      await fs.stat(commonGypi)\n    } catch (err) {\n      commonGypi = path.resolve(nodeDir, 'common.gypi')\n    }\n\n    let outputDir = 'build'\n    if (win) {\n      // Windows expects an absolute path\n      outputDir = buildDir\n    }\n    const nodeGypDir = path.resolve(__dirname, '..')\n\n    let nodeLibFile = path.join(nodeDir,\n      !gyp.opts.nodedir ? '<(target_arch)' : '$(Configuration)',\n      release.name + '.lib')\n\n    argv.push('-I', addonGypi)\n    argv.push('-I', commonGypi)\n    argv.push('-Dlibrary=shared_library')\n    argv.push('-Dvisibility=default')\n    argv.push('-Dnode_root_dir=' + nodeDir)\n    if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') {\n      argv.push('-Dnode_exp_file=' + nodeExpFile)\n      if (process.platform === 'os390' && zoslibIncDir) {\n        argv.push('-Dzoslib_include_dir=' + zoslibIncDir)\n      }\n    }\n    argv.push('-Dnode_gyp_dir=' + nodeGypDir)\n\n    // Do this to keep Cygwin environments happy, else the unescaped '\\' gets eaten up,\n    // resulting in bad paths, Ex c:parentFolderfolderanotherFolder instead of c:\\parentFolder\\folder\\anotherFolder\n    if (win) {\n      nodeLibFile = nodeLibFile.replace(/\\\\/g, '\\\\\\\\')\n    }\n    argv.push('-Dnode_lib_file=' + nodeLibFile)\n    argv.push('-Dmodule_root_dir=' + process.cwd())\n    argv.push('-Dnode_engine=' +\n        (gyp.opts.node_engine || process.jsEngine || 'v8'))\n    argv.push('--depth=.')\n    argv.push('--no-parallel')\n\n    // tell gyp to write the Makefile/Solution files into output_dir\n    argv.push('--generator-output', outputDir)\n\n    // tell make to write its output into the same dir\n    argv.push('-Goutput_dir=.')\n\n    // enforce use of the \"binding.gyp\" file\n    argv.unshift('binding.gyp')\n\n    // execute `gyp` from the current target nodedir\n    argv.unshift(gypScript)\n\n    // make sure python uses files that came with this particular node package\n    const pypath = [path.join(__dirname, '..', 'gyp', 'pylib')]\n    if (process.env.PYTHONPATH) {\n      pypath.push(process.env.PYTHONPATH)\n    }\n    process.env.PYTHONPATH = pypath.join(win ? ';' : ':')\n\n    await new Promise((resolve, reject) => {\n      const cp = gyp.spawn(python, argv)\n      cp.on('exit', (code) => {\n        if (code !== 0) {\n          reject(new Error('`gyp` failed with exit code: ' + code))\n        } else {\n          // we're done\n          resolve()\n        }\n      })\n    })\n  }\n}\n\nmodule.exports = configure\nmodule.exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module'\n"
  },
  {
    "path": "lib/create-config-gypi.js",
    "content": "'use strict'\n\nconst fs = require('graceful-fs').promises\nconst log = require('./log')\nconst path = require('path')\n\nfunction parseConfigGypi (config) {\n  // translated from tools/js2c.py of Node.js\n  // 1. string comments\n  config = config.replace(/#.*/g, '')\n  // 2. join multiline strings\n  config = config.replace(/'$\\s+'/mg, '')\n  // 3. normalize string literals from ' into \"\n  config = config.replace(/'/g, '\"')\n  return JSON.parse(config)\n}\n\nasync function getBaseConfigGypi ({ gyp, nodeDir }) {\n  // try reading $nodeDir/include/node/config.gypi first when:\n  // 1. --dist-url or --nodedir is specified\n  // 2. and --force-process-config is not specified\n  const useCustomHeaders = gyp.opts.nodedir || gyp.opts.disturl || gyp.opts['dist-url']\n  const shouldReadConfigGypi = useCustomHeaders && !gyp.opts['force-process-config']\n  if (shouldReadConfigGypi && nodeDir) {\n    try {\n      const baseConfigGypiPath = path.resolve(nodeDir, 'include/node/config.gypi')\n      const baseConfigGypi = await fs.readFile(baseConfigGypiPath)\n      return parseConfigGypi(baseConfigGypi.toString())\n    } catch (err) {\n      log.warn('read config.gypi', err.message)\n    }\n  }\n\n  // fallback to process.config if it is invalid\n  return JSON.parse(JSON.stringify(process.config))\n}\n\nasync function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo, python }) {\n  const config = await getBaseConfigGypi({ gyp, nodeDir })\n  if (!config.target_defaults) {\n    config.target_defaults = {}\n  }\n  if (!config.variables) {\n    config.variables = {}\n  }\n\n  const defaults = config.target_defaults\n  const variables = config.variables\n\n  // don't inherit the \"defaults\" from the base config.gypi.\n  // doing so could cause problems in cases where the `node` executable was\n  // compiled on a different machine (with different lib/include paths) than\n  // the machine where the addon is being built to\n  defaults.cflags = []\n  defaults.defines = []\n  defaults.include_dirs = []\n  defaults.libraries = []\n\n  // set the default_configuration prop\n  if ('debug' in gyp.opts) {\n    defaults.default_configuration = gyp.opts.debug ? 'Debug' : 'Release'\n  }\n\n  if (!defaults.default_configuration) {\n    defaults.default_configuration = 'Release'\n  }\n\n  // set the target_arch variable\n  variables.target_arch = gyp.opts.arch || process.arch || 'ia32'\n  if (variables.target_arch === 'arm64') {\n    defaults.msvs_configuration_platform = 'ARM64'\n    defaults.xcode_configuration_platform = 'arm64'\n  }\n\n  // set the node development directory\n  variables.nodedir = nodeDir\n\n  // set the configured Python path\n  variables.python = python\n\n  // disable -T \"thin\" static archives by default\n  variables.standalone_static_library = gyp.opts.thin ? 0 : 1\n\n  if (process.platform === 'win32') {\n    defaults.msbuild_toolset = vsInfo.toolset\n    if (vsInfo.sdk) {\n      defaults.msvs_windows_target_platform_version = vsInfo.sdk\n    }\n    if (variables.target_arch === 'arm64') {\n      if (vsInfo.versionMajor > 15 ||\n          (vsInfo.versionMajor === 15 && vsInfo.versionMajor >= 9)) {\n        defaults.msvs_enable_marmasm = 1\n      } else {\n        log.warn('Compiling ARM64 assembly is only available in\\n' +\n          'Visual Studio 2017 version 15.9 and above')\n      }\n    }\n    variables.msbuild_path = vsInfo.msBuild\n    if (config.variables.clang === 1) {\n      config.variables.clang = 0\n    }\n  }\n\n  // loop through the rest of the opts and add the unknown ones as variables.\n  // this allows for module-specific configure flags like:\n  //\n  //   $ node-gyp configure --shared-libxml2\n  Object.keys(gyp.opts).forEach(function (opt) {\n    if (opt === 'argv') {\n      return\n    }\n    if (opt in gyp.configDefs) {\n      return\n    }\n    variables[opt.replace(/-/g, '_')] = gyp.opts[opt]\n  })\n\n  return config\n}\n\nasync function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo, python }) {\n  const configFilename = 'config.gypi'\n  const configPath = path.resolve(buildDir, configFilename)\n\n  log.verbose('build/' + configFilename, 'creating config file')\n\n  const config = await getCurrentConfigGypi({ gyp, nodeDir, vsInfo, python })\n\n  // ensures that any boolean values in config.gypi get stringified\n  function boolsToString (k, v) {\n    if (typeof v === 'boolean') {\n      return String(v)\n    }\n    return v\n  }\n\n  log.silly('build/' + configFilename, config)\n\n  // now write out the config.gypi file to the build/ dir\n  const prefix = '# Do not edit. File was generated by node-gyp\\'s \"configure\" step'\n\n  const json = JSON.stringify(config, boolsToString, 2)\n  log.verbose('build/' + configFilename, 'writing out config file: %s', configPath)\n  await fs.writeFile(configPath, [prefix, json, ''].join('\\n'))\n\n  return configPath\n}\n\nmodule.exports = {\n  createConfigGypi,\n  parseConfigGypi,\n  getCurrentConfigGypi\n}\n"
  },
  {
    "path": "lib/download.js",
    "content": "const fetch = require('make-fetch-happen')\nconst { promises: fs } = require('graceful-fs')\nconst log = require('./log')\n\nasync function download (gyp, url) {\n  log.http('GET', url)\n\n  const requestOpts = {\n    headers: {\n      'User-Agent': `node-gyp v${gyp.version} (node ${process.version})`,\n      Connection: 'keep-alive'\n    },\n    proxy: gyp.opts.proxy,\n    noProxy: gyp.opts.noproxy\n  }\n\n  const cafile = gyp.opts.cafile\n  if (cafile) {\n    requestOpts.ca = await readCAFile(cafile)\n  }\n\n  const res = await fetch(url, requestOpts)\n  log.http(res.status, res.url)\n\n  return res\n}\n\nasync function readCAFile (filename) {\n  // The CA file can contain multiple certificates so split on certificate\n  // boundaries.  [\\S\\s]*? is used to match everything including newlines.\n  const ca = await fs.readFile(filename, 'utf8')\n  const re = /(-----BEGIN CERTIFICATE-----[\\S\\s]*?-----END CERTIFICATE-----)/g\n  return ca.match(re)\n}\n\nmodule.exports = {\n  download,\n  readCAFile\n}\n"
  },
  {
    "path": "lib/find-node-directory.js",
    "content": "'use strict'\n\nconst path = require('path')\nconst log = require('./log')\n\nfunction findNodeDirectory (scriptLocation, processObj) {\n  // set dirname and process if not passed in\n  // this facilitates regression tests\n  if (scriptLocation === undefined) {\n    scriptLocation = __dirname\n  }\n  if (processObj === undefined) {\n    processObj = process\n  }\n\n  // Have a look to see what is above us, to try and work out where we are\n  const npmParentDirectory = path.join(scriptLocation, '../../../..')\n  log.verbose('node-gyp root', 'npm_parent_directory is ' +\n              path.basename(npmParentDirectory))\n  let nodeRootDir = ''\n\n  log.verbose('node-gyp root', 'Finding node root directory')\n  if (path.basename(npmParentDirectory) === 'deps') {\n    // We are in a build directory where this script lives in\n    // deps/npm/node_modules/node-gyp/lib\n    nodeRootDir = path.join(npmParentDirectory, '..')\n    log.verbose('node-gyp root', 'in build directory, root = ' +\n                nodeRootDir)\n  } else if (path.basename(npmParentDirectory) === 'node_modules') {\n    // We are in a node install directory where this script lives in\n    // lib/node_modules/npm/node_modules/node-gyp/lib or\n    // node_modules/npm/node_modules/node-gyp/lib depending on the\n    // platform\n    if (processObj.platform === 'win32') {\n      nodeRootDir = path.join(npmParentDirectory, '..')\n    } else {\n      nodeRootDir = path.join(npmParentDirectory, '../..')\n    }\n    log.verbose('node-gyp root', 'in install directory, root = ' +\n                nodeRootDir)\n  } else {\n    // We don't know where we are, try working it out from the location\n    // of the node binary\n    const nodeDir = path.dirname(processObj.execPath)\n    const directoryUp = path.basename(nodeDir)\n    if (directoryUp === 'bin') {\n      nodeRootDir = path.join(nodeDir, '..')\n    } else if (directoryUp === 'Release' || directoryUp === 'Debug') {\n      // If we are a recently built node, and the directory structure\n      // is that of a repository. If we are on Windows then we only need\n      // to go one level up, everything else, two\n      if (processObj.platform === 'win32') {\n        nodeRootDir = path.join(nodeDir, '..')\n      } else {\n        nodeRootDir = path.join(nodeDir, '../..')\n      }\n    }\n    // Else return the default blank, \"\".\n  }\n  return nodeRootDir\n}\n\nmodule.exports = findNodeDirectory\n"
  },
  {
    "path": "lib/find-python.js",
    "content": "'use strict'\n\nconst log = require('./log')\nconst semver = require('semver')\nconst { execFile } = require('./util')\nconst win = process.platform === 'win32'\n\nfunction getOsUserInfo () {\n  try {\n    return require('os').userInfo().username\n  } catch {}\n}\n\nconst systemDrive = process.env.SystemDrive || 'C:'\nconst username = process.env.USERNAME || process.env.USER || getOsUserInfo()\nconst localAppData = process.env.LOCALAPPDATA || `${systemDrive}\\\\${username}\\\\AppData\\\\Local`\nconst foundLocalAppData = process.env.LOCALAPPDATA || username\nconst programFiles = process.env.ProgramW6432 || process.env.ProgramFiles || `${systemDrive}\\\\Program Files`\nconst programFilesX86 = process.env['ProgramFiles(x86)'] || `${programFiles} (x86)`\n\nconst winDefaultLocationsArray = []\nfor (const majorMinor of ['311', '310', '39', '38']) {\n  if (foundLocalAppData) {\n    winDefaultLocationsArray.push(\n      `${localAppData}\\\\Programs\\\\Python\\\\Python${majorMinor}\\\\python.exe`,\n      `${programFiles}\\\\Python${majorMinor}\\\\python.exe`,\n      `${localAppData}\\\\Programs\\\\Python\\\\Python${majorMinor}-32\\\\python.exe`,\n      `${programFiles}\\\\Python${majorMinor}-32\\\\python.exe`,\n      `${programFilesX86}\\\\Python${majorMinor}-32\\\\python.exe`\n    )\n  } else {\n    winDefaultLocationsArray.push(\n      `${programFiles}\\\\Python${majorMinor}\\\\python.exe`,\n      `${programFiles}\\\\Python${majorMinor}-32\\\\python.exe`,\n      `${programFilesX86}\\\\Python${majorMinor}-32\\\\python.exe`\n    )\n  }\n}\n\nclass PythonFinder {\n  static findPython = (...args) => new PythonFinder(...args).findPython()\n\n  log = log.withPrefix('find Python')\n  argsExecutable = ['-c', 'import sys; sys.stdout.buffer.write(sys.executable.encode(\\'utf-8\\'));']\n  argsVersion = ['-c', 'import sys; print(\"%s.%s.%s\" % sys.version_info[:3]);']\n  semverRange = '>=3.6.0'\n\n  // These can be overridden for testing:\n  execFile = execFile\n  env = process.env\n  win = win\n  pyLauncher = 'py.exe'\n  winDefaultLocations = winDefaultLocationsArray\n\n  constructor (configPython) {\n    this.configPython = configPython\n    this.errorLog = []\n  }\n\n  // Logs a message at verbose level, but also saves it to be displayed later\n  // at error level if an error occurs. This should help diagnose the problem.\n  addLog (message) {\n    this.log.verbose(message)\n    this.errorLog.push(message)\n  }\n\n  // Find Python by trying a sequence of possibilities.\n  // Ignore errors, keep trying until Python is found.\n  async findPython () {\n    const SKIP = 0\n    const FAIL = 1\n    const toCheck = (() => {\n      if (this.env.NODE_GYP_FORCE_PYTHON) {\n        return [{\n          before: () => {\n            this.addLog(\n              'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')\n            this.addLog('- process.env.NODE_GYP_FORCE_PYTHON is ' +\n              `\"${this.env.NODE_GYP_FORCE_PYTHON}\"`)\n          },\n          check: () => this.checkCommand(this.env.NODE_GYP_FORCE_PYTHON)\n        }]\n      }\n\n      const checks = [\n        {\n          before: () => {\n            if (!this.configPython) {\n              this.addLog('--python was not set on the command line')\n              return SKIP\n            }\n            this.addLog(`--python=${this.configPython} was set on the command line`)\n          },\n          check: () => this.checkCommand(this.configPython)\n        },\n        {\n          before: () => {\n            if (!this.env.PYTHON) {\n              this.addLog('Python is not set from environment variable ' +\n                'PYTHON')\n              return SKIP\n            }\n            this.addLog('checking Python explicitly set from environment ' +\n              'variable PYTHON')\n            this.addLog(`- process.env.PYTHON is \"${this.env.PYTHON}\"`)\n          },\n          check: () => this.checkCommand(this.env.PYTHON)\n        }\n      ]\n\n      if (this.win) {\n        checks.push({\n          before: () => {\n            this.addLog(\n              'checking if the py launcher can be used to find Python 3')\n          },\n          check: () => this.checkPyLauncher()\n        })\n      }\n\n      checks.push(...[\n        {\n          before: () => { this.addLog('checking if \"python3\" can be used') },\n          check: () => this.checkCommand('python3')\n        },\n        {\n          before: () => { this.addLog('checking if \"python\" can be used') },\n          check: () => this.checkCommand('python')\n        }\n      ])\n\n      if (this.win) {\n        for (let i = 0; i < this.winDefaultLocations.length; ++i) {\n          const location = this.winDefaultLocations[i]\n          checks.push({\n            before: () => this.addLog(`checking if Python is ${location}`),\n            check: () => this.checkExecPath(location)\n          })\n        }\n      }\n\n      return checks\n    })()\n\n    for (const check of toCheck) {\n      const before = check.before()\n      if (before === SKIP) {\n        continue\n      }\n      if (before === FAIL) {\n        return this.fail()\n      }\n      try {\n        return await check.check()\n      } catch (err) {\n        this.log.silly('runChecks: err = %j', (err && err.stack) || err)\n      }\n    }\n\n    return this.fail()\n  }\n\n  // Check if command is a valid Python to use.\n  // Will exit the Python finder on success.\n  // If on Windows, run in a CMD shell to support BAT/CMD launchers.\n  async checkCommand (command) {\n    let exec = command\n    let args = this.argsExecutable\n    let shell = false\n    if (this.win) {\n      // Arguments have to be manually quoted\n      exec = `\"${exec}\"`\n      args = args.map(a => `\"${a}\"`)\n      shell = true\n    }\n\n    this.log.verbose(`- executing \"${command}\" to get executable path`)\n    // Possible outcomes:\n    // - Error: not in PATH, not executable or execution fails\n    // - Gibberish: the next command to check version will fail\n    // - Absolute path to executable\n    try {\n      const execPath = await this.run(exec, args, shell)\n      this.addLog(`- executable path is \"${execPath}\"`)\n      return this.checkExecPath(execPath)\n    } catch (err) {\n      this.addLog(`- \"${command}\" is not in PATH or produced an error`)\n      throw err\n    }\n  }\n\n  // Check if the py launcher can find a valid Python to use.\n  // Will exit the Python finder on success.\n  // Distributions of Python on Windows by default install with the \"py.exe\"\n  // Python launcher which is more likely to exist than the Python executable\n  // being in the $PATH.\n  // Because the Python launcher supports Python 2 and Python 3, we should\n  // explicitly request a Python 3 version. This is done by supplying \"-3\" as\n  // the first command line argument. Since \"py.exe -3\" would be an invalid\n  // executable for \"execFile\", we have to use the launcher to figure out\n  // where the actual \"python.exe\" executable is located.\n  async checkPyLauncher () {\n    this.log.verbose(`- executing \"${this.pyLauncher}\" to get Python 3 executable path`)\n    // Possible outcomes: same as checkCommand\n    try {\n      const execPath = await this.run(this.pyLauncher, ['-3', ...this.argsExecutable], false)\n      this.addLog(`- executable path is \"${execPath}\"`)\n      return this.checkExecPath(execPath)\n    } catch (err) {\n      this.addLog(`- \"${this.pyLauncher}\" is not in PATH or produced an error`)\n      throw err\n    }\n  }\n\n  // Check if a Python executable is the correct version to use.\n  // Will exit the Python finder on success.\n  async checkExecPath (execPath) {\n    this.log.verbose(`- executing \"${execPath}\" to get version`)\n    // Possible outcomes:\n    // - Error: executable can not be run (likely meaning the command wasn't\n    //   a Python executable and the previous command produced gibberish)\n    // - Gibberish: somehow the last command produced an executable path,\n    //   this will fail when verifying the version\n    // - Version of the Python executable\n    try {\n      const version = await this.run(execPath, this.argsVersion, false)\n      this.addLog(`- version is \"${version}\"`)\n\n      const range = new semver.Range(this.semverRange)\n      let valid = false\n      try {\n        valid = range.test(version)\n      } catch (err) {\n        this.log.silly('range.test() threw:\\n%s', err.stack)\n        this.addLog(`- \"${execPath}\" does not have a valid version`)\n        this.addLog('- is it a Python executable?')\n        throw err\n      }\n      if (!valid) {\n        this.addLog(`- version is ${version} - should be ${this.semverRange}`)\n        this.addLog('- THIS VERSION OF PYTHON IS NOT SUPPORTED')\n        throw new Error(`Found unsupported Python version ${version}`)\n      }\n      return this.succeed(execPath, version)\n    } catch (err) {\n      this.addLog(`- \"${execPath}\" could not be run`)\n      throw err\n    }\n  }\n\n  // Run an executable or shell command, trimming the output.\n  async run (exec, args, shell) {\n    const env = Object.assign({}, this.env)\n    env.TERM = 'dumb'\n    const opts = { env, shell }\n\n    this.log.silly('execFile: exec = %j', exec)\n    this.log.silly('execFile: args = %j', args)\n    this.log.silly('execFile: opts = %j', opts)\n    try {\n      const [err, stdout, stderr] = await this.execFile(exec, args, opts)\n      this.log.silly('execFile result: err = %j', (err && err.stack) || err)\n      this.log.silly('execFile result: stdout = %j', stdout)\n      this.log.silly('execFile result: stderr = %j', stderr)\n      return stdout.trim()\n    } catch (err) {\n      this.log.silly('execFile: threw:\\n%s', err.stack)\n      throw err\n    }\n  }\n\n  succeed (execPath, version) {\n    this.log.info(`using Python version ${version} found at \"${execPath}\"`)\n    return execPath\n  }\n\n  fail () {\n    const errorLog = this.errorLog.join('\\n')\n\n    const pathExample = this.win\n      ? 'C:\\\\Path\\\\To\\\\python.exe'\n      : '/path/to/pythonexecutable'\n    // For Windows 80 col console, use up to the column before the one marked\n    // with X (total 79 chars including logger prefix, 58 chars usable here):\n    //                                                           X\n    const info = [\n      '**********************************************************',\n      'You need to install the latest version of Python.',\n      'Node-gyp should be able to find and use Python. If not,',\n      'you can try one of the following options:',\n      `- Use the switch --python=\"${pathExample}\"`,\n      '  (accepted by both node-gyp and npm)',\n      '- Set the environment variable PYTHON',\n      'For more information consult the documentation at:',\n      'https://github.com/nodejs/node-gyp#installation',\n      '**********************************************************'\n    ].join('\\n')\n\n    this.log.error(`\\n${errorLog}\\n\\n${info}\\n`)\n    throw new Error('Could not find any Python installation to use')\n  }\n}\n\nmodule.exports = PythonFinder\n"
  },
  {
    "path": "lib/find-visualstudio.js",
    "content": "'use strict'\n\nconst log = require('./log')\nconst { existsSync } = require('fs')\nconst { win32: path } = require('path')\nconst { regSearchKeys, execFile } = require('./util')\n\nclass VisualStudioFinder {\n  static findVisualStudio = (...args) => new VisualStudioFinder(...args).findVisualStudio()\n\n  log = log.withPrefix('find VS')\n\n  regSearchKeys = regSearchKeys\n\n  constructor (nodeSemver, configMsvsVersion) {\n    this.nodeSemver = nodeSemver\n    this.configMsvsVersion = configMsvsVersion\n    this.errorLog = []\n    this.validVersions = []\n  }\n\n  // Logs a message at verbose level, but also saves it to be displayed later\n  // at error level if an error occurs. This should help diagnose the problem.\n  addLog (message) {\n    this.log.verbose(message)\n    this.errorLog.push(message)\n  }\n\n  async findVisualStudio () {\n    this.configVersionYear = null\n    this.configPath = null\n    if (this.configMsvsVersion) {\n      this.addLog(`--msvs_version=${this.configMsvsVersion} was set on the command line`)\n      if (this.configMsvsVersion.match(/^\\d{4}$/)) {\n        this.configVersionYear = parseInt(this.configMsvsVersion, 10)\n        this.addLog(\n          `- looking for Visual Studio version ${this.configVersionYear}`)\n      } else {\n        this.configPath = path.resolve(this.configMsvsVersion)\n        this.addLog(\n          `- looking for Visual Studio installed in \"${this.configPath}\"`)\n      }\n    } else {\n      this.addLog('--msvs_version was not set on the command line')\n    }\n\n    if (process.env.VCINSTALLDIR) {\n      this.envVcInstallDir =\n        path.resolve(process.env.VCINSTALLDIR, '..')\n      this.addLog('running in VS Command Prompt, installation path is:\\n' +\n        `\"${this.envVcInstallDir}\"\\n- will only use this version`)\n    } else {\n      this.addLog('VCINSTALLDIR not set, not running in VS Command Prompt')\n    }\n\n    const checks = [\n      () => this.findVisualStudio2019OrNewerFromSpecifiedLocation(),\n      () => this.findVisualStudio2019OrNewerUsingSetupModule(),\n      () => this.findVisualStudio2019OrNewer(),\n      () => this.findVisualStudio2017FromSpecifiedLocation(),\n      () => this.findVisualStudio2017UsingSetupModule(),\n      () => this.findVisualStudio2017(),\n      () => this.findVisualStudio2015(),\n      () => this.findVisualStudio2013()\n    ]\n\n    for (const check of checks) {\n      const info = await check()\n      if (info) {\n        return this.succeed(info)\n      }\n    }\n\n    return this.fail()\n  }\n\n  succeed (info) {\n    this.log.info(`using VS${info.versionYear} (${info.version}) found at:` +\n                  `\\n\"${info.path}\"` +\n                  '\\nrun with --verbose for detailed information')\n    return info\n  }\n\n  fail () {\n    if (this.configMsvsVersion && this.envVcInstallDir) {\n      this.errorLog.push(\n        'msvs_version does not match this VS Command Prompt or the',\n        'installation cannot be used.')\n    } else if (this.configMsvsVersion) {\n      // If msvs_version was specified but finding VS failed, print what would\n      // have been accepted\n      this.errorLog.push('')\n      if (this.validVersions) {\n        this.errorLog.push('valid versions for msvs_version:')\n        this.validVersions.forEach((version) => {\n          this.errorLog.push(`- \"${version}\"`)\n        })\n      } else {\n        this.errorLog.push('no valid versions for msvs_version were found')\n      }\n    }\n\n    const errorLog = this.errorLog.join('\\n')\n\n    // For Windows 80 col console, use up to the column before the one marked\n    // with X (total 79 chars including logger prefix, 62 chars usable here):\n    //                                                               X\n    const infoLog = [\n      '**************************************************************',\n      'You need to install the latest version of Visual Studio',\n      'including the \"Desktop development with C++\" workload.',\n      'For more information consult the documentation at:',\n      'https://github.com/nodejs/node-gyp#on-windows',\n      '**************************************************************'\n    ].join('\\n')\n\n    this.log.error(`\\n${errorLog}\\n\\n${infoLog}\\n`)\n    throw new Error('Could not find any Visual Studio installation to use')\n  }\n\n  async findVisualStudio2019OrNewerFromSpecifiedLocation () {\n    return this.findVSFromSpecifiedLocation([2019, 2022, 2026])\n  }\n\n  async findVisualStudio2017FromSpecifiedLocation () {\n    if (this.nodeSemver.major >= 22) {\n      this.addLog(\n        'not looking for VS2017 as it is only supported up to Node.js 21')\n      return null\n    }\n    return this.findVSFromSpecifiedLocation([2017])\n  }\n\n  async findVSFromSpecifiedLocation (supportedYears) {\n    if (!this.envVcInstallDir) {\n      return null\n    }\n    const info = {\n      path: path.resolve(this.envVcInstallDir),\n      // Assume the version specified by the user is correct.\n      // Since Visual Studio 2015, the Developer Command Prompt sets the\n      // VSCMD_VER environment variable which contains the version information\n      // for Visual Studio.\n      // https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022\n      version: process.env.VSCMD_VER,\n      packages: [\n        'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',\n        'Microsoft.VisualStudio.Component.VC.Tools.ARM64',\n        // Assume MSBuild exists. It will be checked in processing.\n        'Microsoft.VisualStudio.VC.MSBuild.Base'\n      ]\n    }\n\n    // Is there a better way to get SDK information?\n    const envWindowsSDKVersion = process.env.WindowsSDKVersion\n    const sdkVersionMatched = envWindowsSDKVersion?.match(/^(\\d+)\\.(\\d+)\\.(\\d+)\\..*/)\n    if (sdkVersionMatched) {\n      info.packages.push(`Microsoft.VisualStudio.Component.Windows10SDK.${sdkVersionMatched[3]}.Desktop`)\n    }\n    // pass for further processing\n    return this.processData([info], supportedYears)\n  }\n\n  async findVisualStudio2019OrNewerUsingSetupModule () {\n    return this.findNewVSUsingSetupModule([2019, 2022, 2026])\n  }\n\n  async findVisualStudio2017UsingSetupModule () {\n    if (this.nodeSemver.major >= 22) {\n      this.addLog(\n        'not looking for VS2017 as it is only supported up to Node.js 21')\n      return null\n    }\n    return this.findNewVSUsingSetupModule([2017])\n  }\n\n  async findNewVSUsingSetupModule (supportedYears) {\n    const ps = path.join(process.env.SystemRoot, 'System32',\n      'WindowsPowerShell', 'v1.0', 'powershell.exe')\n    const vcInstallDir = this.envVcInstallDir\n\n    const checkModuleArgs = [\n      '-NoProfile',\n      '-Command',\n      '&{@(Get-Module -ListAvailable -Name VSSetup).Version.ToString()}'\n    ]\n    this.log.silly('Running', ps, checkModuleArgs)\n    const [cErr] = await this.execFile(ps, checkModuleArgs)\n    if (cErr) {\n      this.addLog('VSSetup module doesn\\'t seem to exist. You can install it via: \"Install-Module VSSetup -Scope CurrentUser\"')\n      this.log.silly('VSSetup error = %j', cErr && (cErr.stack || cErr))\n      return null\n    }\n    const filterArg = vcInstallDir !== undefined ? `| where {$_.InstallationPath -eq '${vcInstallDir}' }` : ''\n    const psArgs = [\n      '-NoProfile',\n      '-Command',\n      `&{Get-VSSetupInstance ${filterArg} | ConvertTo-Json -Depth 3}`\n    ]\n\n    this.log.silly('Running', ps, psArgs)\n    const [err, stdout, stderr] = await this.execFile(ps, psArgs)\n    let parsedData = this.parseData(err, stdout, stderr)\n    if (parsedData === null) {\n      return null\n    }\n    this.log.silly('Parsed data', parsedData)\n    if (!Array.isArray(parsedData)) {\n      // if there are only 1 result, then Powershell will output non-array\n      parsedData = [parsedData]\n    }\n    // normalize output\n    parsedData = parsedData.map((info) => {\n      info.path = info.InstallationPath\n      info.version = `${info.InstallationVersion.Major}.${info.InstallationVersion.Minor}.${info.InstallationVersion.Build}.${info.InstallationVersion.Revision}`\n      info.packages = info.Packages.map((p) => p.Id)\n      return info\n    })\n    // pass for further processing\n    return this.processData(parsedData, supportedYears)\n  }\n\n  // Invoke the PowerShell script to get information about Visual Studio 2019\n  // or newer installations\n  async findVisualStudio2019OrNewer () {\n    return this.findNewVS([2019, 2022, 2026])\n  }\n\n  // Invoke the PowerShell script to get information about Visual Studio 2017\n  async findVisualStudio2017 () {\n    if (this.nodeSemver.major >= 22) {\n      this.addLog(\n        'not looking for VS2017 as it is only supported up to Node.js 21')\n      return null\n    }\n    return this.findNewVS([2017])\n  }\n\n  // Invoke the PowerShell script to get information about Visual Studio 2017\n  // or newer installations\n  async findNewVS (supportedYears) {\n    const ps = path.join(process.env.SystemRoot, 'System32',\n      'WindowsPowerShell', 'v1.0', 'powershell.exe')\n    const csFile = path.join(__dirname, 'Find-VisualStudio.cs')\n    const psArgs = [\n      '-ExecutionPolicy',\n      'Unrestricted',\n      '-NoProfile',\n      '-Command',\n      '&{Add-Type -IgnoreWarnings -Path \\'' + csFile + '\\';' + '[VisualStudioConfiguration.Main]::PrintJson()}'\n    ]\n\n    this.log.silly('Running', ps, psArgs)\n    const [err, stdout, stderr] = await this.execFile(ps, psArgs)\n    const parsedData = this.parseData(err, stdout, stderr, { checkIsArray: true })\n    if (parsedData === null) {\n      return null\n    }\n    return this.processData(parsedData, supportedYears)\n  }\n\n  // Parse the output of the PowerShell script, make sanity checks\n  parseData (err, stdout, stderr, sanityCheckOptions) {\n    const defaultOptions = {\n      checkIsArray: false\n    }\n\n    // Merging provided options with the default options\n    const sanityOptions = { ...defaultOptions, ...sanityCheckOptions }\n\n    this.log.silly('PS stderr = %j', stderr)\n\n    const failPowershell = (failureDetails) => {\n      this.addLog(\n        `could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. \\n\n        Failure details: ${failureDetails}`)\n      return null\n    }\n\n    if (err) {\n      this.log.silly('PS err = %j', err && (err.stack || err))\n      return failPowershell(`${err}`.substring(0, 40))\n    }\n\n    let vsInfo\n    try {\n      vsInfo = JSON.parse(stdout)\n    } catch (e) {\n      this.log.silly('PS stdout = %j', stdout)\n      this.log.silly(e)\n      return failPowershell()\n    }\n\n    if (sanityOptions.checkIsArray && !Array.isArray(vsInfo)) {\n      this.log.silly('PS stdout = %j', stdout)\n      return failPowershell('Expected array as output of the PS script')\n    }\n    return vsInfo\n  }\n\n  // Process parsed data containing information about VS installations\n  // Look for the required parts, extract and output them back\n  processData (vsInfo, supportedYears) {\n    vsInfo = vsInfo.map((info) => {\n      this.log.silly(`processing installation: \"${info.path}\"`)\n      info.path = path.resolve(info.path)\n      const ret = this.getVersionInfo(info)\n      ret.path = info.path\n      ret.msBuild = this.getMSBuild(info, ret.versionYear)\n      ret.toolset = this.getToolset(info, ret.versionYear)\n      ret.sdk = this.getSDK(info)\n      return ret\n    })\n    this.log.silly('vsInfo:', vsInfo)\n\n    // Remove future versions or errors parsing version number\n    // Also remove any unsupported versions\n    vsInfo = vsInfo.filter((info) => {\n      if (info.versionYear && supportedYears.indexOf(info.versionYear) !== -1) {\n        return true\n      }\n      this.addLog(`${info.versionYear ? 'unsupported' : 'unknown'} version \"${info.version}\" found at \"${info.path}\"`)\n      return false\n    })\n\n    // Sort to place newer versions first\n    vsInfo.sort((a, b) => b.versionYear - a.versionYear)\n\n    for (let i = 0; i < vsInfo.length; ++i) {\n      const info = vsInfo[i]\n      this.addLog(`checking VS${info.versionYear} (${info.version}) found ` +\n                  `at:\\n\"${info.path}\"`)\n\n      if (info.msBuild) {\n        this.addLog('- found \"Visual Studio C++ core features\"')\n      } else {\n        this.addLog('- \"Visual Studio C++ core features\" missing')\n        continue\n      }\n\n      if (info.toolset) {\n        this.addLog(`- found VC++ toolset: ${info.toolset}`)\n      } else {\n        this.addLog('- missing any VC++ toolset')\n        continue\n      }\n\n      if (info.sdk) {\n        this.addLog(`- found Windows SDK: ${info.sdk}`)\n      } else {\n        this.addLog('- missing any Windows SDK')\n        continue\n      }\n\n      if (!this.checkConfigVersion(info.versionYear, info.path)) {\n        continue\n      }\n\n      return info\n    }\n\n    this.addLog(\n      'could not find a version of Visual Studio 2017 or newer to use')\n    return null\n  }\n\n  // Helper - process version information\n  getVersionInfo (info) {\n    const match = /^(\\d+)\\.(\\d+)(?:\\..*)?/.exec(info.version)\n    if (!match) {\n      this.log.silly('- failed to parse version:', info.version)\n      return {}\n    }\n    this.log.silly('- version match = %j', match)\n    const ret = {\n      version: info.version,\n      versionMajor: parseInt(match[1], 10),\n      versionMinor: parseInt(match[2], 10)\n    }\n    if (ret.versionMajor === 15) {\n      ret.versionYear = 2017\n      return ret\n    }\n    if (ret.versionMajor === 16) {\n      ret.versionYear = 2019\n      return ret\n    }\n    if (ret.versionMajor === 17) {\n      ret.versionYear = 2022\n      return ret\n    }\n    if (ret.versionMajor === 18) {\n      ret.versionYear = 2026\n      return ret\n    }\n    this.log.silly('- unsupported version:', ret.versionMajor)\n    return {}\n  }\n\n  msBuildPathExists (path) {\n    return existsSync(path)\n  }\n\n  // Helper - process MSBuild information\n  getMSBuild (info, versionYear) {\n    const pkg = 'Microsoft.VisualStudio.VC.MSBuild.Base'\n    const msbuildPath = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe')\n    const msbuildPathArm64 = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'arm64', 'MSBuild.exe')\n    if (info.packages.indexOf(pkg) !== -1) {\n      this.log.silly('- found VC.MSBuild.Base')\n      if (versionYear === 2017) {\n        return path.join(info.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe')\n      }\n      if (versionYear === 2019) {\n        if (process.arch === 'arm64' && this.msBuildPathExists(msbuildPathArm64)) {\n          return msbuildPathArm64\n        } else {\n          return msbuildPath\n        }\n      }\n    }\n    /**\n     * Visual Studio 2022 doesn't have the MSBuild package.\n     * Support for compiling _on_ ARM64 was added in MSVC 14.32.31326,\n     * so let's leverage it if the user has an ARM64 device.\n     */\n    if (process.arch === 'arm64' && this.msBuildPathExists(msbuildPathArm64)) {\n      return msbuildPathArm64\n    } else if (this.msBuildPathExists(msbuildPath)) {\n      return msbuildPath\n    }\n    return null\n  }\n\n  // Helper - process toolset information\n  getToolset (info, versionYear) {\n    const vcToolsArm64 = 'VC.Tools.ARM64'\n    const pkgArm64 = `Microsoft.VisualStudio.Component.${vcToolsArm64}`\n    const vcToolsX64 = 'VC.Tools.x86.x64'\n    const pkgX64 = `Microsoft.VisualStudio.Component.${vcToolsX64}`\n    const express = 'Microsoft.VisualStudio.WDExpress'\n\n    if (process.arch === 'arm64' && info.packages.includes(pkgArm64)) {\n      this.log.silly(`- found ${vcToolsArm64}`)\n    } else if (info.packages.includes(pkgX64)) {\n      if (process.arch === 'arm64') {\n        this.addLog(`- found ${vcToolsX64} on ARM64 platform. Expect less performance and/or link failure with ARM64 binary.`)\n      } else {\n        this.log.silly(`- found ${vcToolsX64}`)\n      }\n    } else if (info.packages.includes(express)) {\n      this.log.silly('- found Visual Studio Express (looking for toolset)')\n    } else {\n      return null\n    }\n\n    if (versionYear === 2017) {\n      return 'v141'\n    } else if (versionYear === 2019) {\n      return 'v142'\n    } else if (versionYear === 2022) {\n      return 'v143'\n    } else if (versionYear === 2026) {\n      return 'v145'\n    }\n    this.log.silly('- invalid versionYear:', versionYear)\n    return null\n  }\n\n  // Helper - process Windows SDK information\n  getSDK (info) {\n    const win8SDK = 'Microsoft.VisualStudio.Component.Windows81SDK'\n    const win10SDKPrefix = 'Microsoft.VisualStudio.Component.Windows10SDK.'\n    const win11SDKPrefix = 'Microsoft.VisualStudio.Component.Windows11SDK.'\n\n    let Win10or11SDKVer = 0\n    info.packages.forEach((pkg) => {\n      if (!pkg.startsWith(win10SDKPrefix) && !pkg.startsWith(win11SDKPrefix)) {\n        return\n      }\n      const parts = pkg.split('.')\n      if (parts.length > 5 && parts[5] !== 'Desktop') {\n        this.log.silly('- ignoring non-Desktop Win10/11SDK:', pkg)\n        return\n      }\n      const foundSdkVer = parseInt(parts[4], 10)\n      if (isNaN(foundSdkVer)) {\n        // Microsoft.VisualStudio.Component.Windows10SDK.IpOverUsb\n        this.log.silly('- failed to parse Win10/11SDK number:', pkg)\n        return\n      }\n      this.log.silly('- found Win10/11SDK:', foundSdkVer)\n      Win10or11SDKVer = Math.max(Win10or11SDKVer, foundSdkVer)\n    })\n\n    if (Win10or11SDKVer !== 0) {\n      return `10.0.${Win10or11SDKVer}.0`\n    } else if (info.packages.indexOf(win8SDK) !== -1) {\n      this.log.silly('- found Win8SDK')\n      return '8.1'\n    }\n    return null\n  }\n\n  // Find an installation of Visual Studio 2015 to use\n  async findVisualStudio2015 () {\n    if (this.nodeSemver.major >= 19) {\n      this.addLog(\n        'not looking for VS2015 as it is only supported up to Node.js 18')\n      return null\n    }\n    return this.findOldVS({\n      version: '14.0',\n      versionMajor: 14,\n      versionMinor: 0,\n      versionYear: 2015,\n      toolset: 'v140'\n    })\n  }\n\n  // Find an installation of Visual Studio 2013 to use\n  async findVisualStudio2013 () {\n    if (this.nodeSemver.major >= 9) {\n      this.addLog(\n        'not looking for VS2013 as it is only supported up to Node.js 8')\n      return null\n    }\n    return this.findOldVS({\n      version: '12.0',\n      versionMajor: 12,\n      versionMinor: 0,\n      versionYear: 2013,\n      toolset: 'v120'\n    })\n  }\n\n  // Helper - common code for VS2013 and VS2015\n  async findOldVS (info) {\n    const regVC7 = ['HKLM\\\\Software\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7',\n      'HKLM\\\\Software\\\\Wow6432Node\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7']\n    const regMSBuild = 'HKLM\\\\Software\\\\Microsoft\\\\MSBuild\\\\ToolsVersions'\n\n    this.addLog(`looking for Visual Studio ${info.versionYear}`)\n    try {\n      let res = await this.regSearchKeys(regVC7, info.version, [])\n      const vsPath = path.resolve(res, '..')\n      this.addLog(`- found in \"${vsPath}\"`)\n      const msBuildRegOpts = process.arch === 'ia32' ? [] : ['/reg:32']\n\n      try {\n        res = await this.regSearchKeys([`${regMSBuild}\\\\${info.version}`], 'MSBuildToolsPath', msBuildRegOpts)\n      } catch (err) {\n        this.addLog('- could not find MSBuild in registry for this version')\n        return null\n      }\n\n      const msBuild = path.join(res, 'MSBuild.exe')\n      this.addLog(`- MSBuild in \"${msBuild}\"`)\n\n      if (!this.checkConfigVersion(info.versionYear, vsPath)) {\n        return null\n      }\n\n      info.path = vsPath\n      info.msBuild = msBuild\n      info.sdk = null\n      return info\n    } catch (err) {\n      this.addLog('- not found')\n      return null\n    }\n  }\n\n  // After finding a usable version of Visual Studio:\n  // - add it to validVersions to be displayed at the end if a specific\n  //   version was requested and not found;\n  // - check if this is the version that was requested.\n  // - check if this matches the Visual Studio Command Prompt\n  checkConfigVersion (versionYear, vsPath) {\n    this.validVersions.push(versionYear)\n    this.validVersions.push(vsPath)\n\n    if (this.configVersionYear && this.configVersionYear !== versionYear) {\n      this.addLog('- msvs_version does not match this version')\n      return false\n    }\n    if (this.configPath &&\n        path.relative(this.configPath, vsPath) !== '') {\n      this.addLog('- msvs_version does not point to this installation')\n      return false\n    }\n    if (this.envVcInstallDir &&\n        path.relative(this.envVcInstallDir, vsPath) !== '') {\n      this.addLog('- does not match this Visual Studio Command Prompt')\n      return false\n    }\n\n    return true\n  }\n\n  async execFile (exec, args) {\n    return await execFile(exec, args, { encoding: 'utf8' })\n  }\n}\n\nmodule.exports = VisualStudioFinder\n"
  },
  {
    "path": "lib/install.js",
    "content": "'use strict'\n\nconst { createWriteStream, promises: fs } = require('graceful-fs')\nconst os = require('os')\nconst { backOff } = require('exponential-backoff')\nconst tar = require('tar')\nconst path = require('path')\nconst { Transform, promises: { pipeline } } = require('stream')\nconst crypto = require('crypto')\nconst log = require('./log')\nconst semver = require('semver')\nconst { download } = require('./download')\nconst processRelease = require('./process-release')\n\nconst win = process.platform === 'win32'\n\nasync function install (gyp, argv) {\n  log.stdout()\n  const release = processRelease(argv, gyp, process.version, process.release)\n  // Detecting target_arch based on logic from create-cnfig-gyp.js. Used on Windows only.\n  const arch = win ? (gyp.opts.target_arch || gyp.opts.arch || process.arch || 'ia32') : ''\n  // Used to prevent downloading tarball if only new node.lib is required on Windows.\n  let shouldDownloadTarball = true\n\n  // Determine which node dev files version we are installing\n  log.verbose('install', 'input version string %j', release.version)\n\n  if (!release.semver) {\n    // could not parse the version string with semver\n    throw new Error('Invalid version number: ' + release.version)\n  }\n\n  if (semver.lt(release.version, '0.8.0')) {\n    throw new Error('Minimum target version is `0.8.0` or greater. Got: ' + release.version)\n  }\n\n  // 0.x.y-pre versions are not published yet and cannot be installed. Bail.\n  if (release.semver.prerelease[0] === 'pre') {\n    log.verbose('detected \"pre\" node version', release.version)\n    if (!gyp.opts.nodedir) {\n      throw new Error('\"pre\" versions of node cannot be installed, use the --nodedir flag instead')\n    }\n    log.verbose('--nodedir flag was passed; skipping install', gyp.opts.nodedir)\n    return\n  }\n\n  // flatten version into String\n  log.verbose('install', 'installing version: %s', release.versionDir)\n\n  // the directory where the dev files will be installed\n  const devDir = path.resolve(gyp.devDir, release.versionDir)\n\n  // If '--ensure' was passed, then don't *always* install the version;\n  // check if it is already installed, and only install when needed\n  if (gyp.opts.ensure) {\n    log.verbose('install', '--ensure was passed, so won\\'t reinstall if already installed')\n    try {\n      await fs.stat(devDir)\n    } catch (err) {\n      if (err.code === 'ENOENT') {\n        log.verbose('install', 'version not already installed, continuing with install', release.version)\n        try {\n          return await go()\n        } catch (err) {\n          return rollback(err)\n        }\n      } else if (err.code === 'EACCES') {\n        return eaccesFallback(err)\n      }\n      throw err\n    }\n    log.verbose('install', 'version is already installed, need to check \"installVersion\"')\n    const installVersionFile = path.resolve(devDir, 'installVersion')\n    let installVersion = 0\n    try {\n      const ver = await fs.readFile(installVersionFile, 'ascii')\n      installVersion = parseInt(ver, 10) || 0\n    } catch (err) {\n      if (err.code !== 'ENOENT') {\n        throw err\n      }\n    }\n    log.verbose('got \"installVersion\"', installVersion)\n    log.verbose('needs \"installVersion\"', gyp.package.installVersion)\n    if (installVersion < gyp.package.installVersion) {\n      log.verbose('install', 'version is no good; reinstalling')\n      try {\n        return await go()\n      } catch (err) {\n        return rollback(err)\n      }\n    }\n    log.verbose('install', 'version is good')\n    if (win) {\n      log.verbose('on Windows; need to check node.lib')\n      const nodeLibPath = path.resolve(devDir, arch, 'node.lib')\n      try {\n        await fs.stat(nodeLibPath)\n      } catch (err) {\n        if (err.code === 'ENOENT') {\n          log.verbose('install', `version not already installed for ${arch}, continuing with install`, release.version)\n          try {\n            shouldDownloadTarball = false\n            return await go()\n          } catch (err) {\n            return rollback(err)\n          }\n        } else if (err.code === 'EACCES') {\n          return eaccesFallback(err)\n        }\n        throw err\n      }\n    }\n  } else {\n    try {\n      return await go()\n    } catch (err) {\n      return rollback(err)\n    }\n  }\n\n  async function copyDirectory (src, dest) {\n    try {\n      await fs.stat(src)\n    } catch {\n      throw new Error(`Missing source directory for copy: ${src}`)\n    }\n    await fs.mkdir(dest, { recursive: true })\n    const entries = await fs.readdir(src, { withFileTypes: true })\n    for (const entry of entries) {\n      if (entry.isDirectory()) {\n        await copyDirectory(path.join(src, entry.name), path.join(dest, entry.name))\n      } else if (entry.isFile()) {\n        // with parallel installs, copying files may cause file errors on\n        // Windows so use an exponential backoff to resolve collisions\n        await backOff(async () => {\n          try {\n            await fs.copyFile(path.join(src, entry.name), path.join(dest, entry.name))\n          } catch (err) {\n            // if ensure, check if file already exists and that's good enough\n            if (gyp.opts.ensure && err.code === 'EBUSY') {\n              try {\n                await fs.stat(path.join(dest, entry.name))\n                return\n              } catch {}\n            }\n            throw err\n          }\n        })\n      } else {\n        throw new Error('Unexpected file directory entry type')\n      }\n    }\n  }\n\n  async function go () {\n    log.verbose('ensuring devDir is created', devDir)\n\n    // first create the dir for the node dev files\n    try {\n      const created = await fs.mkdir(devDir, { recursive: true })\n\n      if (created) {\n        log.verbose('created devDir', created)\n      }\n    } catch (err) {\n      if (err.code === 'EACCES') {\n        return eaccesFallback(err)\n      }\n\n      throw err\n    }\n\n    // now download the node tarball\n    const tarPath = gyp.opts.tarball\n    let extractErrors = false\n    let extractCount = 0\n    const contentShasums = {}\n    const expectShasums = {}\n\n    // checks if a file to be extracted from the tarball is valid.\n    // only .h header files and the gyp files get extracted\n    function isValid (path) {\n      const isValid = valid(path)\n      if (isValid) {\n        log.verbose('extracted file from tarball', path)\n        extractCount++\n      } else {\n        // invalid\n        log.silly('ignoring from tarball', path)\n      }\n      return isValid\n    }\n\n    function onwarn (code, message) {\n      extractErrors = true\n      log.error('error while extracting tarball', code, message)\n    }\n\n    // download the tarball and extract!\n    // Omitted on Windows if only new node.lib is required\n\n    // there can be file errors from tar if parallel installs\n    // are happening (not uncommon with multiple native modules) so\n    // extract the tarball to a temp directory first and then copy over\n    const tarExtractDir = await fs.mkdtemp(path.join(os.tmpdir(), 'node-gyp-tmp-'))\n\n    try {\n      if (shouldDownloadTarball) {\n        if (tarPath) {\n          await tar.extract({\n            file: tarPath,\n            strip: 1,\n            filter: isValid,\n            onwarn,\n            cwd: tarExtractDir\n          })\n        } else {\n          try {\n            const res = await download(gyp, release.tarballUrl)\n\n            if (res.status !== 200) {\n              throw new Error(`${res.status} response downloading ${release.tarballUrl}`)\n            }\n\n            await pipeline(\n              res.body,\n              // content checksum\n              new ShaSum((_, checksum) => {\n                const filename = path.basename(release.tarballUrl).trim()\n                contentShasums[filename] = checksum\n                log.verbose('content checksum', filename, checksum)\n              }),\n              tar.extract({\n                strip: 1,\n                cwd: tarExtractDir,\n                filter: isValid,\n                onwarn\n              })\n            )\n          } catch (err) {\n          // something went wrong downloading the tarball?\n            if (err.code === 'ENOTFOUND') {\n              throw new Error('This is most likely not a problem with node-gyp or the package itself and\\n' +\n              'is related to network connectivity. In most cases you are behind a proxy or have bad \\n' +\n              'network settings.')\n            }\n            throw err\n          }\n        }\n\n        // invoked after the tarball has finished being extracted\n        if (extractErrors || extractCount === 0) {\n          throw new Error('There was a fatal problem while downloading/extracting the tarball')\n        }\n\n        log.verbose('tarball', 'done parsing tarball')\n      }\n\n      const installVersionPath = path.resolve(tarExtractDir, 'installVersion')\n      await Promise.all([\n      // need to download node.lib\n        ...(win ? [downloadNodeLib()] : []),\n        // write the \"installVersion\" file\n        fs.writeFile(installVersionPath, gyp.package.installVersion + '\\n'),\n        // Only download SHASUMS.txt if we downloaded something in need of SHA verification\n        ...(!tarPath || win ? [downloadShasums()] : [])\n      ])\n\n      log.verbose('download contents checksum', JSON.stringify(contentShasums))\n      // check content shasums\n      for (const k in contentShasums) {\n        log.verbose('validating download checksum for ' + k, '(%s == %s)', contentShasums[k], expectShasums[k])\n        if (contentShasums[k] !== expectShasums[k]) {\n          throw new Error(k + ' local checksum ' + contentShasums[k] + ' not match remote ' + expectShasums[k])\n        }\n      }\n\n      // copy over the files from the temp tarball extract directory to devDir\n      await copyDirectory(tarExtractDir, devDir)\n    } finally {\n      try {\n        // try to cleanup temp dir\n        await fs.rm(tarExtractDir, { recursive: true, maxRetries: 3 })\n      } catch {\n        log.warn('failed to clean up temp tarball extract directory')\n      }\n    }\n\n    async function downloadShasums () {\n      log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')\n      log.verbose('checksum url', release.shasumsUrl)\n\n      const res = await download(gyp, release.shasumsUrl)\n\n      if (res.status !== 200) {\n        throw new Error(`${res.status}  status code downloading checksum`)\n      }\n\n      for (const line of (await res.text()).trim().split('\\n')) {\n        const items = line.trim().split(/\\s+/)\n        if (items.length !== 2) {\n          return\n        }\n\n        // 0035d18e2dcf9aad669b1c7c07319e17abfe3762  ./node-v0.11.4.tar.gz\n        const name = items[1].replace(/^\\.\\//, '')\n        expectShasums[name] = items[0]\n      }\n\n      log.verbose('checksum data', JSON.stringify(expectShasums))\n    }\n\n    async function downloadNodeLib () {\n      log.verbose('on Windows; need to download `' + release.name + '.lib`...')\n      const dir = path.resolve(tarExtractDir, arch)\n      const targetLibPath = path.resolve(dir, release.name + '.lib')\n      const { libUrl, libPath } = release[arch]\n      const name = `${arch} ${release.name}.lib`\n      log.verbose(name, 'dir', dir)\n      log.verbose(name, 'url', libUrl)\n\n      await fs.mkdir(dir, { recursive: true })\n      log.verbose('streaming', name, 'to:', targetLibPath)\n\n      const res = await download(gyp, libUrl)\n\n      // Since only required node.lib is downloaded throw error if it is not fetched\n      if (res.status !== 200) {\n        throw new Error(`${res.status} status code downloading ${name}`)\n      }\n\n      return pipeline(\n        res.body,\n        new ShaSum((_, checksum) => {\n          contentShasums[libPath] = checksum\n          log.verbose('content checksum', libPath, checksum)\n        }),\n        createWriteStream(targetLibPath)\n      )\n    } // downloadNodeLib()\n  } // go()\n\n  /**\n   * Checks if a given filename is \"valid\" for this installation.\n   */\n\n  function valid (file) {\n    // header files\n    const extname = path.extname(file)\n    return extname === '.h' || extname === '.gypi'\n  }\n\n  async function rollback (err) {\n    log.warn('install', 'got an error, rolling back install')\n    // roll-back the install if anything went wrong\n    await gyp.commands.remove([release.versionDir])\n    throw err\n  }\n\n  /**\n   * The EACCES fallback is a workaround for npm's `sudo` behavior, where\n   * it drops the permissions before invoking any child processes (like\n   * node-gyp). So what happens is the \"nobody\" user doesn't have\n   * permission to create the dev dir. As a fallback, make the tmpdir() be\n   * the dev dir for this installation. This is not ideal, but at least\n   * the compilation will succeed...\n   */\n\n  async function eaccesFallback (err) {\n    const noretry = '--node_gyp_internal_noretry'\n    if (argv.indexOf(noretry) !== -1) {\n      throw err\n    }\n    const tmpdir = os.tmpdir()\n    gyp.devDir = path.resolve(tmpdir, '.node-gyp')\n    let userString = ''\n    try {\n      // os.userInfo can fail on some systems, it's not critical here\n      userString = ` (\"${os.userInfo().username}\")`\n    } catch (e) {}\n    log.warn('EACCES', 'current user%s does not have permission to access the dev dir \"%s\"', userString, devDir)\n    log.warn('EACCES', 'attempting to reinstall using temporary dev dir \"%s\"', gyp.devDir)\n    if (process.cwd() === tmpdir) {\n      log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')\n      gyp.todo.push({ name: 'remove', args: argv })\n    }\n    return gyp.commands.install([noretry].concat(argv))\n  }\n}\n\nclass ShaSum extends Transform {\n  constructor (callback) {\n    super()\n    this._callback = callback\n    this._digester = crypto.createHash('sha256')\n  }\n\n  _transform (chunk, _, callback) {\n    this._digester.update(chunk)\n    callback(null, chunk)\n  }\n\n  _flush (callback) {\n    this._callback(null, this._digester.digest('hex'))\n    callback()\n  }\n}\n\nmodule.exports = install\nmodule.exports.usage = 'Install node development files for the specified node version.'\n"
  },
  {
    "path": "lib/list.js",
    "content": "'use strict'\n\nconst fs = require('graceful-fs').promises\nconst log = require('./log')\n\nasync function list (gyp, args) {\n  const devDir = gyp.devDir\n  log.verbose('list', 'using node-gyp dir:', devDir)\n\n  let versions = []\n  try {\n    const dir = await fs.readdir(devDir)\n    if (Array.isArray(dir)) {\n      versions = dir.filter((v) => v !== 'current')\n    }\n  } catch (err) {\n    if (err && err.code !== 'ENOENT') {\n      throw err\n    }\n  }\n\n  return versions\n}\n\nmodule.exports = list\nmodule.exports.usage = 'Prints a listing of the currently installed node development files'\n"
  },
  {
    "path": "lib/log.js",
    "content": "'use strict'\n\nconst { log } = require('proc-log')\nconst { format } = require('util')\n\n// helper to emit log messages with a predefined prefix\nconst withPrefix = (prefix) => log.LEVELS.reduce((acc, level) => {\n  acc[level] = (...args) => log[level](prefix, ...args)\n  return acc\n}, {})\n\n// very basic ansi color generator\nconst COLORS = {\n  wrap: (str, colors) => {\n    const codes = colors.filter(c => typeof c === 'number')\n    return `\\x1b[${codes.join(';')}m${str}\\x1b[0m`\n  },\n  inverse: 7,\n  fg: {\n    black: 30,\n    red: 31,\n    green: 32,\n    yellow: 33,\n    blue: 34,\n    magenta: 35,\n    cyan: 36,\n    white: 37\n  },\n  bg: {\n    black: 40,\n    red: 41,\n    green: 42,\n    yellow: 43,\n    blue: 44,\n    magenta: 45,\n    cyan: 46,\n    white: 47\n  }\n}\n\nclass Logger {\n  #buffer = []\n  #paused = null\n  #level = null\n  #stream = null\n\n  // ordered from loudest to quietest\n  #levels = [{\n    id: 'silly',\n    display: 'sill',\n    style: { inverse: true }\n  }, {\n    id: 'verbose',\n    display: 'verb',\n    style: { fg: 'cyan', bg: 'black' }\n  }, {\n    id: 'info',\n    style: { fg: 'green' }\n  }, {\n    id: 'http',\n    style: { fg: 'green', bg: 'black' }\n  }, {\n    id: 'notice',\n    style: { fg: 'cyan', bg: 'black' }\n  }, {\n    id: 'warn',\n    display: 'WARN',\n    style: { fg: 'black', bg: 'yellow' }\n  }, {\n    id: 'error',\n    display: 'ERR!',\n    style: { fg: 'red', bg: 'black' }\n  }]\n\n  constructor (stream) {\n    process.on('log', (...args) => this.#onLog(...args))\n    this.#levels = new Map(this.#levels.map((level, index) => [level.id, { ...level, index }]))\n    this.level = 'info'\n    this.stream = stream\n    log.pause()\n  }\n\n  get stream () {\n    return this.#stream\n  }\n\n  set stream (stream) {\n    this.#stream = stream\n  }\n\n  get level () {\n    return this.#levels.get(this.#level) ?? null\n  }\n\n  set level (level) {\n    this.#level = this.#levels.get(level)?.id ?? null\n  }\n\n  isVisible (level) {\n    return this.level?.index <= this.#levels.get(level)?.index ?? -1\n  }\n\n  #onLog (...args) {\n    const [level] = args\n\n    if (level === 'pause') {\n      this.#paused = true\n      return\n    }\n\n    if (level === 'resume') {\n      this.#paused = false\n      this.#buffer.forEach((b) => this.#log(...b))\n      this.#buffer.length = 0\n      return\n    }\n\n    if (this.#paused) {\n      this.#buffer.push(args)\n      return\n    }\n\n    this.#log(...args)\n  }\n\n  #color (str, { fg, bg, inverse }) {\n    if (!this.#stream?.isTTY) {\n      return str\n    }\n\n    return COLORS.wrap(str, [\n      COLORS.fg[fg],\n      COLORS.bg[bg],\n      inverse && COLORS.inverse\n    ])\n  }\n\n  #log (levelId, msgPrefix, ...args) {\n    if (!this.isVisible(levelId) || typeof this.#stream?.write !== 'function') {\n      return\n    }\n\n    const level = this.#levels.get(levelId)\n\n    const prefixParts = [\n      this.#color('gyp', { fg: 'white', bg: 'black' }),\n      this.#color(level.display ?? level.id, level.style)\n    ]\n    if (msgPrefix) {\n      prefixParts.push(this.#color(msgPrefix, { fg: 'magenta' }))\n    }\n\n    const prefix = prefixParts.join(' ').trim() + ' '\n    const lines = format(...args).split(/\\r?\\n/).map(l => prefix + l.trim())\n\n    this.#stream.write(lines.join('\\n') + '\\n')\n  }\n}\n\n// used to suppress logs in tests\nconst NULL_LOGGER = !!process.env.NODE_GYP_NULL_LOGGER\n\nmodule.exports = {\n  logger: new Logger(NULL_LOGGER ? null : process.stderr),\n  stdout: NULL_LOGGER ? () => {} : (...args) => console.log(...args),\n  withPrefix,\n  ...log\n}\n"
  },
  {
    "path": "lib/node-gyp.js",
    "content": "'use strict'\n\nconst path = require('path')\nconst nopt = require('nopt')\nconst log = require('./log')\nconst childProcess = require('child_process')\nconst { EventEmitter } = require('events')\n\nconst commands = [\n  // Module build commands\n  'build',\n  'clean',\n  'configure',\n  'rebuild',\n  // Development Header File management commands\n  'install',\n  'list',\n  'remove'\n]\n\nclass Gyp extends EventEmitter {\n  /**\n   * Export the contents of the package.json.\n   */\n  package = require('../package.json')\n\n  /**\n   * nopt configuration definitions\n   */\n  configDefs = {\n    help: Boolean, // everywhere\n    arch: String, // 'configure'\n    cafile: String, // 'install'\n    debug: Boolean, // 'build'\n    directory: String, // bin\n    make: String, // 'build'\n    'msvs-version': String, // 'configure'\n    ensure: Boolean, // 'install'\n    solution: String, // 'build' (windows only)\n    proxy: String, // 'install'\n    noproxy: String, // 'install'\n    devdir: String, // everywhere\n    nodedir: String, // 'configure'\n    loglevel: String, // everywhere\n    python: String, // 'configure'\n    'dist-url': String, // 'install'\n    tarball: String, // 'install'\n    jobs: String, // 'build'\n    thin: String, // 'configure'\n    'force-process-config': Boolean // 'configure'\n  }\n\n  /**\n   * nopt shorthands\n   */\n  shorthands = {\n    release: '--no-debug',\n    C: '--directory',\n    debug: '--debug',\n    j: '--jobs',\n    silly: '--loglevel=silly',\n    verbose: '--loglevel=verbose',\n    silent: '--loglevel=silent'\n  }\n\n  /**\n   * expose the command aliases for the bin file to use.\n   */\n  aliases = {\n    ls: 'list',\n    rm: 'remove'\n  }\n\n  constructor (...args) {\n    super(...args)\n\n    this.devDir = ''\n\n    this.commands = commands.reduce((acc, command) => {\n      acc[command] = (argv) => require('./' + command)(this, argv)\n      return acc\n    }, {})\n\n    Object.defineProperty(this, 'version', {\n      enumerable: true,\n      get: function () { return this.package.version }\n    })\n  }\n\n  /**\n   * Parses the given argv array and sets the 'opts',\n   * 'argv' and 'command' properties.\n   */\n  parseArgv (argv) {\n    this.opts = nopt(this.configDefs, this.shorthands, argv)\n    this.argv = this.opts.argv.remain.slice()\n\n    const commands = this.todo = []\n\n    // create a copy of the argv array with aliases mapped\n    argv = this.argv.map((arg) => {\n    // is this an alias?\n      if (arg in this.aliases) {\n        arg = this.aliases[arg]\n      }\n      return arg\n    })\n\n    // process the mapped args into \"command\" objects (\"name\" and \"args\" props)\n    argv.slice().forEach((arg) => {\n      if (arg in this.commands) {\n        const args = argv.splice(0, argv.indexOf(arg))\n        argv.shift()\n        if (commands.length > 0) {\n          commands[commands.length - 1].args = args\n        }\n        commands.push({ name: arg, args: [] })\n      }\n    })\n    if (commands.length > 0) {\n      commands[commands.length - 1].args = argv.splice(0)\n    }\n\n    // support for inheriting config env variables from npm\n    // npm will set environment variables in the following forms:\n    // - `npm_config_<key>` for values from npm's own config. Setting arbitrary\n    //   options on npm's config was deprecated in npm v11 but node-gyp still\n    //   supports it for backwards compatibility.\n    //   See https://github.com/nodejs/node-gyp/issues/3156\n    // - `npm_package_config_node_gyp_<key>` for values from the `config` object\n    //   in package.json. This is the preferred way to set options for node-gyp\n    //   since npm v11. The `node_gyp_` prefix is used to avoid conflicts with\n    //   other tools.\n    // The `npm_package_config_node_gyp_` prefix will take precedence over\n    // `npm_config_` keys.\n    const npmConfigPrefix = /^npm_config_/i\n    const npmPackageConfigPrefix = /^npm_package_config_node_gyp_/i\n\n    const configEnvKeys = Object.keys(process.env)\n      .filter((k) => npmConfigPrefix.test(k) || npmPackageConfigPrefix.test(k))\n      // sort so that npm_package_config_node_gyp_ keys come last and will override\n      .sort((a) => npmConfigPrefix.test(a) ? -1 : 1)\n\n    for (const key of configEnvKeys) {\n      // add the user-defined options to the config\n      const name = npmConfigPrefix.test(key)\n        ? key.replace(npmConfigPrefix, '')\n        : key.replace(npmPackageConfigPrefix, '')\n      // gyp@741b7f1 enters an infinite loop when it encounters\n      // zero-length options so ensure those don't get through.\n      if (name) {\n        // convert names like force_process_config to force-process-config\n        // and convert to lowercase\n        this.opts[name.replaceAll('_', '-').toLowerCase()] = process.env[key]\n      }\n    }\n\n    if (this.opts.loglevel) {\n      log.logger.level = this.opts.loglevel\n      delete this.opts.loglevel\n    }\n    log.resume()\n  }\n\n  /**\n   * Spawns a child process and emits a 'spawn' event.\n   */\n  spawn (command, args, opts) {\n    if (!opts) {\n      opts = {}\n    }\n    if (!opts.silent && !opts.stdio) {\n      opts.stdio = [0, 1, 2]\n    }\n    const cp = childProcess.spawn(command, args, opts)\n    log.info('spawn', command)\n    log.info('spawn args', args)\n    return cp\n  }\n\n  /**\n   * Returns the usage instructions for node-gyp.\n   */\n  usage () {\n    return [\n      '',\n      '  Usage: node-gyp <command> [options]',\n      '',\n      '  where <command> is one of:',\n      commands.map((c) => '    - ' + c + ' - ' + require('./' + c).usage).join('\\n'),\n      '',\n      'node-gyp@' + this.version + '  ' + path.resolve(__dirname, '..'),\n      'node@' + process.versions.node\n    ].join('\\n')\n  }\n}\n\nmodule.exports = () => new Gyp()\nmodule.exports.Gyp = Gyp\n"
  },
  {
    "path": "lib/process-release.js",
    "content": "'use strict'\n\nconst semver = require('semver')\nconst path = require('path')\nconst log = require('./log')\n\n// versions where -headers.tar.gz started shipping\nconst headersTarballRange = '>= 3.0.0 || ~0.12.10 || ~0.10.42'\nconst bitsre = /\\/win-(x86|x64|arm64)\\//\nconst bitsreV3 = /\\/win-(x86|ia32|x64)\\// // io.js v3.x.x shipped with \"ia32\" but should\n// have been \"x86\"\n\n// Captures all the logic required to determine download URLs, local directory and\n// file names. Inputs come from command-line switches (--target, --dist-url),\n// `process.version` and `process.release` where it exists.\nfunction processRelease (argv, gyp, defaultVersion, defaultRelease) {\n  let version = (semver.valid(argv[0]) && argv[0]) || gyp.opts.target || defaultVersion\n  const versionSemver = semver.parse(version)\n  let overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl\n  let isNamedForLegacyIojs\n  let name\n  let distBaseUrl\n  let baseUrl\n  let libUrl32\n  let libUrl64\n  let libUrlArm64\n  let tarballUrl\n  let canGetHeaders\n\n  if (!versionSemver) {\n    // not a valid semver string, nothing we can do\n    return { version }\n  }\n  // flatten version into String\n  version = versionSemver.version\n\n  // defaultVersion should come from process.version so ought to be valid semver\n  const isDefaultVersion = version === semver.parse(defaultVersion).version\n\n  // can't use process.release if we're using --target=x.y.z\n  if (!isDefaultVersion) {\n    defaultRelease = null\n  }\n\n  if (defaultRelease) {\n    // v3 onward, has process.release\n    name = defaultRelease.name.replace(/io\\.js/, 'iojs') // remove the '.' for directory naming purposes\n  } else {\n    // old node or alternative --target=\n    // semver.satisfies() doesn't like prerelease tags so test major directly\n    isNamedForLegacyIojs = versionSemver.major >= 1 && versionSemver.major < 4\n    // isNamedForLegacyIojs is required to support Electron < 4 (in particular Electron 3)\n    // as previously this logic was used to ensure \"iojs\" was used to download iojs releases\n    // and \"node\" for node releases.  Unfortunately the logic was broad enough that electron@3\n    // published release assets as \"iojs\" so that the node-gyp logic worked.  Once Electron@3 has\n    // been EOL for a while (late 2019) we should remove this hack.\n    name = isNamedForLegacyIojs ? 'iojs' : 'node'\n  }\n\n  // check for the nvm.sh standard mirror env variables\n  if (!overrideDistUrl && process.env.NODEJS_ORG_MIRROR) {\n    overrideDistUrl = process.env.NODEJS_ORG_MIRROR\n  }\n\n  if (overrideDistUrl) {\n    log.verbose('download', 'using dist-url', overrideDistUrl)\n  }\n\n  if (overrideDistUrl) {\n    distBaseUrl = overrideDistUrl.replace(/\\/+$/, '')\n  } else {\n    distBaseUrl = 'https://nodejs.org/dist'\n  }\n  distBaseUrl = new URL(distBaseUrl + '/v' + version + '/')\n\n  // new style, based on process.release so we have a lot of the data we need\n  if (defaultRelease && defaultRelease.headersUrl && !overrideDistUrl) {\n    baseUrl = new URL('./', defaultRelease.headersUrl)\n    libUrl32 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x86', versionSemver.major)\n    libUrl64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x64', versionSemver.major)\n    libUrlArm64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'arm64', versionSemver.major)\n    tarballUrl = defaultRelease.headersUrl\n  } else {\n    // older versions without process.release are captured here and we have to make\n    // a lot of assumptions, additionally if you --target=x.y.z then we can't use the\n    // current process.release\n    baseUrl = distBaseUrl\n    libUrl32 = resolveLibUrl(name, baseUrl, 'x86', versionSemver.major)\n    libUrl64 = resolveLibUrl(name, baseUrl, 'x64', versionSemver.major)\n    libUrlArm64 = resolveLibUrl(name, baseUrl, 'arm64', versionSemver.major)\n\n    // making the bold assumption that anything with a version number >3.0.0 will\n    // have a *-headers.tar.gz file in its dist location, even some frankenstein\n    // custom version\n    canGetHeaders = semver.satisfies(versionSemver, headersTarballRange)\n    tarballUrl = new URL(name + '-v' + version + (canGetHeaders ? '-headers' : '') + '.tar.gz', baseUrl).href\n  }\n\n  return {\n    version,\n    semver: versionSemver,\n    name,\n    baseUrl: baseUrl.href,\n    tarballUrl,\n    shasumsUrl: new URL('SHASUMS256.txt', baseUrl).href,\n    versionDir: (name !== 'node' ? name + '-' : '') + version,\n    ia32: {\n      libUrl: libUrl32.href,\n      libPath: normalizePath(path.relative(baseUrl.pathname, libUrl32.pathname))\n    },\n    x64: {\n      libUrl: libUrl64.href,\n      libPath: normalizePath(path.relative(baseUrl.pathname, libUrl64.pathname))\n    },\n    arm64: {\n      libUrl: libUrlArm64.href,\n      libPath: normalizePath(path.relative(baseUrl.pathname, libUrlArm64.pathname))\n    }\n  }\n}\n\nfunction normalizePath (p) {\n  return path.normalize(p).replace(/\\\\/g, '/')\n}\n\nfunction resolveLibUrl (name, defaultUrl, arch, versionMajor) {\n  if (!defaultUrl.pathname) defaultUrl = new URL(defaultUrl)\n  const base = new URL('./', defaultUrl)\n  const hasLibUrl = bitsre.test(defaultUrl.pathname) || (versionMajor === 3 && bitsreV3.test(defaultUrl.pathname))\n\n  if (!hasLibUrl) {\n    // let's assume it's a baseUrl then\n    if (versionMajor >= 1) {\n      return new URL('win-' + arch + '/' + name + '.lib', base)\n    }\n    // prior to io.js@1.0.0 32-bit node.lib lives in /, 64-bit lives in /x64/\n    return new URL((arch === 'x86' ? '' : arch + '/') + name + '.lib', base)\n  }\n\n  // else we have a proper url to a .lib, just make sure it's the right arch\n  return new URL(defaultUrl.pathname.replace(versionMajor === 3 ? bitsreV3 : bitsre, '/win-' + arch + '/'), defaultUrl)\n}\n\nmodule.exports = processRelease\n"
  },
  {
    "path": "lib/rebuild.js",
    "content": "'use strict'\n\nasync function rebuild (gyp, argv) {\n  gyp.todo.push(\n    { name: 'clean', args: [] }\n    , { name: 'configure', args: argv }\n    , { name: 'build', args: [] }\n  )\n}\n\nmodule.exports = rebuild\nmodule.exports.usage = 'Runs \"clean\", \"configure\" and \"build\" all at once'\n"
  },
  {
    "path": "lib/remove.js",
    "content": "'use strict'\n\nconst fs = require('graceful-fs').promises\nconst path = require('path')\nconst log = require('./log')\nconst semver = require('semver')\n\nasync function remove (gyp, argv) {\n  const devDir = gyp.devDir\n  log.verbose('remove', 'using node-gyp dir:', devDir)\n\n  // get the user-specified version to remove\n  let version = argv[0] || gyp.opts.target\n  log.verbose('remove', 'removing target version:', version)\n\n  if (!version) {\n    throw new Error('You must specify a version number to remove. Ex: \"' + process.version + '\"')\n  }\n\n  const versionSemver = semver.parse(version)\n  if (versionSemver) {\n    // flatten the version Array into a String\n    version = versionSemver.version\n  }\n\n  const versionPath = path.resolve(gyp.devDir, version)\n  log.verbose('remove', 'removing development files for version:', version)\n\n  // first check if its even installed\n  try {\n    await fs.stat(versionPath)\n  } catch (err) {\n    if (err.code === 'ENOENT') {\n      return 'version was already uninstalled: ' + version\n    }\n    throw err\n  }\n\n  await fs.rm(versionPath, { recursive: true, force: true, maxRetries: 3 })\n}\n\nmodule.exports = remove\nmodule.exports.usage = 'Removes the node development files for the specified version'\n"
  },
  {
    "path": "lib/util.js",
    "content": "'use strict'\n\nconst cp = require('child_process')\nconst path = require('path')\nconst { openSync, closeSync } = require('graceful-fs')\nconst log = require('./log')\n\nconst execFile = async (...args) => new Promise((resolve) => {\n  const child = cp.execFile(...args, (...a) => resolve(a))\n  child.stdin.end()\n})\n\nasync function regGetValue (key, value, addOpts) {\n  const outReValue = value.replace(/\\W/g, '.')\n  const outRe = new RegExp(`^\\\\s+${outReValue}\\\\s+REG_\\\\w+\\\\s+(\\\\S.*)$`, 'im')\n  const reg = path.join(process.env.SystemRoot, 'System32', 'reg.exe')\n  const regArgs = ['query', key, '/v', value].concat(addOpts)\n\n  log.silly('reg', 'running', reg, regArgs)\n  const [err, stdout, stderr] = await execFile(reg, regArgs, { encoding: 'utf8' })\n\n  log.silly('reg', 'reg.exe stdout = %j', stdout)\n  if (err || stderr.trim() !== '') {\n    log.silly('reg', 'reg.exe err = %j', err && (err.stack || err))\n    log.silly('reg', 'reg.exe stderr = %j', stderr)\n    if (err) {\n      throw err\n    }\n    throw new Error(stderr)\n  }\n\n  const result = outRe.exec(stdout)\n  if (!result) {\n    log.silly('reg', 'error parsing stdout')\n    throw new Error('Could not parse output of reg.exe')\n  }\n\n  log.silly('reg', 'found: %j', result[1])\n  return result[1]\n}\n\nasync function regSearchKeys (keys, value, addOpts) {\n  for (const key of keys) {\n    try {\n      return await regGetValue(key, value, addOpts)\n    } catch {\n      continue\n    }\n  }\n}\n\n/**\n * Returns the first file or directory from an array of candidates that is\n * readable by the current user, or undefined if none of the candidates are\n * readable.\n */\nfunction findAccessibleSync (logprefix, dir, candidates) {\n  for (let next = 0; next < candidates.length; next++) {\n    const candidate = path.resolve(dir, candidates[next])\n    let fd\n    try {\n      fd = openSync(candidate, 'r')\n    } catch (e) {\n      // this candidate was not found or not readable, do nothing\n      log.silly(logprefix, 'Could not open %s: %s', candidate, e.message)\n      continue\n    }\n    closeSync(fd)\n    log.silly(logprefix, 'Found readable %s', candidate)\n    return candidate\n  }\n\n  return undefined\n}\n\nmodule.exports = {\n  execFile,\n  regGetValue,\n  regSearchKeys,\n  findAccessibleSync\n}\n"
  },
  {
    "path": "macOS_Catalina_acid_test.sh",
    "content": "#!/bin/bash\n\npkgs=(\n  \"com.apple.pkg.DeveloperToolsCLILeo\" # standalone\n  \"com.apple.pkg.DeveloperToolsCLI\"    # from XCode\n  \"com.apple.pkg.CLTools_Executables\"  # Mavericks\n)\n\nfor pkg in \"${pkgs[@]}\"; do\n  output=$(/usr/sbin/pkgutil --pkg-info \"$pkg\" 2>/dev/null)\n  if [ \"$output\" ]; then\n    version=$(echo \"$output\" | grep 'version' | cut -d' ' -f2)\n    break\n  fi\ndone\n\nif [ \"$version\" ]; then\n  echo \"Command Line Tools version: $version\"\nelse\n  echo >&2 'Command Line Tools not found'\nfi\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"node-gyp\",\n  \"description\": \"Node.js native addon build tool\",\n  \"license\": \"MIT\",\n  \"keywords\": [\n    \"native\",\n    \"addon\",\n    \"module\",\n    \"c\",\n    \"c++\",\n    \"bindings\",\n    \"gyp\"\n  ],\n  \"version\": \"12.2.0\",\n  \"installVersion\": 11,\n  \"author\": \"Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git://github.com/nodejs/node-gyp.git\"\n  },\n  \"preferGlobal\": true,\n  \"bin\": \"./bin/node-gyp.js\",\n  \"main\": \"./lib/node-gyp.js\",\n  \"dependencies\": {\n    \"env-paths\": \"^2.2.0\",\n    \"exponential-backoff\": \"^3.1.1\",\n    \"graceful-fs\": \"^4.2.6\",\n    \"make-fetch-happen\": \"^15.0.0\",\n    \"nopt\": \"^9.0.0\",\n    \"proc-log\": \"^6.0.0\",\n    \"semver\": \"^7.3.5\",\n    \"tar\": \"^7.5.4\",\n    \"tinyglobby\": \"^0.2.12\",\n    \"which\": \"^6.0.0\"\n  },\n  \"engines\": {\n    \"node\": \"^20.17.0 || >=22.9.0\"\n  },\n  \"devDependencies\": {\n    \"bindings\": \"^1.5.0\",\n    \"cross-env\": \"^10.1.0\",\n    \"eslint\": \"^9.39.1\",\n    \"mocha\": \"^11.7.5\",\n    \"nan\": \"^2.23.1\",\n    \"neostandard\": \"^0.12.2\",\n    \"require-inject\": \"^1.4.4\"\n  },\n  \"scripts\": {\n    \"lint\": \"eslint \\\"*/*.js\\\" \\\"test/**/*.js\\\" \\\".github/**/*.js\\\"\",\n    \"test\": \"cross-env NODE_GYP_NULL_LOGGER=true mocha --timeout 30000 test/test-download.js test/test-*\"\n  }\n}\n"
  },
  {
    "path": "release-please-config.json",
    "content": "{\n    \"packages\": {\n        \".\": {\n            \"include-component-in-tag\": false,\n            \"release-type\": \"node\",\n            \"changelog-sections\": [\n                { \"type\": \"feat\", \"section\": \"Features\", \"hidden\": false },\n                { \"type\": \"fix\", \"section\": \"Bug Fixes\", \"hidden\": false },\n                { \"type\": \"bin\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"gyp\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"lib\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"src\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"test\", \"section\": \"Tests\", \"hidden\": false },\n                { \"type\": \"build\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"clean\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"configure\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"install\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"list\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"rebuild\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"remove\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"deps\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"python\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"lin\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"linux\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"mac\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"macos\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"win\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"windows\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"zos\", \"section\": \"Core\", \"hidden\": false },\n                { \"type\": \"doc\", \"section\": \"Doc\", \"hidden\": false },\n                { \"type\": \"docs\", \"section\": \"Doc\", \"hidden\": false },\n                { \"type\": \"readme\", \"section\": \"Doc\", \"hidden\": false },\n                { \"type\": \"chore\", \"section\": \"Miscellaneous\", \"hidden\": false },\n                { \"type\": \"refactor\", \"section\": \"Miscellaneous\", \"hidden\": false },\n                { \"type\": \"ci\", \"section\": \"Miscellaneous\", \"hidden\": false },\n                { \"type\": \"meta\", \"section\": \"Miscellaneous\", \"hidden\": false }\n            ]\n        }\n    }\n}\n"
  },
  {
    "path": "src/win_delay_load_hook.cc",
    "content": "/*\n * When this file is linked to a DLL, it sets up a delay-load hook that\n * intervenes when the DLL is trying to load the host executable\n * dynamically. Instead of trying to locate the .exe file it'll just\n * return a handle to the process image.\n *\n * This allows compiled addons to work when the host executable is renamed.\n */\n\n#ifdef _MSC_VER\n\n#pragma managed(push, off)\n\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n\n#include <windows.h>\n\n#include <delayimp.h>\n#include <string.h>\n\nstatic FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo* info) {\n  HMODULE m;\n  if (event != dliNotePreLoadLibrary)\n    return NULL;\n\n  if (_stricmp(info->szDll, HOST_BINARY) != 0)\n    return NULL;\n\n  // try for libnode.dll to compat node.js that using 'vcbuild.bat dll'\n  m = GetModuleHandle(TEXT(\"libnode.dll\"));\n  if (m == NULL) m = GetModuleHandle(NULL);\n  return (FARPROC) m;\n}\n\ndecltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook;\n\n#pragma managed(pop)\n\n#endif\n"
  },
  {
    "path": "test/common.js",
    "content": "const envPaths = require('env-paths')\nconst semver = require('semver')\n\nmodule.exports.devDir = envPaths('node-gyp', { suffix: '' }).cache\n\nmodule.exports.poison = (object, property) => {\n  function fail () {\n    console.error(Error(`Property ${property} should not have been accessed.`))\n    process.abort()\n  }\n  const descriptor = {\n    configurable: false,\n    enumerable: false,\n    get: fail,\n    set: fail\n  }\n  Object.defineProperty(object, property, descriptor)\n}\n\n// Only run full test suite when instructed and on a non-prerelease version of node\nmodule.exports.FULL_TEST =\n  process.env.FULL_TEST === '1' &&\n  process.release.name === 'node' &&\n  semver.prerelease(process.version) === null\n\nmodule.exports.platformTimeout = (def, obj) => {\n  for (const [key, value] of Object.entries(obj)) {\n    if (process.platform === key) {\n      return value * 60 * 1000\n    }\n  }\n  return def * 60 * 1000\n}\n"
  },
  {
    "path": "test/fixtures/VSSetup_VS_2019_Professional_workload.txt",
    "content": "[\n    {\n        \"InstanceId\":  \"2619cf21\",\n        \"InstallationName\":  \"VisualStudio/16.11.33+34407.143\",\n        \"InstallationPath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Professional\",\n        \"InstallationVersion\":  {\n                                    \"Major\":  16,\n                                    \"Minor\":  11,\n                                    \"Build\":  34407,\n                                    \"Revision\":  143,\n                                    \"MajorRevision\":  0,\n                                    \"MinorRevision\":  143\n                                },\n        \"InstallDate\":  \"\\/Date(1706804943503)\\/\",\n        \"State\":  4294967295,\n        \"DisplayName\":  \"Visual Studio Professional 2019\",\n        \"Description\":  \"Professional IDE best suited to small teams\",\n        \"ProductPath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Professional\\\\Common7\\\\IDE\\\\devenv.exe\",\n        \"Product\":  {\n                        \"Id\":  \"Microsoft.VisualStudio.Product.Professional\",\n                        \"Version\":  {\n                                        \"Major\":  16,\n                                        \"Minor\":  11,\n                                        \"Build\":  34407,\n                                        \"Revision\":  143,\n                                        \"MajorRevision\":  0,\n                                        \"MinorRevision\":  143\n                                    },\n                        \"Chip\":  null,\n                        \"Branch\":  null,\n                        \"Type\":  \"Product\",\n                        \"IsExtension\":  false,\n                        \"UniqueId\":  \"Microsoft.VisualStudio.Product.Professional,version=16.11.34407.143\"\n                    },\n        \"Packages\":  [\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.Product.Professional\",\n                             \"Version\":  \"16.11.34407.143\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Product\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.Product.Professional,version=16.11.34407.143\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.Component.VC.14.29.16.10.ATL\",\n                             \"Version\":  \"16.11.31314.313\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Component\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.Component.VC.14.29.16.10.ATL,version=16.11.31314.313\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.X64.v142\",\n                             \"Version\":  \"16.11.31503.54\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.X64.v142,version=16.11.31503.54\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.X64\",\n                             \"Version\":  \"16.11.31503.54\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.X64,version=16.11.31503.54\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.x86.v142\",\n                             \"Version\":  \"16.11.31503.54\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.x86.v142,version=16.11.31503.54\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.X86\",\n                             \"Version\":  \"16.11.31503.54\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.X86,version=16.11.31503.54\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.Base\",\n                             \"Version\":  \"16.11.31829.152\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.Base,version=16.11.31829.152\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\n                             \"Version\":  \"16.11.31829.152\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.Base.Resources,version=16.11.31829.152,language=en-US\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.Branding.Professional\",\n                             \"Version\":  \"16.11.31605.320\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.Branding.Professional,version=16.11.31605.320,language=en-US\"\n                         },\n                         {\n                            \"Id\":  \"Microsoft.VisualStudio.Component.Windows10SDK.19041\",\n                            \"Version\":  \"16.10.31205.252\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Component\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Microsoft.VisualStudio.Component.Windows10SDK.19041,version=16.10.31205.252\"\n                        },\n                        {\n                            \"Id\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n                            \"Version\":  \"16.11.32406.258\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Component\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64,version=16.11.32406.258\"\n                        }\n                     ],\n        \"Properties\":  [\n                           {\n                               \"Key\":  \"CampaignId\",\n                               \"Value\":  \"09\"\n                           },\n                           {\n                               \"Key\":  \"SetupEngineFilePath\",\n                               \"Value\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\setup.exe\"\n                           },\n                           {\n                               \"Key\":  \"Nickname\",\n                               \"Value\":  \"\"\n                           },\n                           {\n                               \"Key\":  \"ChannelManifestId\",\n                               \"Value\":  \"VisualStudio.16.Release/16.11.33+34407.143\"\n                           }\n                       ],\n        \"Errors\":  null,\n        \"EnginePath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service\",\n        \"IsComplete\":  true,\n        \"IsLaunchable\":  true,\n        \"CatalogInfo\":  [\n                            {\n                                \"Key\":  \"Id\",\n                                \"Value\":  \"VisualStudio/16.11.33+34407.143\"\n                            },\n                            {\n                                \"Key\":  \"BuildBranch\",\n                                \"Value\":  \"d16.11\"\n                            },\n                            {\n                                \"Key\":  \"BuildVersion\",\n                                \"Value\":  \"16.11.34407.143\"\n                            },\n                            {\n                                \"Key\":  \"LocalBuild\",\n                                \"Value\":  \"build-lab\"\n                            },\n                            {\n                                \"Key\":  \"ManifestName\",\n                                \"Value\":  \"VisualStudio\"\n                            },\n                            {\n                                \"Key\":  \"ManifestType\",\n                                \"Value\":  \"installer\"\n                            },\n                            {\n                                \"Key\":  \"ProductDisplayVersion\",\n                                \"Value\":  \"16.11.33\"\n                            },\n                            {\n                                \"Key\":  \"ProductLine\",\n                                \"Value\":  \"Dev16\"\n                            },\n                            {\n                                \"Key\":  \"ProductLineVersion\",\n                                \"Value\":  \"2019\"\n                            },\n                            {\n                                \"Key\":  \"ProductMilestone\",\n                                \"Value\":  \"RTW\"\n                            },\n                            {\n                                \"Key\":  \"ProductMilestoneIsPreRelease\",\n                                \"Value\":  \"False\"\n                            },\n                            {\n                                \"Key\":  \"ProductName\",\n                                \"Value\":  \"Visual Studio\"\n                            },\n                            {\n                                \"Key\":  \"ProductPatchVersion\",\n                                \"Value\":  \"33\"\n                            },\n                            {\n                                \"Key\":  \"ProductPreReleaseMilestoneSuffix\",\n                                \"Value\":  \"1.0\"\n                            },\n                            {\n                                \"Key\":  \"ProductSemanticVersion\",\n                                \"Value\":  \"16.11.33+34407.143\"\n                            },\n                            {\n                                \"Key\":  \"RequiredEngineVersion\",\n                                \"Value\":  \"2.11.72.18200\"\n                            }\n                        ],\n        \"IsPrerelease\":  false,\n        \"PSPath\":  \"Microsoft.PowerShell.Core\\\\FileSystem::C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"UpdateDate\":  \"2024-01-09T19:19:11.0115234Z\",\n        \"ResolvedInstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"ChannelId\":  \"VisualStudio.17.Release\",\n        \"InstalledChannelId\":  \"VisualStudio.17.Release\",\n        \"ChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n        \"InstalledChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n        \"ReleaseNotes\":  \"https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.8#17.8.4\",\n        \"ThirdPartyNotices\":  \"https://go.microsoft.com/fwlink/?LinkId=661288\"\n    }\n]\n"
  },
  {
    "path": "test/fixtures/VSSetup_VS_2022_VS2019_workload.txt",
    "content": "[\n    {\n    \"InstanceId\":  \"621862c0\",\n    \"InstallationName\":  \"VisualStudio/17.8.3+34330.188\",\n    \"InstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"InstallationVersion\":  {\n                                \"Major\":  17,\n                                \"Minor\":  8,\n                                \"Build\":  34330,\n                                \"Revision\":  188,\n                                \"MajorRevision\":  0,\n                                \"MinorRevision\":  188\n                            },\n    \"InstallDate\":  \"\\/Date(1703254955000)\\/\",\n    \"State\":  4294967295,\n    \"DisplayName\":  \"Visual Studio Enterprise 2022\",\n    \"Description\":  \"Scalable, end-to-end solution for teams of any size\",\n    \"ProductPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\Common7\\\\IDE\\\\devenv.exe\",\n    \"Product\":  {\n                    \"Id\":  \"Microsoft.VisualStudio.Product.Enterprise\",\n                    \"Version\":  {\n                                    \"Major\":  17,\n                                    \"Minor\":  8,\n                                    \"Build\":  34330,\n                                    \"Revision\":  188,\n                                    \"MajorRevision\":  0,\n                                    \"MinorRevision\":  188\n                                },\n                    \"Chip\":  \"x64\",\n                    \"Branch\":  null,\n                    \"Type\":  \"Product\",\n                    \"IsExtension\":  false,\n                    \"UniqueId\":  \"Microsoft.VisualStudio.Product.Enterprise,version=17.8.34330.188,chip=x64\"\n                },\n    \"Packages\":  [\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Product.Enterprise\",\n                         \"Version\":  \"17.8.34330.188\",\n                         \"Chip\":  \"x64\",\n                         \"Branch\":  null,\n                         \"Type\":  \"Product\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Product.Enterprise,version=17.8.34330.188,chip=x64\"\n                     },\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n                         \"Version\":  \"17.8.34129.139\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Component\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64,version=17.8.34129.139\"\n                     },\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Component.Windows11SDK.22000\",\n                         \"Version\":  \"17.8.34129.139\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Component\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Component.Windows11SDK.22000,version=17.8.34129.139\"\n                     },\n                     {\n                         \"Id\":  \"Win11SDK_10.0.22000\",\n                         \"Version\":  \"10.0.22000.4\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Exe\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Win11SDK_10.0.22000,version=10.0.22000.4\"\n                     },\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Component.Windows10SDK.20348\",\n                         \"Version\":  \"17.8.34129.139\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Component\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Component.Windows10SDK.20348,version=17.8.34129.139\"\n                     },\n                     {\n                         \"Id\":  \"Win10SDK_10.0.20348\",\n                         \"Version\":  \"10.0.20348.3\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Exe\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Win10SDK_10.0.20348,version=10.0.20348.3\"\n                     }\n                 ],\n    \"Properties\":  [\n                       {\n                           \"Key\":  \"CampaignId\",\n                           \"Value\":  \"\"\n                       },\n                       {\n                           \"Key\":  \"SetupEngineFilePath\",\n                           \"Value\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\setup.exe\"\n                       },\n                       {\n                           \"Key\":  \"Nickname\",\n                           \"Value\":  \"\"\n                       },\n                       {\n                           \"Key\":  \"ChannelManifestId\",\n                           \"Value\":  \"VisualStudio.17.Release/17.8.3+34330.188\"\n                       }\n                   ],\n    \"Errors\":  null,\n    \"EnginePath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service\",\n    \"IsComplete\":  true,\n    \"IsLaunchable\":  true,\n    \"CatalogInfo\":  [\n                        {\n                            \"Key\":  \"Id\",\n                            \"Value\":  \"VisualStudio/17.8.3+34330.188\"\n                        },\n                        {\n                            \"Key\":  \"BuildBranch\",\n                            \"Value\":  \"d17.8\"\n                        },\n                        {\n                            \"Key\":  \"BuildVersion\",\n                            \"Value\":  \"17.8.34330.188\"\n                        }\n                    ],\n    \"IsPrerelease\":  false,\n    \"PSPath\":  \"Microsoft.PowerShell.Core\\\\FileSystem::C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"UpdateDate\":  \"2023-12-22T14:22:35.1818213Z\",\n    \"ResolvedInstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"ChannelId\":  \"VisualStudio.17.Release\",\n    \"InstalledChannelId\":  \"VisualStudio.17.Release\",\n    \"ChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n    \"InstalledChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n    \"ReleaseNotes\":  \"https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.8#17.8.3\",\n    \"ThirdPartyNotices\":  \"https://go.microsoft.com/fwlink/?LinkId=661288\"\n},\n{\n        \"InstanceId\":  \"2619cf21\",\n        \"InstallationName\":  \"VisualStudio/16.11.33+34407.143\",\n        \"InstallationPath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Professional\",\n        \"InstallationVersion\":  {\n                                    \"Major\":  16,\n                                    \"Minor\":  11,\n                                    \"Build\":  34407,\n                                    \"Revision\":  143,\n                                    \"MajorRevision\":  0,\n                                    \"MinorRevision\":  143\n                                },\n        \"InstallDate\":  \"\\/Date(1706804943503)\\/\",\n        \"State\":  4294967295,\n        \"DisplayName\":  \"Visual Studio Professional 2019\",\n        \"Description\":  \"Professional IDE best suited to small teams\",\n        \"ProductPath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Professional\\\\Common7\\\\IDE\\\\devenv.exe\",\n        \"Product\":  {\n                        \"Id\":  \"Microsoft.VisualStudio.Product.Professional\",\n                        \"Version\":  {\n                                        \"Major\":  16,\n                                        \"Minor\":  11,\n                                        \"Build\":  34407,\n                                        \"Revision\":  143,\n                                        \"MajorRevision\":  0,\n                                        \"MinorRevision\":  143\n                                    },\n                        \"Chip\":  null,\n                        \"Branch\":  null,\n                        \"Type\":  \"Product\",\n                        \"IsExtension\":  false,\n                        \"UniqueId\":  \"Microsoft.VisualStudio.Product.Professional,version=16.11.34407.143\"\n                    },\n        \"Packages\":  [\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.Product.Professional\",\n                             \"Version\":  \"16.11.34407.143\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Product\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.Product.Professional,version=16.11.34407.143\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.Component.VC.14.29.16.10.ATL\",\n                             \"Version\":  \"16.11.31314.313\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Component\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.Component.VC.14.29.16.10.ATL,version=16.11.31314.313\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.X64.v142\",\n                             \"Version\":  \"16.11.31503.54\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.X64.v142,version=16.11.31503.54\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.X64\",\n                             \"Version\":  \"16.11.31503.54\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.X64,version=16.11.31503.54\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.x86.v142\",\n                             \"Version\":  \"16.11.31503.54\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.x86.v142,version=16.11.31503.54\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.X86\",\n                             \"Version\":  \"16.11.31503.54\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.X86,version=16.11.31503.54\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.Base\",\n                             \"Version\":  \"16.11.31829.152\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.Base,version=16.11.31829.152\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\n                             \"Version\":  \"16.11.31829.152\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.MSBuild.Base.Resources,version=16.11.31829.152,language=en-US\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.Branding.Professional\",\n                             \"Version\":  \"16.11.31605.320\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.Branding.Professional,version=16.11.31605.320,language=en-US\"\n                         },\n                         {\n                            \"Id\":  \"Microsoft.VisualStudio.Component.Windows10SDK.19041\",\n                            \"Version\":  \"16.10.31205.252\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Component\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Microsoft.VisualStudio.Component.Windows10SDK.19041,version=16.10.31205.252\"\n                        },\n                        {\n                            \"Id\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n                            \"Version\":  \"16.11.32406.258\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Component\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64,version=16.11.32406.258\"\n                        }\n                     ],\n        \"Properties\":  [\n                           {\n                               \"Key\":  \"CampaignId\",\n                               \"Value\":  \"09\"\n                           },\n                           {\n                               \"Key\":  \"SetupEngineFilePath\",\n                               \"Value\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\setup.exe\"\n                           },\n                           {\n                               \"Key\":  \"Nickname\",\n                               \"Value\":  \"\"\n                           },\n                           {\n                               \"Key\":  \"ChannelManifestId\",\n                               \"Value\":  \"VisualStudio.16.Release/16.11.33+34407.143\"\n                           }\n                       ],\n        \"Errors\":  null,\n        \"EnginePath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service\",\n        \"IsComplete\":  true,\n        \"IsLaunchable\":  true,\n        \"CatalogInfo\":  [\n                            {\n                                \"Key\":  \"Id\",\n                                \"Value\":  \"VisualStudio/16.11.33+34407.143\"\n                            },\n                            {\n                                \"Key\":  \"BuildBranch\",\n                                \"Value\":  \"d16.11\"\n                            },\n                            {\n                                \"Key\":  \"BuildVersion\",\n                                \"Value\":  \"16.11.34407.143\"\n                            },\n                            {\n                                \"Key\":  \"LocalBuild\",\n                                \"Value\":  \"build-lab\"\n                            },\n                            {\n                                \"Key\":  \"ManifestName\",\n                                \"Value\":  \"VisualStudio\"\n                            },\n                            {\n                                \"Key\":  \"ManifestType\",\n                                \"Value\":  \"installer\"\n                            },\n                            {\n                                \"Key\":  \"ProductDisplayVersion\",\n                                \"Value\":  \"16.11.33\"\n                            },\n                            {\n                                \"Key\":  \"ProductLine\",\n                                \"Value\":  \"Dev16\"\n                            },\n                            {\n                                \"Key\":  \"ProductLineVersion\",\n                                \"Value\":  \"2019\"\n                            },\n                            {\n                                \"Key\":  \"ProductMilestone\",\n                                \"Value\":  \"RTW\"\n                            },\n                            {\n                                \"Key\":  \"ProductMilestoneIsPreRelease\",\n                                \"Value\":  \"False\"\n                            },\n                            {\n                                \"Key\":  \"ProductName\",\n                                \"Value\":  \"Visual Studio\"\n                            },\n                            {\n                                \"Key\":  \"ProductPatchVersion\",\n                                \"Value\":  \"33\"\n                            },\n                            {\n                                \"Key\":  \"ProductPreReleaseMilestoneSuffix\",\n                                \"Value\":  \"1.0\"\n                            },\n                            {\n                                \"Key\":  \"ProductSemanticVersion\",\n                                \"Value\":  \"16.11.33+34407.143\"\n                            },\n                            {\n                                \"Key\":  \"RequiredEngineVersion\",\n                                \"Value\":  \"2.11.72.18200\"\n                            }\n                        ],\n        \"IsPrerelease\":  false,\n        \"PSPath\":  \"Microsoft.PowerShell.Core\\\\FileSystem::C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"UpdateDate\":  \"2024-01-09T19:19:11.0115234Z\",\n        \"ResolvedInstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"ChannelId\":  \"VisualStudio.17.Release\",\n        \"InstalledChannelId\":  \"VisualStudio.17.Release\",\n        \"ChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n        \"InstalledChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n        \"ReleaseNotes\":  \"https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.8#17.8.4\",\n        \"ThirdPartyNotices\":  \"https://go.microsoft.com/fwlink/?LinkId=661288\"\n    }\n]\n"
  },
  {
    "path": "test/fixtures/VSSetup_VS_2022_multiple_install.txt",
    "content": "[\n    {\n        \"InstanceId\":  \"621862c0\",\n        \"InstallationName\":  \"VisualStudio/17.8.3+34330.188\",\n        \"InstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"InstallationVersion\":  {\n                                    \"Major\":  17,\n                                    \"Minor\":  8,\n                                    \"Build\":  34330,\n                                    \"Revision\":  188,\n                                    \"MajorRevision\":  0,\n                                    \"MinorRevision\":  188\n                                },\n        \"InstallDate\":  \"\\/Date(1703254955000)\\/\",\n        \"State\":  4294967295,\n        \"DisplayName\":  \"Visual Studio Enterprise 2022\",\n        \"Description\":  \"Scalable, end-to-end solution for teams of any size\",\n        \"ProductPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\Common7\\\\IDE\\\\devenv.exe\",\n        \"Product\":  {\n                        \"Id\":  \"Microsoft.VisualStudio.Product.Enterprise\",\n                        \"Version\":  {\n                                        \"Major\":  17,\n                                        \"Minor\":  8,\n                                        \"Build\":  34330,\n                                        \"Revision\":  188,\n                                        \"MajorRevision\":  0,\n                                        \"MinorRevision\":  188\n                                    },\n                        \"Chip\":  \"x64\",\n                        \"Branch\":  null,\n                        \"Type\":  \"Product\",\n                        \"IsExtension\":  false,\n                        \"UniqueId\":  \"Microsoft.VisualStudio.Product.Enterprise,version=17.8.34330.188,chip=x64\"\n                    },\n        \"Packages\":  [\n                         {\n                            \"Id\":  \"Microsoft.VisualStudio.Product.Enterprise\",\n                            \"Version\":  \"17.8.34330.188\",\n                            \"Chip\":  \"x64\",\n                            \"Branch\":  null,\n                            \"Type\":  \"Product\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Microsoft.VisualStudio.Product.Enterprise,version=17.8.34330.188,chip=x64\"\n                        },\n                        {\n                            \"Id\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n                            \"Version\":  \"17.8.34129.139\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Component\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64,version=17.8.34129.139\"\n                        },\n                        {\n                            \"Id\":  \"Microsoft.VisualStudio.Component.Windows11SDK.22000\",\n                            \"Version\":  \"17.8.34129.139\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Component\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Microsoft.VisualStudio.Component.Windows11SDK.22000,version=17.8.34129.139\"\n                        },\n                        {\n                            \"Id\":  \"Win11SDK_10.0.22000\",\n                            \"Version\":  \"10.0.22000.4\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Exe\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Win11SDK_10.0.22000,version=10.0.22000.4\"\n                        },\n                        {\n                            \"Id\":  \"Microsoft.VisualStudio.Component.Windows10SDK.20348\",\n                            \"Version\":  \"17.8.34129.139\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Component\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Microsoft.VisualStudio.Component.Windows10SDK.20348,version=17.8.34129.139\"\n                        },\n                        {\n                            \"Id\":  \"Win10SDK_10.0.20348\",\n                            \"Version\":  \"10.0.20348.3\",\n                            \"Chip\":  null,\n                            \"Branch\":  null,\n                            \"Type\":  \"Exe\",\n                            \"IsExtension\":  false,\n                            \"UniqueId\":  \"Win10SDK_10.0.20348,version=10.0.20348.3\"\n                        }\n                     ],\n        \"Properties\":  [\n                           {\n                               \"Key\":  \"CampaignId\",\n                               \"Value\":  \"\"\n                           },\n                           {\n                               \"Key\":  \"SetupEngineFilePath\",\n                               \"Value\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\setup.exe\"\n                           },\n                           {\n                               \"Key\":  \"Nickname\",\n                               \"Value\":  \"\"\n                           },\n                           {\n                               \"Key\":  \"ChannelManifestId\",\n                               \"Value\":  \"VisualStudio.17.Release/17.8.3+34330.188\"\n                           }\n                       ],\n        \"Errors\":  null,\n        \"EnginePath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service\",\n        \"IsComplete\":  true,\n        \"IsLaunchable\":  true,\n        \"CatalogInfo\":  [\n                            {\n                                \"Key\":  \"Id\",\n                                \"Value\":  \"VisualStudio/17.8.3+34330.188\"\n                            },\n                            {\n                                \"Key\":  \"BuildBranch\",\n                                \"Value\":  \"d17.8\"\n                            },\n                            {\n                                \"Key\":  \"BuildVersion\",\n                                \"Value\":  \"17.8.34330.188\"\n                            },\n                            {\n                                \"Key\":  \"LocalBuild\",\n                                \"Value\":  \"build-lab\"\n                            },\n                            {\n                                \"Key\":  \"ManifestName\",\n                                \"Value\":  \"VisualStudio\"\n                            },\n                            {\n                                \"Key\":  \"ManifestType\",\n                                \"Value\":  \"installer\"\n                            },\n                            {\n                                \"Key\":  \"ProductDisplayVersion\",\n                                \"Value\":  \"17.8.3\"\n                            },\n                            {\n                                \"Key\":  \"ProductLine\",\n                                \"Value\":  \"Dev17\"\n                            },\n                            {\n                                \"Key\":  \"ProductLineVersion\",\n                                \"Value\":  \"2022\"\n                            },\n                            {\n                                \"Key\":  \"ProductMilestone\",\n                                \"Value\":  \"RTW\"\n                            },\n                            {\n                                \"Key\":  \"ProductMilestoneIsPreRelease\",\n                                \"Value\":  \"False\"\n                            },\n                            {\n                                \"Key\":  \"ProductName\",\n                                \"Value\":  \"Visual Studio\"\n                            },\n                            {\n                                \"Key\":  \"ProductPatchVersion\",\n                                \"Value\":  \"3\"\n                            },\n                            {\n                                \"Key\":  \"ProductPreReleaseMilestoneSuffix\",\n                                \"Value\":  \"1.0\"\n                            },\n                            {\n                                \"Key\":  \"ProductSemanticVersion\",\n                                \"Value\":  \"17.8.3+34330.188\"\n                            },\n                            {\n                                \"Key\":  \"RequiredEngineVersion\",\n                                \"Value\":  \"3.8.2112.61926\"\n                            }\n                        ],\n        \"IsPrerelease\":  false,\n        \"PSPath\":  \"Microsoft.PowerShell.Core\\\\FileSystem::C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"UpdateDate\":  \"2023-12-22T14:22:35.1818213Z\",\n        \"ResolvedInstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"ChannelId\":  \"VisualStudio.17.Release\",\n        \"InstalledChannelId\":  \"VisualStudio.17.Release\",\n        \"ChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n        \"InstalledChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n        \"ReleaseNotes\":  \"https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.8#17.8.3\",\n        \"ThirdPartyNotices\":  \"https://go.microsoft.com/fwlink/?LinkId=661288\"\n    },\n    {\n        \"InstanceId\":  \"dd50c6cc\",\n        \"InstallationName\":  \"VisualStudio/17.8.3+34330.188\",\n        \"InstallationPath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2022\\\\BuildTools\",\n        \"InstallationVersion\":  {\n                                    \"Major\":  17,\n                                    \"Minor\":  8,\n                                    \"Build\":  34330,\n                                    \"Revision\":  188,\n                                    \"MajorRevision\":  0,\n                                    \"MinorRevision\":  188\n                                },\n        \"InstallDate\":  \"\\/Date(1703262914503)\\/\",\n        \"State\":  4294967295,\n        \"DisplayName\":  \"Visual Studio Build Tools 2022\",\n        \"Description\":  \"The Visual Studio Build Tools allows you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support.\",\n        \"ProductPath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2022\\\\BuildTools\\\\Common7\\\\Tools\\\\LaunchDevCmd.bat\",\n        \"Product\":  {\n                        \"Id\":  \"Microsoft.VisualStudio.Product.BuildTools\",\n                        \"Version\":  {\n                                        \"Major\":  17,\n                                        \"Minor\":  8,\n                                        \"Build\":  34330,\n                                        \"Revision\":  188,\n                                        \"MajorRevision\":  0,\n                                        \"MinorRevision\":  188\n                                    },\n                        \"Chip\":  null,\n                        \"Branch\":  null,\n                        \"Type\":  \"Product\",\n                        \"IsExtension\":  false,\n                        \"UniqueId\":  \"Microsoft.VisualStudio.Product.BuildTools,version=17.8.34330.188\"\n                    },\n        \"Packages\":  [\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.Product.BuildTools\",\n                             \"Version\":  \"17.8.34330.188\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Product\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.Product.BuildTools,version=17.8.34330.188\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.Workload.MSBuildTools\",\n                             \"Version\":  \"17.8.34129.139\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Workload\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.Workload.MSBuildTools,version=17.8.34129.139\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.NuGet.BuildTools\",\n                             \"Version\":  \"17.0.60800.131\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.NuGet.BuildTools,version=17.0.60800.131\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.Build.UnGAC\",\n                             \"Version\":  \"17.8.3.2351904\",\n                             \"Chip\":  \"neutral\",\n                             \"Branch\":  null,\n                             \"Type\":  \"Exe\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.Build.UnGAC,version=17.8.3.2351904,chip=neutral,language=neutral\"\n                         },\n                         {\n                             \"Id\":  \"Microsoft.VisualStudio.VC.Icons\",\n                             \"Version\":  \"17.8.34129.139\",\n                             \"Chip\":  null,\n                             \"Branch\":  null,\n                             \"Type\":  \"Vsix\",\n                             \"IsExtension\":  false,\n                             \"UniqueId\":  \"Microsoft.VisualStudio.VC.Icons,version=17.8.34129.139\"\n                         }\n                     ],\n        \"Properties\":  [\n                           {\n                               \"Key\":  \"CampaignId\",\n                               \"Value\":  \"09\"\n                           },\n                           {\n                               \"Key\":  \"SetupEngineFilePath\",\n                               \"Value\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\setup.exe\"\n                           },\n                           {\n                               \"Key\":  \"Nickname\",\n                               \"Value\":  \"2\"\n                           },\n                           {\n                               \"Key\":  \"ChannelManifestId\",\n                               \"Value\":  \"VisualStudio.17.Release/17.8.3+34330.188\"\n                           }\n                       ],\n        \"Errors\":  null,\n        \"EnginePath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service\",\n        \"IsComplete\":  true,\n        \"IsLaunchable\":  true,\n        \"CatalogInfo\":  [\n                            {\n                                \"Key\":  \"Id\",\n                                \"Value\":  \"VisualStudio/17.8.3+34330.188\"\n                            },\n                            {\n                                \"Key\":  \"BuildBranch\",\n                                \"Value\":  \"d17.8\"\n                            },\n                            {\n                                \"Key\":  \"BuildVersion\",\n                                \"Value\":  \"17.8.34330.188\"\n                            },\n                            {\n                                \"Key\":  \"LocalBuild\",\n                                \"Value\":  \"build-lab\"\n                            },\n                            {\n                                \"Key\":  \"ManifestName\",\n                                \"Value\":  \"VisualStudio\"\n                            },\n                            {\n                                \"Key\":  \"ManifestType\",\n                                \"Value\":  \"installer\"\n                            },\n                            {\n                                \"Key\":  \"ProductDisplayVersion\",\n                                \"Value\":  \"17.8.3\"\n                            },\n                            {\n                                \"Key\":  \"ProductLine\",\n                                \"Value\":  \"Dev17\"\n                            },\n                            {\n                                \"Key\":  \"ProductLineVersion\",\n                                \"Value\":  \"2022\"\n                            },\n                            {\n                                \"Key\":  \"ProductMilestone\",\n                                \"Value\":  \"RTW\"\n                            },\n                            {\n                                \"Key\":  \"ProductMilestoneIsPreRelease\",\n                                \"Value\":  \"False\"\n                            },\n                            {\n                                \"Key\":  \"ProductName\",\n                                \"Value\":  \"Visual Studio\"\n                            },\n                            {\n                                \"Key\":  \"ProductPatchVersion\",\n                                \"Value\":  \"3\"\n                            },\n                            {\n                                \"Key\":  \"ProductPreReleaseMilestoneSuffix\",\n                                \"Value\":  \"1.0\"\n                            },\n                            {\n                                \"Key\":  \"ProductSemanticVersion\",\n                                \"Value\":  \"17.8.3+34330.188\"\n                            },\n                            {\n                                \"Key\":  \"RequiredEngineVersion\",\n                                \"Value\":  \"3.8.2112.61926\"\n                            }\n                        ],\n        \"IsPrerelease\":  false,\n        \"PSPath\":  \"Microsoft.PowerShell.Core\\\\FileSystem::C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"UpdateDate\":  \"2023-12-22T14:22:35.1818213Z\",\n        \"ResolvedInstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n        \"ChannelId\":  \"VisualStudio.17.Release\",\n        \"InstalledChannelId\":  \"VisualStudio.17.Release\",\n        \"ChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n        \"InstalledChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n        \"ReleaseNotes\":  \"https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.8#17.8.3\",\n        \"ThirdPartyNotices\":  \"https://go.microsoft.com/fwlink/?LinkId=661288\"\n    }\n]\n"
  },
  {
    "path": "test/fixtures/VSSetup_VS_2022_workload.txt",
    "content": "{\n    \"InstanceId\":  \"621862c0\",\n    \"InstallationName\":  \"VisualStudio/17.8.3+34330.188\",\n    \"InstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"InstallationVersion\":  {\n                                \"Major\":  17,\n                                \"Minor\":  8,\n                                \"Build\":  34330,\n                                \"Revision\":  188,\n                                \"MajorRevision\":  0,\n                                \"MinorRevision\":  188\n                            },\n    \"InstallDate\":  \"\\/Date(1703254955000)\\/\",\n    \"State\":  4294967295,\n    \"DisplayName\":  \"Visual Studio Enterprise 2022\",\n    \"Description\":  \"Scalable, end-to-end solution for teams of any size\",\n    \"ProductPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\Common7\\\\IDE\\\\devenv.exe\",\n    \"Product\":  {\n                    \"Id\":  \"Microsoft.VisualStudio.Product.Enterprise\",\n                    \"Version\":  {\n                                    \"Major\":  17,\n                                    \"Minor\":  8,\n                                    \"Build\":  34330,\n                                    \"Revision\":  188,\n                                    \"MajorRevision\":  0,\n                                    \"MinorRevision\":  188\n                                },\n                    \"Chip\":  \"x64\",\n                    \"Branch\":  null,\n                    \"Type\":  \"Product\",\n                    \"IsExtension\":  false,\n                    \"UniqueId\":  \"Microsoft.VisualStudio.Product.Enterprise,version=17.8.34330.188,chip=x64\"\n                },\n    \"Packages\":  [\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Product.Enterprise\",\n                         \"Version\":  \"17.8.34330.188\",\n                         \"Chip\":  \"x64\",\n                         \"Branch\":  null,\n                         \"Type\":  \"Product\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Product.Enterprise,version=17.8.34330.188,chip=x64\"\n                     },\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n                         \"Version\":  \"17.8.34129.139\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Component\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64,version=17.8.34129.139\"\n                     },\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Component.Windows11SDK.22000\",\n                         \"Version\":  \"17.8.34129.139\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Component\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Component.Windows11SDK.22000,version=17.8.34129.139\"\n                     },\n                     {\n                         \"Id\":  \"Win11SDK_10.0.22000\",\n                         \"Version\":  \"10.0.22000.4\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Exe\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Win11SDK_10.0.22000,version=10.0.22000.4\"\n                     },\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Component.Windows10SDK.20348\",\n                         \"Version\":  \"17.8.34129.139\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Component\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Component.Windows10SDK.20348,version=17.8.34129.139\"\n                     },\n                     {\n                         \"Id\":  \"Win10SDK_10.0.20348\",\n                         \"Version\":  \"10.0.20348.3\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Exe\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Win10SDK_10.0.20348,version=10.0.20348.3\"\n                     }\n                 ],\n    \"Properties\":  [\n                       {\n                           \"Key\":  \"CampaignId\",\n                           \"Value\":  \"\"\n                       },\n                       {\n                           \"Key\":  \"SetupEngineFilePath\",\n                           \"Value\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\setup.exe\"\n                       },\n                       {\n                           \"Key\":  \"Nickname\",\n                           \"Value\":  \"\"\n                       },\n                       {\n                           \"Key\":  \"ChannelManifestId\",\n                           \"Value\":  \"VisualStudio.17.Release/17.8.3+34330.188\"\n                       }\n                   ],\n    \"Errors\":  null,\n    \"EnginePath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service\",\n    \"IsComplete\":  true,\n    \"IsLaunchable\":  true,\n    \"CatalogInfo\":  [\n                        {\n                            \"Key\":  \"Id\",\n                            \"Value\":  \"VisualStudio/17.8.3+34330.188\"\n                        },\n                        {\n                            \"Key\":  \"BuildBranch\",\n                            \"Value\":  \"d17.8\"\n                        },\n                        {\n                            \"Key\":  \"BuildVersion\",\n                            \"Value\":  \"17.8.34330.188\"\n                        }\n                    ],\n    \"IsPrerelease\":  false,\n    \"PSPath\":  \"Microsoft.PowerShell.Core\\\\FileSystem::C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"UpdateDate\":  \"2023-12-22T14:22:35.1818213Z\",\n    \"ResolvedInstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"ChannelId\":  \"VisualStudio.17.Release\",\n    \"InstalledChannelId\":  \"VisualStudio.17.Release\",\n    \"ChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n    \"InstalledChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n    \"ReleaseNotes\":  \"https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.8#17.8.3\",\n    \"ThirdPartyNotices\":  \"https://go.microsoft.com/fwlink/?LinkId=661288\"\n}\n"
  },
  {
    "path": "test/fixtures/VSSetup_VS_2022_workload_missing_sdk.txt",
    "content": "{\n    \"InstanceId\":  \"621862c0\",\n    \"InstallationName\":  \"VisualStudio/17.8.3+34330.188\",\n    \"InstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"InstallationVersion\":  {\n                                \"Major\":  17,\n                                \"Minor\":  8,\n                                \"Build\":  34330,\n                                \"Revision\":  188,\n                                \"MajorRevision\":  0,\n                                \"MinorRevision\":  188\n                            },\n    \"InstallDate\":  \"\\/Date(1703254955000)\\/\",\n    \"State\":  4294967295,\n    \"DisplayName\":  \"Visual Studio Enterprise 2022\",\n    \"Description\":  \"Scalable, end-to-end solution for teams of any size\",\n    \"ProductPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\Common7\\\\IDE\\\\devenv.exe\",\n    \"Product\":  {\n                    \"Id\":  \"Microsoft.VisualStudio.Product.Enterprise\",\n                    \"Version\":  {\n                                    \"Major\":  17,\n                                    \"Minor\":  8,\n                                    \"Build\":  34330,\n                                    \"Revision\":  188,\n                                    \"MajorRevision\":  0,\n                                    \"MinorRevision\":  188\n                                },\n                    \"Chip\":  \"x64\",\n                    \"Branch\":  null,\n                    \"Type\":  \"Product\",\n                    \"IsExtension\":  false,\n                    \"UniqueId\":  \"Microsoft.VisualStudio.Product.Enterprise,version=17.8.34330.188,chip=x64\"\n                },\n    \"Packages\":  [\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Product.Enterprise\",\n                         \"Version\":  \"17.8.34330.188\",\n                         \"Chip\":  \"x64\",\n                         \"Branch\":  null,\n                         \"Type\":  \"Product\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Product.Enterprise,version=17.8.34330.188,chip=x64\"\n                     },\n                     {\n                         \"Id\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n                         \"Version\":  \"17.8.34129.139\",\n                         \"Chip\":  null,\n                         \"Branch\":  null,\n                         \"Type\":  \"Component\",\n                         \"IsExtension\":  false,\n                         \"UniqueId\":  \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64,version=17.8.34129.139\"\n                     },\n                 ],\n    \"Properties\":  [\n                       {\n                           \"Key\":  \"CampaignId\",\n                           \"Value\":  \"\"\n                       },\n                       {\n                           \"Key\":  \"SetupEngineFilePath\",\n                           \"Value\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\setup.exe\"\n                       },\n                       {\n                           \"Key\":  \"Nickname\",\n                           \"Value\":  \"\"\n                       },\n                       {\n                           \"Key\":  \"ChannelManifestId\",\n                           \"Value\":  \"VisualStudio.17.Release/17.8.3+34330.188\"\n                       }\n                   ],\n    \"Errors\":  null,\n    \"EnginePath\":  \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service\",\n    \"IsComplete\":  true,\n    \"IsLaunchable\":  true,\n    \"CatalogInfo\":  [\n                        {\n                            \"Key\":  \"Id\",\n                            \"Value\":  \"VisualStudio/17.8.3+34330.188\"\n                        },\n                        {\n                            \"Key\":  \"BuildBranch\",\n                            \"Value\":  \"d17.8\"\n                        },\n                        {\n                            \"Key\":  \"BuildVersion\",\n                            \"Value\":  \"17.8.34330.188\"\n                        },\n                        {\n                            \"Key\":  \"LocalBuild\",\n                            \"Value\":  \"build-lab\"\n                        },\n                        {\n                            \"Key\":  \"ManifestName\",\n                            \"Value\":  \"VisualStudio\"\n                        },\n                        {\n                            \"Key\":  \"ManifestType\",\n                            \"Value\":  \"installer\"\n                        },\n                        {\n                            \"Key\":  \"ProductDisplayVersion\",\n                            \"Value\":  \"17.8.3\"\n                        },\n                        {\n                            \"Key\":  \"ProductLine\",\n                            \"Value\":  \"Dev17\"\n                        },\n                        {\n                            \"Key\":  \"ProductLineVersion\",\n                            \"Value\":  \"2022\"\n                        },\n                        {\n                            \"Key\":  \"ProductMilestone\",\n                            \"Value\":  \"RTW\"\n                        },\n                        {\n                            \"Key\":  \"ProductMilestoneIsPreRelease\",\n                            \"Value\":  \"False\"\n                        },\n                        {\n                            \"Key\":  \"ProductName\",\n                            \"Value\":  \"Visual Studio\"\n                        },\n                        {\n                            \"Key\":  \"ProductPatchVersion\",\n                            \"Value\":  \"3\"\n                        },\n                        {\n                            \"Key\":  \"ProductPreReleaseMilestoneSuffix\",\n                            \"Value\":  \"1.0\"\n                        },\n                        {\n                            \"Key\":  \"ProductSemanticVersion\",\n                            \"Value\":  \"17.8.3+34330.188\"\n                        },\n                        {\n                            \"Key\":  \"RequiredEngineVersion\",\n                            \"Value\":  \"3.8.2112.61926\"\n                        }\n                    ],\n    \"IsPrerelease\":  false,\n    \"PSPath\":  \"Microsoft.PowerShell.Core\\\\FileSystem::C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"UpdateDate\":  \"2023-12-22T14:22:35.1818213Z\",\n    \"ResolvedInstallationPath\":  \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\",\n    \"ChannelId\":  \"VisualStudio.17.Release\",\n    \"InstalledChannelId\":  \"VisualStudio.17.Release\",\n    \"ChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n    \"InstalledChannelUri\":  \"https://aka.ms/vs/17/release/channel\",\n    \"ReleaseNotes\":  \"https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.8#17.8.3\",\n    \"ThirdPartyNotices\":  \"https://go.microsoft.com/fwlink/?LinkId=661288\"\n}\n"
  },
  {
    "path": "test/fixtures/VS_2017_BuildTools_minimal.txt",
    "content": "[{\"path\":\"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\BuildTools\",\"version\":\"15.9.28307.665\",\"packages\":[\"Microsoft.VisualStudio.Product.BuildTools\",\"Microsoft.VisualStudio.Component.VC.CoreIde\",\"Microsoft.VisualStudio.VC.Ide.Pro\",\"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\"Microsoft.VisualStudio.VC.Templates.Pro\",\"Microsoft.VisualStudio.VC.Templates.Pro.Resources\",\"Microsoft.VisualStudio.VC.Items.Pro\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\"Microsoft.VisualStudio.VC.Ide.MDD\",\"Microsoft.VisualStudio.VC.Ide.x64\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\"Microsoft.VisualStudio.JavaScript.LanguageService\",\"Microsoft.VisualStudio.JavaScript.LanguageService.Resources\",\"Microsoft.VisualStudio.Debugger.Script.Msi\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\"Microsoft.VisualStudio.VC.Ide.Dskx\",\"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\"Microsoft.VisualStudio.VC.Ide.Core\",\"Microsoft.VisualStudio.VC.Ide.Core.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base\",\"Microsoft.VisualStudio.VC.Ide.LanguageService\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\"Microsoft.VisualStudio.PackageGroup.Core\",\"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\"Microsoft.VisualStudio.VC.Ide.Debugger\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\"Microsoft.VisualStudio.VC.Ide.Common\",\"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\"Microsoft.VisualStudio.Debugger.Parallel\",\"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\"Microsoft.VisualStudio.Debugger.CollectionAgents\",\"Microsoft.VisualStudio.Debugger.Managed\",\"Microsoft.CodeAnalysis.VisualStudio.Setup.Resources\",\"Microsoft.CodeAnalysis.VisualStudio.Setup\",\"Microsoft.CodeAnalysis.ExpressionEvaluator.Resources\",\"Microsoft.CodeAnalysis.ExpressionEvaluator\",\"Microsoft.VisualStudio.Debugger.Managed.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger\",\"Microsoft.VisualStudio.VC.MSVCDis\",\"Microsoft.VisualStudio.ScriptedHost\",\"Microsoft.VisualStudio.ScriptedHost.Targeted\",\"Microsoft.VisualStudio.ScriptedHost.Resources\",\"Microsoft.IntelliTrace.DiagnosticsHub\",\"Microsoft.VisualStudio.Debugger.Resources\",\"Microsoft.PackageGroup.ClientDiagnostics\",\"Microsoft.VisualStudio.AppResponsiveness\",\"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\"Microsoft.VisualStudio.AppResponsiveness.Resources\",\"Microsoft.VisualStudio.ClientDiagnostics\",\"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\"Microsoft.VisualStudio.ProjectSystem.Full\",\"Microsoft.VisualStudio.ProjectSystem\",\"Microsoft.VisualStudio.Community.x86\",\"Microsoft.VisualStudio.Community.x64\",\"Microsoft.VisualStudio.Community\",\"Microsoft.IntelliTrace.CollectorCab\",\"Microsoft.VisualStudio.Community.Resources\",\"Microsoft.VisualStudio.WebSiteProject.DTE\",\"Microsoft.MSHtml\",\"Microsoft.VisualStudio.Community.Msi.Resources\",\"Microsoft.VisualStudio.Community.Msi\",\"Microsoft.VisualStudio.MinShell.Interop.Msi\",\"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\"PortableFacades\",\"Microsoft.VisualStudio.VirtualTree\",\"Microsoft.VisualStudio.PackageGroup.Progression\",\"Microsoft.VisualStudio.PerformanceProvider\",\"Microsoft.VisualStudio.GraphModel\",\"Microsoft.VisualStudio.GraphProvider\",\"Microsoft.DiaSymReader\",\"Microsoft.VisualStudio.TextMateGrammars\",\"Microsoft.VisualStudio.PackageGroup.TeamExplorer\",\"Microsoft.TeamFoundation.OfficeIntegration\",\"Microsoft.TeamFoundation.OfficeIntegration.Resources\",\"Microsoft.VisualStudio.TeamExplorer\",\"Microsoft.ServiceHub\",\"Microsoft.VisualStudio.ProjectServices\",\"Microsoft.VisualStudio.SLNX.VSIX\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.PackageGroup.MinShell\",\"Microsoft.VisualStudio.MinShell.Msi\",\"Microsoft.VisualStudio.MinShell.Msi.Resources\",\"Microsoft.VisualStudio.MinShell.Interop\",\"Microsoft.VisualStudio.Log\",\"Microsoft.VisualStudio.Log.Targeted\",\"Microsoft.VisualStudio.Log.Resources\",\"Microsoft.VisualStudio.Finalizer\",\"Microsoft.VisualStudio.CoreEditor\",\"Microsoft.VisualStudio.Connected\",\"Microsoft.VisualStudio.Connected.Resources\",\"Microsoft.VisualStudio.MinShell\",\"Microsoft.VisualStudio.MinShell.Platform\",\"Microsoft.VisualStudio.MinShell.Platform.Resources\",\"Microsoft.VisualStudio.MefHosting\",\"Microsoft.VisualStudio.MefHosting.Resources\",\"Microsoft.VisualStudio.Initializer\",\"Microsoft.VisualStudio.ExtensionManager\",\"Microsoft.VisualStudio.Editors\",\"Microsoft.Net.4.TargetingPack\",\"Microsoft.VisualStudio.Component.Windows10SDK.17134\",\"Win10SDK_10.0.17134\",\"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources\",\"Microsoft.VisualStudio.Component.Static.Analysis.Tools\",\"Microsoft.VisualStudio.StaticAnalysis\",\"Microsoft.VisualStudio.StaticAnalysis.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX86\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX64\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.PGO.X86\",\"Microsoft.VisualCpp.PGO.X64\",\"Microsoft.VisualCpp.PGO.Headers\",\"Microsoft.VisualCpp.CRT.x86.Store\",\"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Store\",\"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX64\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.Core.Resources\",\"Microsoft.VisualCpp.Tools.Core.x86\",\"Microsoft.VisualCpp.Tools.Common.Utils\",\"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\"Microsoft.VisualCpp.DIA.SDK\",\"Microsoft.VisualCpp.CRT.x86.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Desktop\",\"Microsoft.VisualCpp.CRT.Source\",\"Microsoft.VisualCpp.CRT.Redist.X86\",\"Microsoft.VisualCpp.CRT.Redist.X64\",\"Microsoft.VisualCpp.CRT.Redist.Resources\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.CRT.Headers\",\"Microsoft.VisualStudio.VC.MSBuild.X86\",\"Microsoft.VisualStudio.VC.MSBuild.X64\",\"Microsoft.VS.VC.MSBuild.X64.Resources\",\"Microsoft.VisualStudio.VC.MSBuild.Base\",\"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\"Microsoft.VisualStudio.VC.MSBuild.ARM\",\"Microsoft.VisualStudio.Workload.MSBuildTools\",\"Microsoft.VisualStudio.Component.CoreBuildTools\",\"Microsoft.VisualStudio.Setup.Configuration\",\"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\"Microsoft.VisualStudio.VC.DevCmd\",\"Microsoft.VisualStudio.VC.DevCmd.Resources\",\"Microsoft.VisualStudio.BuildTools.Resources\",\"Microsoft.VisualStudio.Net.Eula.Resources\",\"Microsoft.Build.Dependencies\",\"Microsoft.Build.FileTracker.Msi\",\"Microsoft.Component.MSBuild\",\"Microsoft.PythonTools.BuildCore.Vsix\",\"Microsoft.NuGet.Build.Tasks\",\"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\"Microsoft.CodeAnalysis.Compilers.Resources\",\"Microsoft.CodeAnalysis.Compilers\",\"Microsoft.Net.PackageGroup.4.6.1.Redist\",\"Microsoft.VisualStudio.NativeImageSupport\",\"Microsoft.Build\"]}]\n"
  },
  {
    "path": "test/fixtures/VS_2017_Community_workload.txt",
    "content": "[{\"path\":\"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\Community\",\"version\":\"15.9.28307.665\",\"packages\":[\"Microsoft.VisualStudio.Component.Windows10SDK.IpOverUsb\",\"Win10SDK_IpOverUsb\",\"Microsoft.VisualStudio.Component.VC.ATL.ARM64\",\"Microsoft.VisualCpp.ATL.ARM64\",\"Microsoft.VisualStudio.Component.VC.ATL.ARM\",\"Microsoft.VisualCpp.ATL.ARM\",\"Microsoft.VisualStudio.Component.VC.Tools.ARM\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualStudio.Graphics.Analyzer.Resources\",\"Microsoft.Icecap.Analysis\",\"Microsoft.VisualCpp.CRT.Redist.arm.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.arm.Store\",\"Microsoft.VisualCpp.CRT.arm.Desktop\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM\",\"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetARM.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM.Resources\",\"Microsoft.VisualCpp.Premium.Tools.ARM.Base\",\"Microsoft.VisualCpp.Premium.Tools.ARM.Base.Resources\",\"Microsoft.VisualCpp.PGO.ARM\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\"Microsoft.VisualStudio.Product.Community\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetarm\",\"Microsoft.VisualStudio.Component.VC.Tools.ARM64\",\"Microsoft.VisualStudio.VC.MSBuild.Arm64\",\"Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX64\",\"Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.ARM64.Store\",\"Microsoft.VisualCpp.CRT.ARM64.Desktop\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources\",\"Microsoft.Icecap.Analysis.Resources\",\"Microsoft.VisualCpp.VCTip.hostX86.targetARM\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM64\",\"Microsoft.VisualCpp.Tools.Core\",\"Microsoft.VisualCpp.PGO.ARM64\",\"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm64\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetARM64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.ARM64.Base\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.Tools.HostX86.TargetARM.Resources\",\"Microsoft.VisualCpp.CRT.Redist.ARM64\",\"Microsoft.VisualCpp.CRT.arm.OneCore.Desktop\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X86\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X64\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX86\",\"Component.WixToolset.VisualStudioExtension.Dev15\",\"WixToolset.VisualStudioExtension.Dev15\",\"Microsoft.VisualCpp.MFC.X64\",\"Microsoft.VisualCpp.ATL.Headers\",\"Microsoft.VisualStudio.Component.VC.CMake.Project\",\"Microsoft.VisualStudio.VC.CMake\",\"Microsoft.VisualStudio.VC.CMake.Project\",\"Microsoft.VisualStudio.Component.Windows10SDK.17763\",\"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\"MLGen\",\"Microsoft.VisualStudio.Graphics.Analyzer\",\"Microsoft.VisualStudio.Component.TestTools.Core\",\"Microsoft.VisualCpp.Tools.Core.x86\",\"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.DIA.SDK\",\"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\"Microsoft.VisualStudio.NuGet.Licenses\",\"SQLCommon\",\"Microsoft.VisualStudio.VC.MSBuild.X86\",\"Microsoft.VisualCpp.Tools.HostX64.TargetARM\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources\",\"Microsoft.VisualCpp.HTMLHelpWorkshop.Msi\",\"Microsoft.Icecap.Collection.Msi.Resources\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.VCTip.hostX64.targetARM\",\"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\"Microsoft.VisualStudio.VC.Templates.UnitTest\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP\",\"Microsoft.VisualStudio.VC.Ide.Core\",\"Microsoft.VisualStudio.Graphics.Appid\",\"Microsoft.VisualCpp.ATL.Source\",\"Microsoft.VisualStudio.VC.Ide.Core.Resources\",\"Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi\",\"Microsoft.VisualStudio.Debugger.JustInTime\",\"Microsoft.DiagnosticsHub.CpuSampling\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res\",\"Microsoft.VisualStudio.ProTools.Resources\",\"Microsoft.VisualStudio.Community.Msi\",\"Microsoft.VisualCpp.Tools.HostX64.TargetARM.Resources\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent\",\"Microsoft.Component.MSBuild\",\"Microsoft.VisualStudio.Graphics.Msi\",\"Microsoft.VisualStudio.WebToolsExtensions\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetarm64\",\"Microsoft.VisualStudio.TextTemplating.MSBuild\",\"Microsoft.VisualCpp.VCTip.hostX86.targetARM64\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\"Microsoft.VisualCpp.Tools.HostX86.TargetARM64.Resources\",\"Microsoft.VisualStudio.RazorExtension\",\"Microsoft.VisualCpp.CRT.x86.Store\",\"Microsoft.VisualCpp.Tools.Core.Resources\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualCpp.MFC.Source\",\"Microsoft.VisualCpp.CRT.x86.Desktop\",\"Microsoft.VisualStudio.VC.MSBuild.X64\",\"Microsoft.VisualStudio.VC.Items.Pro\",\"Microsoft.VisualStudio.Graphics.Viewers\",\"Microsoft.VisualCpp.CRT.x64.Desktop\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources\",\"Microsoft.VisualCpp.MFC.Redist.X86\",\"Microsoft.VisualStudio.WebToolsExtensions.Chip\",\"Microsoft.DiagnosticsHub.Runtime.Resources\",\"Microsoft.DiagnosticsHub.CpuSampling.Targeted\",\"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\"Microsoft.VisualStudio.Component.VC.DiagnosticTools\",\"Microsoft.VisualCpp.MFC.Redist.X64\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Native\",\"Microsoft.VisualStudio.Graphics.Viewers.Resources\",\"Microsoft.VisualCpp.MFC.MBCS\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Component.TextTemplating\",\"Win10SDK_10.0.17763\",\"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\"Microsoft.VisualCpp.MFC.MBCS.X64\",\"Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage\",\"Microsoft.VisualStudio.Graphics.EnableTools\",\"Microsoft.VisualStudio.Graphics.Appid.Resources\",\"Microsoft.VisualStudio.VC.MSBuild.Base\",\"Microsoft.VisualStudio.VC.MSBuild.ARM\",\"Microsoft.VisualCpp.MFC.Headers\",\"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\"Microsoft.VisualStudio.VC.Ide.Base\",\"Microsoft.VisualStudio.Graphics.Analyzer.Targeted\",\"Microsoft.VisualCpp.CRT.Headers\",\"Microsoft.DiagnosticsHub.Runtime.Targeted\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.Tools.HostX64.TargetARM64\",\"Microsoft.VisualCpp.VCTip.hostX64.targetARM64\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources\",\"Microsoft.Icecap.Collection.Msi\",\"Microsoft.VisualCpp.ATL.X86\",\"Microsoft.VisualCpp.Tools.HostX64.TargetARM64.Resources\",\"Microsoft.VisualStudio.Component.VC.ATLMFC\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX86\",\"Microsoft.Icecap.Collection.Msi.Resources.Targeted\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\"Microsoft.VisualStudio.Component.Graphics.Tools\",\"Microsoft.VisualStudio.WebTools.Resources\",\"Microsoft.VisualCpp.ATL.X64\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualStudio.Component.Graphics.Win81\",\"Microsoft.VisualStudio.VC.Ide.MDD\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\"Microsoft.Icecap.Analysis.Resources.Targeted\",\"Microsoft.VisualStudio.Debugger.Script.Msi\",\"Microsoft.VisualStudio.Component.VC.CoreIde\",\"Microsoft.VisualStudio.VC.Ide.MFC.Resources\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\"Microsoft.VisualStudio.TextTemplating.Core\",\"Microsoft.VisualStudio.JavaScript.LanguageService\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\"Microsoft.VisualStudio.VC.Ide.Dskx\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources\",\"Microsoft.CredentialProvider\",\"Microsoft.VisualStudio.VC.Templates.Desktop\",\"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core\",\"Microsoft.VisualStudio.TextTemplating.Integration\",\"Microsoft.VisualStudio.Component.NuGet\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\"Microsoft.VisualCpp.PGO.Headers\",\"Microsoft.DiagnosticsHub.Collection\",\"Microsoft.Icecap.Collection.Msi.Targeted\",\"Microsoft.VisualStudio.VC.Ide.LanguageService\",\"Microsoft.VisualStudio.WebTools.WSP.FSA\",\"Microsoft.VisualStudio.Graphics.Msi\",\"Microsoft.VisualCpp.CRT.Redist.X86\",\"Microsoft.VisualStudio.Branding.Community\",\"Microsoft.VisualStudio.VC.Ide.x64\",\"Microsoft.VisualStudio.WebToolsExtensions.Common\",\"Microsoft.VisualStudio.WebTools.MSBuild\",\"Microsoft.VisualStudio.NuGet.Core\",\"Microsoft.DiagnosticsHub.Collection.Service\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\"Microsoft.CodeAnalysis.ExpressionEvaluator\",\"Microsoft.VisualCpp.CRT.Redist.X64\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VS.VC.MSBuild.X64.Resources\",\"Microsoft.VisualCpp.CRT.Source\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources\",\"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.Redist.14.Latest\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.CRT.Redist.Resources\",\"Microsoft.VisualCpp.Redist.14.Latest\",\"Microsoft.Net.4.TargetingPack\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualCpp.CRT.x64.Store\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\"Microsoft.DiaSymReader.Native\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualStudio.StaticAnalysis\",\"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI\",\"Microsoft.VisualStudio.VC.Ide.Common\",\"Microsoft.VisualStudio.Community.Extra.Resources\",\"Microsoft.VisualStudio.Component.Roslyn.LanguageServices\",\"Microsoft.DiagnosticsHub.Collection.StopService.Install\",\"Microsoft.VisualStudio.InteractiveWindow\",\"Microsoft.PackageGroup.DiagnosticsHub.Platform\",\"Microsoft.VisualStudio.StaticAnalysis.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\"Microsoft.VisualStudio.VC.DevCmd\",\"Microsoft.VisualStudio.Community.Extra\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestTools\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Core\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI\",\"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\"Microsoft.VisualStudio.TestTools.Pex.Common\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy\",\"Microsoft.VisualStudio.PackageGroup.MinShell.Interop\",\"Microsoft.CodeAnalysis.ExpressionEvaluator.Resources\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\"Microsoft.VisualStudio.ScriptedHost.Targeted\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional\",\"Microsoft.VisualStudio.Debugger.Resources\",\"Microsoft.VisualStudio.Debugger.Parallel\",\"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\"Microsoft.VisualCpp.PGO.X64\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE\",\"Microsoft.VisualStudio.GraphModel\",\"Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors\",\"sqlsysclrtypes\",\"Microsoft.VisualStudio.ProTools\",\"Component.Microsoft.VisualStudio.RazorExtension\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI\",\"Microsoft.Build.Dependencies\",\"Microsoft.VisualStudio.WebTools.WSP.FSA.Resources\",\"Microsoft.VisualStudio.Component.Static.Analysis.Tools\",\"Microsoft.VisualStudio.VC.Ide.ATL.Resources\",\"Microsoft.VisualStudio.VC.Templates.UnitTest.Resources\",\"Microsoft.VisualStudio.Debugger.Managed\",\"Microsoft.VisualStudio.Workload.NativeDesktop\",\"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest\",\"Microsoft.VisualStudio.Debugger.JustInTime.Msi\",\"Microsoft.Net.PackageGroup.4.6.1.Redist\",\"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\"sqlsysclrtypes\",\"Microsoft.VisualStudio.Debugger.Managed.Resources\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common\",\"Microsoft.VisualStudio.VC.Ide.Debugger\",\"Microsoft.VisualStudio.AppResponsiveness\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.TestTools.TestWIExtension\",\"Microsoft.VisualStudio.VC.Ide.Pro\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\"Microsoft.VisualStudio.WebTools\",\"Microsoft.VisualStudio.Component.VC.Redist.14.Latest\",\"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\"Microsoft.VisualStudio.TestTools.TestPlatform.IDE\",\"Microsoft.VisualStudio.TextTemplating.Integration.Resources\",\"Microsoft.VisualStudio.Debugger.CollectionAgents\",\"Microsoft.VisualStudio.Debugger\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\"Microsoft.VisualStudio.VC.MSVCDis\",\"Microsoft.VisualStudio.ScriptedHost\",\"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\"Microsoft.VisualStudio.ScriptedHost.Resources\",\"Microsoft.TeamFoundation.OfficeIntegration.Resources\",\"Microsoft.IntelliTrace.DiagnosticsHub\",\"Microsoft.VisualStudio.JavaScript.LanguageService.Resources\",\"Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest\",\"Microsoft.VisualStudio.PackageGroup.Community\",\"Microsoft.VisualStudio.ClientDiagnostics\",\"Microsoft.VisualStudio.Component.Windows10SDK.17134\",\"Microsoft.VisualStudio.PackageGroup.Core\",\"PortableFacades\",\"Microsoft.DiaSymReader\",\"Microsoft.DiagnosticsHub.Runtime\",\"Microsoft.VisualStudio.Component.CoreEditor\",\"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\"Microsoft.VisualStudio.AppResponsiveness.Resources\",\"Microsoft.VisualStudio.Community\",\"Microsoft.TeamFoundation.OfficeIntegration\",\"Microsoft.VisualStudio.WebSiteProject.DTE\",\"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\"Microsoft.VisualStudio.ProjectSystem.Full\",\"Microsoft.VisualStudio.ProjectSystem\",\"Microsoft.VisualCpp.Tools.Common.UtilsPrereq\",\"Microsoft.IntelliTrace.CollectorCab\",\"Microsoft.VisualStudio.Community.Resources\",\"Microsoft.VisualCpp.Tools.Common.Utils\",\"Microsoft.ServiceHub\",\"Microsoft.VisualStudio.Editors\",\"Microsoft.VisualStudio.TeamExplorer\",\"Microsoft.CodeAnalysis.VisualStudio.InteractiveComponents.Resources\",\"Microsoft.VisualStudio.MinShell.Interop.Msi\",\"Microsoft.VisualStudio.GraphProvider\",\"Microsoft.CodeAnalysis.VisualStudio.InteractiveComponents\",\"Microsoft.CodeAnalysis.VisualStudio.Setup.Interactive.Resources\",\"Microsoft.CodeAnalysis.VisualStudio.Setup.Resources\",\"Microsoft.VisualStudio.Community.x86\",\"Microsoft.VisualStudio.Community.x64\",\"Microsoft.CodeAnalysis.VisualStudio.Setup\",\"Microsoft.NuGet.Build.Tasks\",\"Microsoft.PackageGroup.ClientDiagnostics\",\"Microsoft.CodeAnalysis.Compilers.Resources\",\"Microsoft.CodeAnalysis.Compilers\",\"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\"Microsoft.VisualStudio.Net.Eula.Resources\",\"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\"Microsoft.Build\",\"Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest\",\"Microsoft.VisualStudio.VC.Ide.ATL\",\"Microsoft.VisualStudio.TextMateGrammars\",\"Microsoft.VisualStudio.Workload.CoreEditor\",\"Microsoft.VisualStudio.MinShell.Interop\",\"Microsoft.Build.FileTracker.Msi\",\"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core\",\"Microsoft.MSHtml\",\"Microsoft.VisualStudio.Community.Msi.Resources\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips\",\"Microsoft.VisualStudio.Devenv.Msi\",\"Microsoft.VisualStudio.Component.VC.ATL\",\"Microsoft.VisualStudio.VC.Templates.Pro\",\"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\"Microsoft.VisualStudio.SLNX.VSIX\",\"Microsoft.VisualStudio.CoreEditor\",\"Win10SDK_10.0.17134\",\"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\"Microsoft.VisualStudio.Component.Debugger.JustInTime\",\"Microsoft.VisualStudio.VC.Ide.MFC\",\"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\"Microsoft.VisualStudio.Finalizer\",\"Microsoft.VisualStudio.VirtualTree\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.ProjectServices\",\"Microsoft.VisualStudio.VC.DevCmd.Resources\",\"Microsoft.VisualStudio.MinShell\",\"Microsoft.VisualStudio.PackageGroup.Progression\",\"Microsoft.VisualStudio.PerformanceProvider\",\"Microsoft.VisualStudio.Connected.Resources\",\"Microsoft.VisualStudio.Log\",\"Microsoft.VisualStudio.PackageGroup.TeamExplorer\",\"Microsoft.VisualStudio.Log.Targeted\",\"Microsoft.VisualStudio.MinShell.Platform\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.VC.Templates.Pro.Resources\",\"Microsoft.VisualStudio.Devenv\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX64\",\"Microsoft.VisualStudio.Devenv.Resources\",\"Microsoft.VisualStudio.MinShell.Platform.Resources\",\"Microsoft.VisualStudio.Connected\",\"Microsoft.VisualStudio.MefHosting\",\"Microsoft.DiagnosticsHub.Collection.StopService.Uninstall\",\"Microsoft.VisualStudio.PackageGroup.MinShell\",\"Microsoft.VisualStudio.MefHosting.Resources\",\"Microsoft.VisualCpp.MFC.X86\",\"Microsoft.VisualStudio.Log.Resources\",\"Microsoft.Icecap.Analysis.Targeted\",\"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.PGO.X86\",\"Microsoft.VisualStudio.ExtensionManager\",\"Microsoft.VisualStudio.MinShell.x86\",\"Microsoft.VisualStudio.MinShell.Msi\",\"Microsoft.VisualStudio.Setup.Configuration\",\"Microsoft.VisualStudio.LanguageServer\",\"Microsoft.VisualStudio.NativeImageSupport\",\"Microsoft.VisualStudio.MinShell.Msi.Resources\",\"Microsoft.VisualStudio.Devenv.Config\",\"Microsoft.VisualStudio.MinShell.Resources\",\"Microsoft.VisualStudio.Initializer\",\"Microsoft.Net.PackageGroup.4.6.Redist\"]}]\n"
  },
  {
    "path": "test/fixtures/VS_2017_Express.txt",
    "content": "[{\"path\":\"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\WDExpress\",\"version\":\"15.9.28307.858\",\"packages\":[\"Microsoft.VisualStudio.Product.WDExpress\",\"Microsoft.VisualStudio.Workload.WDExpress\",\"Microsoft.VisualStudio.Component.Windows10SDK.17763\",\"MLGen\",\"Win10SDK_10.0.17763\",\"Microsoft.VisualStudio.Component.Windows10SDK.14393\",\"Win10SDK_10.0.14393.795\",\"Microsoft.VisualStudio.VC.Items.Pro\",\"Microsoft.VisualStudio.VC.Ide.Pro\",\"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\"Microsoft.VisualStudio.Component.VC.Tools.ARM64\",\"Microsoft.VisualStudio.VC.MSBuild.Arm64\",\"Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.ARM64\",\"Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.ARM64.Store\",\"Microsoft.VisualCpp.CRT.ARM64.Desktop\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetarm64\",\"Microsoft.VisualCpp.VCTip.hostX86.targetARM64\",\"Microsoft.VisualCpp.Tools.HostX86.TargetARM64.Resources\",\"Microsoft.VisualStudio.Component.VC.Tools.ARM\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetarm\",\"Microsoft.VisualCpp.VCTip.hostX86.targetARM\",\"Microsoft.VisualCpp.Tools.HostX86.TargetARM.Resources\",\"Microsoft.VisualCpp.CRT.x86.Store\",\"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Store\",\"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.arm.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.arm.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.arm.Store\",\"Microsoft.VisualCpp.CRT.arm.Desktop\",\"Microsoft.VisualStudio.VC.Templates.UnitTest\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP\",\"Microsoft.VisualStudio.VC.Templates.UnitTest.Resources\",\"Microsoft.VisualStudio.VC.Templates.Desktop\",\"Microsoft.VisualStudio.VC.Templates.Pro\",\"Microsoft.VisualStudio.VC.Templates.Pro.Resources\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\"Microsoft.VisualStudio.JavaScript.LanguageService\",\"Microsoft.VisualStudio.JavaScript.LanguageService.Resources\",\"Microsoft.VisualStudio.Debugger.Script.Msi\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.VC.MSBuild.X64\",\"Microsoft.VS.VC.MSBuild.X64.Resources\",\"Microsoft.VisualStudio.VC.MSBuild.ARM\",\"Microsoft.VisualStudio.VC.MSBuild.X86\",\"Microsoft.VisualStudio.VC.MSBuild.Base\",\"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\"Microsoft.VisualStudio.VC.Ide.Dskx\",\"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\"Microsoft.VisualStudio.VC.Ide.Core\",\"Microsoft.VisualStudio.VC.Ide.Core.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base\",\"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\"Microsoft.VisualStudio.Component.VC.CLI.Support\",\"Microsoft.VisualCpp.CLI.X86\",\"Microsoft.VisualCpp.CLI.X64\",\"Microsoft.VisualCpp.CLI.Source\",\"Microsoft.VisualCpp.CLI.ARM64\",\"Microsoft.VisualCpp.CLI.ARM\",\"Microsoft.VisualStudio.VC.Templates.CLR\",\"Microsoft.VisualStudio.VC.Ide.LanguageService\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\"Microsoft.VisualStudio.VC.Templates.CLR.Resources\",\"Microsoft.Component.VC.Runtime.OSSupport\",\"Microsoft.Windows.UniversalCRT.Tools.Msi\",\"Microsoft.Windows.UniversalCRT.Tools.Msi\",\"Microsoft.Windows.UniversalCRT.ExtensionSDK.Msi\",\"Microsoft.Windows.UniversalCRT.HeadersLibsSources.Msi\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX64\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.Core.Resources\",\"Microsoft.VisualCpp.Tools.Core.x86\",\"Microsoft.VisualCpp.Tools.Common.Utils\",\"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\"Microsoft.VisualCpp.DIA.SDK\",\"Microsoft.VisualCpp.CRT.x86.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Desktop\",\"Microsoft.VisualCpp.CRT.Source\",\"Microsoft.VisualCpp.CRT.Redist.X86\",\"Microsoft.VisualCpp.CRT.Redist.X64\",\"Microsoft.VisualCpp.CRT.Redist.Resources\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.CRT.Headers\",\"Microsoft.Component.HelpViewer\",\"Microsoft.HelpViewer\",\"Microsoft.VisualStudio.Help.Configuration.Msi\",\"Microsoft.VisualStudio.Component.SQL.DataSources\",\"Microsoft.VisualStudio.Component.SQL.SSDT\",\"Microsoft.VisualStudio.Component.SQL.CMDUtils\",\"sqlcmdlnutils\",\"Microsoft.VisualStudio.Component.Common.Azure.Tools\",\"Microsoft.VisualStudio.Azure.CommonAzureTools\",\"SSDT\",\"Microsoft.VisualStudio.Component.SQL.ADAL\",\"sql_adalsql\",\"Microsoft.VisualStudio.Component.NuGet\",\"Microsoft.CredentialProvider\",\"Microsoft.VisualStudio.NuGet.Licenses\",\"Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime\",\"Microsoft.VisualStudio.Component.SQL.NCLI\",\"sqllocaldb\",\"sqlncli\",\"Microsoft.VisualStudio.Component.EntityFramework\",\"Microsoft.VisualStudio.PackageGroup.DslRuntime\",\"Microsoft.VisualStudio.Dsl.Core\",\"Microsoft.VisualStudio.Dsl.GraphObject\",\"Microsoft.VisualStudio.Dsl.Core.Resources\",\"Microsoft.VisualStudio.EntityFrameworkTools\",\"Microsoft.VisualStudio.EntityFrameworkTools.Msi\",\"Microsoft.VisualStudio.Component.Roslyn.LanguageServices\",\"Microsoft.VisualStudio.InteractiveWindow\",\"Microsoft.DiaSymReader.Native\",\"Microsoft.VisualStudio.Component.Static.Analysis.Tools\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualStudio.StaticAnalysis\",\"Microsoft.VisualStudio.StaticAnalysis.Resources\",\"Microsoft.CodeAnalysis.VisualStudio.InteractiveComponents.Resources\",\"Microsoft.CodeAnalysis.VisualStudio.InteractiveComponents\",\"Microsoft.CodeAnalysis.VisualStudio.Setup.Interactive.Resources\",\"Microsoft.Net.ComponentGroup.TargetingPacks.Common\",\"Microsoft.Net.Component.4.6.TargetingPack\",\"Microsoft.Net.4.6.TargetingPack\",\"Microsoft.Net.Component.4.5.2.TargetingPack\",\"Microsoft.Net.4.5.2.TargetingPack\",\"Microsoft.Net.Component.4.5.1.TargetingPack\",\"Microsoft.Net.4.5.1.TargetingPack\",\"Microsoft.Net.Component.4.5.TargetingPack\",\"Microsoft.Net.4.5.TargetingPack\",\"Microsoft.Net.Component.4.TargetingPack\",\"Microsoft.Net.4.TargetingPack\",\"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites\",\"Microsoft.Net.Component.4.6.1.TargetingPack\",\"Microsoft.Net.4.6.1.TargetingPack\",\"Microsoft.Net.Cumulative.TargetingPack.Resources\",\"Microsoft.Net.Component.4.6.1.SDK\",\"Microsoft.Net.4.6.1.SDK\",\"Microsoft.VisualStudio.Component.TextTemplating\",\"Microsoft.VisualStudio.TextTemplating.MSBuild\",\"Microsoft.VisualStudio.TextTemplating.Integration\",\"Microsoft.VisualStudio.TextTemplating.Core\",\"Microsoft.VisualStudio.TextTemplating.Integration.Resources\",\"Microsoft.VisualStudio.Component.VisualStudioData\",\"Microsoft.VisualStudio.Component.SQL.CLR\",\"Microsoft.VisualStudio.ProTools\",\"sqlsysclrtypes\",\"sqlsysclrtypes\",\"SQLCommon\",\"Microsoft.VisualStudio.ProTools.Resources\",\"Microsoft.VisualStudio.XamlDiagnostics\",\"Microsoft.VisualStudio.XamlDiagnostics.Resources\",\"Microsoft.VisualStudio.XamlDesigner\",\"Microsoft.VisualStudio.XamlDesigner.Resources\",\"Microsoft.VisualStudio.XamlDesigner.Executables\",\"Microsoft.VisualStudio.XamlShared\",\"Microsoft.VisualStudio.XamlShared.Resources\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Managed\",\"Microsoft.VisualStudio.PackageGroup.IntelliTrace.Core\",\"Microsoft.IntelliTrace.Core\",\"Microsoft.IntelliTrace.Core.Targeted\",\"Microsoft.IntelliTrace.ProfilerProxy.Msi.x64\",\"Microsoft.IntelliTrace.ProfilerProxy.Msi\",\"Microsoft.VisualStudio.NuGet.Core\",\"Microsoft.VisualStudio.TestWindow.SourceBasedTestDiscovery\",\"Microsoft.VisualStudio.TestWindow.Dotnet\",\"Microsoft.VisualStudio.TestTools.TestGeneration\",\"Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Enterprise\",\"Microsoft.VisualStudio.PackageGroup.TestTools.MSTestV2.Managed\",\"Microsoft.VisualStudio.TestTools.MSTestV2.WizardExtension.UnitTest\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Core\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI\",\"Microsoft.VisualStudio.TestTools.Pex.Common\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy\",\"Microsoft.VisualStudio.PackageGroup.MinShell.Interop\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestTools\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE\",\"Microsoft.VisualStudio.TestTools.TestWIExtension\",\"Microsoft.VisualStudio.TestTools.TestPlatform.IDE\",\"Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors\",\"Microsoft.Component.ClickOnce\",\"Microsoft.VisualStudio.PackageGroup.ClickOnce.MSBuild\",\"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\"Microsoft.ClickOnce.SignTool.Msi\",\"Microsoft.SQL.ClickOnceBootstrapper.Msi\",\"Microsoft.Net.ClickOnceBootstrapper\",\"Microsoft.ClickOnce.BootStrapper.Msi.Resources\",\"Microsoft.ClickOnce.BootStrapper.Msi\",\"Microsoft.VisualStudio.WebTools.WSP.FSA\",\"Microsoft.VisualStudio.WebTools.WSP.FSA.Resources\",\"Microsoft.VisualStudio.PackageGroup.Community\",\"Microsoft.VisualStudio.Community.Extra.Resources\",\"Microsoft.VisualStudio.Community.Extra\",\"Microsoft.VisualStudio.PackageGroup.Core\",\"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\"Microsoft.VisualStudio.VC.Ide.Debugger\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\"Microsoft.VisualStudio.VC.Ide.Common\",\"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\"Microsoft.VisualStudio.Debugger.Parallel\",\"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\"Microsoft.VisualStudio.Debugger.CollectionAgents\",\"Microsoft.VisualStudio.Debugger.Managed\",\"Microsoft.CodeAnalysis.VisualStudio.Setup.Resources\",\"Microsoft.CodeAnalysis.VisualStudio.Setup\",\"Microsoft.CodeAnalysis.ExpressionEvaluator.Resources\",\"Microsoft.CodeAnalysis.ExpressionEvaluator\",\"Microsoft.VisualStudio.Debugger.Managed.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger\",\"Microsoft.VisualStudio.VC.MSVCDis\",\"Microsoft.VisualStudio.ScriptedHost\",\"Microsoft.VisualStudio.ScriptedHost.Targeted\",\"Microsoft.VisualStudio.ScriptedHost.Resources\",\"Microsoft.IntelliTrace.DiagnosticsHub\",\"Microsoft.VisualStudio.Debugger.Resources\",\"Microsoft.PackageGroup.ClientDiagnostics\",\"Microsoft.VisualStudio.AppResponsiveness\",\"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\"Microsoft.VisualStudio.AppResponsiveness.Resources\",\"Microsoft.VisualStudio.ClientDiagnostics\",\"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\"Microsoft.VisualStudio.ProjectSystem.Full\",\"Microsoft.VisualStudio.ProjectSystem\",\"Microsoft.VisualStudio.Community.x86\",\"Microsoft.VisualStudio.Community.x64\",\"Microsoft.VisualStudio.Community\",\"Microsoft.IntelliTrace.CollectorCab\",\"Microsoft.VisualStudio.Community.Resources\",\"Microsoft.VisualStudio.Net.Eula.Resources\",\"Microsoft.VisualStudio.WebSiteProject.DTE\",\"Microsoft.MSHtml\",\"Microsoft.VisualStudio.Community.Msi.Resources\",\"Microsoft.VisualStudio.Community.Msi\",\"Microsoft.VisualStudio.MinShell.Interop.Msi\",\"Microsoft.VisualStudio.Editors\",\"Microsoft.VisualStudio.ClickOnce.Resources\",\"Microsoft.VisualStudio.ClickOnce\",\"Microsoft.Component.MSBuild\",\"Microsoft.NuGet.Build.Tasks\",\"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\"Microsoft.CodeAnalysis.Compilers.Resources\",\"Microsoft.CodeAnalysis.Compilers\",\"Microsoft.Net.PackageGroup.4.6.1.Redist\",\"Microsoft.VisualStudio.TemplateEngine\",\"Microsoft.VisualStudio.WebToolsExtensions.Common\",\"Microsoft.NET.Sdk\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Templates.Managed\",\"Microsoft.VisualStudio.TestTools.Templates.Managed\",\"Microsoft.VisualStudio.TestTools.Templates.Managed.Resources\",\"Microsoft.VisualStudio.Templates.VB.MSTestv2.Desktop.UnitTest\",\"Microsoft.VisualStudio.Templates.CS.MSTestv2.Desktop.UnitTest\",\"Microsoft.VisualStudio.Templates.VB.Wpf\",\"Microsoft.VisualStudio.Templates.VB.Wpf.Resources\",\"Microsoft.VisualStudio.Templates.VB.Winforms\",\"Microsoft.VisualStudio.Templates.VB.ManagedCore\",\"Microsoft.VisualStudio.Templates.VB.Shared\",\"Microsoft.VisualStudio.Templates.VB.Shared.Resources\",\"Microsoft.VisualStudio.Templates.VB.ManagedCore.Resources\",\"Microsoft.VisualStudio.Templates.CS.GettingStarted.Desktop.Package\",\"Microsoft.VisualStudio.Templates.GetStarted.Desktop.Setup\",\"Microsoft.VisualStudio.Templates.CS.GettingStarted.Console.Package\",\"Microsoft.VisualStudio.Templates.GetStarted.Resources\",\"Microsoft.VisualStudio.Templates.GetStarted.Common.Setup\",\"Microsoft.VisualStudio.Templates.GetStarted.Console.Setup\",\"Microsoft.VisualStudio.Templates.CS.Wpf\",\"Microsoft.VisualStudio.Templates.CS.Wpf.Resources\",\"Microsoft.VisualStudio.Templates.CS.Winforms\",\"Microsoft.VisualStudio.Templates.CS.ManagedCore\",\"Microsoft.VisualStudio.Templates.CS.Shared\",\"Microsoft.VisualStudio.Templates.Editorconfig.Wizard.Setup\",\"Templates.Editorconfig.SolutionFile.Setup\",\"Microsoft.VisualStudio.Templates.CS.Shared.Resources\",\"Microsoft.VisualStudio.Templates.CS.ManagedCore.Resources\",\"Microsoft.VisualStudio.Component.CoreEditor\",\"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\"PortableFacades\",\"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\"Microsoft.VisualStudio.VC.DevCmd\",\"Microsoft.VisualStudio.VC.DevCmd.Resources\",\"Microsoft.VisualStudio.VirtualTree\",\"Microsoft.VisualStudio.PackageGroup.Progression\",\"Microsoft.VisualStudio.PerformanceProvider\",\"Microsoft.VisualStudio.GraphModel\",\"Microsoft.VisualStudio.GraphProvider\",\"Microsoft.DiaSymReader\",\"Microsoft.Build.Dependencies\",\"Microsoft.Build.FileTracker.Msi\",\"Microsoft.Build\",\"Microsoft.VisualStudio.TextMateGrammars\",\"Microsoft.VisualStudio.PackageGroup.TeamExplorer\",\"Microsoft.TeamFoundation.OfficeIntegration\",\"Microsoft.TeamFoundation.OfficeIntegration.Resources\",\"Microsoft.VisualStudio.TeamExplorer\",\"Microsoft.ServiceHub\",\"Microsoft.VisualStudio.ProjectServices\",\"Microsoft.VisualStudio.SLNX.VSIX\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.PackageGroup.MinShell\",\"Microsoft.VisualStudio.MinShell.Interop\",\"Microsoft.VisualStudio.Log\",\"Microsoft.VisualStudio.Log.Targeted\",\"Microsoft.VisualStudio.Log.Resources\",\"Microsoft.VisualStudio.Finalizer\",\"Microsoft.VisualStudio.WDExpress\",\"Microsoft.VisualStudio.WDExpress.Resources\",\"Microsoft.VisualStudio.CoreEditor\",\"Microsoft.VisualStudio.Connected\",\"Microsoft.VisualStudio.Connected.Resources\",\"Microsoft.VisualStudio.MinShell\",\"Microsoft.VisualStudio.Setup.Configuration\",\"Microsoft.VisualStudio.MinShell.Platform\",\"Microsoft.VisualStudio.MinShell.Platform.Resources\",\"Microsoft.VisualStudio.MefHosting\",\"Microsoft.VisualStudio.MefHosting.Resources\",\"Microsoft.VisualStudio.Initializer\",\"Microsoft.VisualStudio.ExtensionManager\",\"Microsoft.VisualStudio.MinShell.x86\",\"Microsoft.VisualStudio.NativeImageSupport\",\"Microsoft.VisualStudio.MinShell.Msi\",\"Microsoft.VisualStudio.MinShell.Msi.Resources\",\"Microsoft.VisualStudio.LanguageServer\",\"Microsoft.VisualStudio.MinShell.Resources\",\"Microsoft.Net.PackageGroup.4.6.Redist\",\"Microsoft.VisualStudio.Branding.WDExpress\"]}]\n"
  },
  {
    "path": "test/fixtures/VS_2017_Unusable.txt",
    "content": "[{\"path\":\"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\BuildToolsUnusable\",\"version\":\"15.9.28307.665\",\"packages\":[\"Microsoft.VisualStudio.Product.BuildTools\",\"Microsoft.VisualStudio.Component.Windows10SDK.17134\",\"Win10SDK_10.0.17134\",\"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources\",\"Microsoft.VisualStudio.Component.Static.Analysis.Tools\",\"Microsoft.VisualStudio.StaticAnalysis\",\"Microsoft.VisualStudio.StaticAnalysis.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX86\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX64\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.PGO.X86\",\"Microsoft.VisualCpp.PGO.X64\",\"Microsoft.VisualCpp.PGO.Headers\",\"Microsoft.VisualCpp.CRT.x86.Store\",\"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Store\",\"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX64\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.Core.Resources\",\"Microsoft.VisualCpp.Tools.Core.x86\",\"Microsoft.VisualCpp.Tools.Common.Utils\",\"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\"Microsoft.VisualCpp.DIA.SDK\",\"Microsoft.VisualCpp.CRT.x86.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Desktop\",\"Microsoft.VisualCpp.CRT.Source\",\"Microsoft.VisualCpp.CRT.Redist.X86\",\"Microsoft.VisualCpp.CRT.Redist.X64\",\"Microsoft.VisualCpp.CRT.Redist.Resources\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.CRT.Headers\",\"Microsoft.VisualStudio.Workload.MSBuildTools\",\"Microsoft.VisualStudio.Component.CoreBuildTools\",\"Microsoft.VisualStudio.Setup.Configuration\",\"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\"Microsoft.VisualStudio.VC.DevCmd\",\"Microsoft.VisualStudio.VC.DevCmd.Resources\",\"Microsoft.VisualStudio.BuildTools.Resources\",\"Microsoft.VisualStudio.Net.Eula.Resources\",\"Microsoft.Build.Dependencies\",\"Microsoft.Build.FileTracker.Msi\",\"Microsoft.Component.MSBuild\",\"Microsoft.PythonTools.BuildCore.Vsix\",\"Microsoft.NuGet.Build.Tasks\",\"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\"Microsoft.CodeAnalysis.Compilers.Resources\",\"Microsoft.CodeAnalysis.Compilers\",\"Microsoft.Net.PackageGroup.4.6.1.Redist\",\"Microsoft.Net.4.6.1.FullRedist.NonThreshold\",\"Microsoft.Windows.UniversalCRT.Msu.81\",\"Microsoft.VisualStudio.NativeImageSupport\",\"Microsoft.Build\"]}]\n"
  },
  {
    "path": "test/fixtures/VS_2019_BuildTools_minimal.txt",
    "content": "[{\"path\":\"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools\",\"version\":\"16.1.28922.388\",\"packages\":[\"Microsoft.VisualStudio.Product.BuildTools\",\"Microsoft.VisualStudio.Component.VC.CoreIde\",\"Microsoft.VisualStudio.VC.Ide.Pro\",\"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\"Microsoft.VisualStudio.VC.Templates.Pro\",\"Microsoft.VisualStudio.VC.Templates.Pro.Resources\",\"Microsoft.VisualStudio.VC.Items.Pro\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\"Microsoft.VisualStudio.VC.Ide.MDD\",\"Microsoft.VisualStudio.PackageGroup.Core\",\"Microsoft.VisualStudio.CodeSense.Community\",\"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\"Microsoft.PackageGroup.ClientDiagnostics\",\"Microsoft.VisualStudio.AppResponsiveness\",\"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\"Microsoft.VisualStudio.AppResponsiveness.Resources\",\"Microsoft.VisualStudio.ClientDiagnostics\",\"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\"Microsoft.VisualStudio.ProjectSystem.Full\",\"Microsoft.VisualStudio.ProjectSystem\",\"Microsoft.VisualStudio.Community.x86\",\"Microsoft.VisualStudio.Community.x64\",\"Microsoft.VisualStudio.Community\",\"Microsoft.IntelliTrace.CollectorCab\",\"Microsoft.VisualStudio.Community.Resources\",\"Microsoft.VisualStudio.WebSiteProject.DTE\",\"Microsoft.MSHtml\",\"Microsoft.VisualStudio.Platform.CallHierarchy\",\"Microsoft.VisualStudio.Community.Msi.Resources\",\"Microsoft.VisualStudio.Community.Msi\",\"Microsoft.VisualStudio.MinShell.Interop.Msi\",\"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\"Microsoft.VisualStudio.VirtualTree\",\"Microsoft.VisualStudio.PackageGroup.Progression\",\"Microsoft.VisualStudio.PerformanceProvider\",\"Microsoft.VisualStudio.GraphModel\",\"Microsoft.VisualStudio.GraphProvider\",\"Microsoft.VisualStudio.TextMateGrammars\",\"Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common\",\"Microsoft.VisualStudio.TeamExplorer\",\"Microsoft.ServiceHub\",\"Microsoft.VisualStudio.ProjectServices\",\"Microsoft.VisualStudio.OpenFolder.VSIX\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.PackageGroup.MinShell\",\"Microsoft.VisualStudio.MinShell.Msi\",\"Microsoft.VisualStudio.MinShell.Msi.Resources\",\"Microsoft.VisualStudio.MinShell.Interop\",\"Microsoft.VisualStudio.Log\",\"Microsoft.VisualStudio.Log.Targeted\",\"Microsoft.VisualStudio.Log.Resources\",\"Microsoft.VisualStudio.Finalizer\",\"Microsoft.VisualStudio.CoreEditor\",\"Microsoft.VisualStudio.Platform.NavigateTo\",\"Microsoft.VisualStudio.Connected\",\"Microsoft.VisualStudio.Connected.Resources\",\"Microsoft.VisualStudio.VC.Ide.x64\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script.Msi\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\"Microsoft.VisualStudio.VC.Ide.Dskx\",\"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base\",\"Microsoft.VisualStudio.VC.Ide.LanguageService\",\"Microsoft.VisualStudio.VC.Ide.Core\",\"Microsoft.VisualStudio.VisualC.Logging\",\"Microsoft.VisualStudio.VC.Ide.Core.Resources\",\"Microsoft.VisualStudio.VC.Ide.VCPkgDatabase\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\"Microsoft.Net.4.TargetingPack\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\"Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Record\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Runtime\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Runtime\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Agent\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Record\",\"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\"Microsoft.VisualStudio.VC.Ide.Debugger\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Concord\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\"Microsoft.VisualStudio.VC.Ide.Common\",\"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\"Microsoft.VisualStudio.Debugger.Parallel\",\"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\"Microsoft.VisualStudio.Debugger.CollectionAgents\",\"Microsoft.VisualStudio.Debugger.Managed\",\"Microsoft.DiaSymReader\",\"Microsoft.CodeAnalysis.ExpressionEvaluator\",\"Microsoft.VisualStudio.Debugger.Concord.Managed\",\"Microsoft.VisualStudio.Debugger.Concord.Managed.Resources\",\"Microsoft.VisualStudio.Debugger.Managed.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger\",\"Microsoft.VisualStudio.PerfLib\",\"Microsoft.VisualStudio.Debugger.Package.DiagHub.Client.VSx86\",\"Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client\",\"Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client\",\"Microsoft.VisualStudio.VC.MSVCDis\",\"Microsoft.VisualStudio.ScriptedHost\",\"Microsoft.VisualStudio.ScriptedHost.Targeted\",\"Microsoft.VisualStudio.ScriptedHost.Resources\",\"Microsoft.VisualStudio.Editors\",\"Microsoft.IntelliTrace.DiagnosticsHub\",\"Microsoft.VisualStudio.MinShell\",\"Microsoft.VisualStudio.MinShell.Platform\",\"Microsoft.VisualStudio.MinShell.Platform.Resources\",\"Microsoft.VisualStudio.MefHosting\",\"Microsoft.VisualStudio.MefHosting.Resources\",\"Microsoft.VisualStudio.Initializer\",\"Microsoft.VisualStudio.ExtensionManager\",\"Microsoft.VisualStudio.Platform.Editor\",\"Microsoft.VisualStudio.Debugger.Concord\",\"Microsoft.VisualStudio.Debugger.Concord.Resources\",\"Microsoft.VisualStudio.Debugger.Resources\",\"Microsoft.CodeAnalysis.VisualStudio.Setup\",\"Microsoft.VisualStudio.Component.Windows10SDK.17134\",\"Win10SDK_10.0.17134\",\"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources\",\"Microsoft.VisualStudio.StaticAnalysis\",\"Microsoft.VisualStudio.StaticAnalysis.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX86\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX64\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.PGO.X86\",\"Microsoft.VisualCpp.PGO.X64\",\"Microsoft.VisualCpp.PGO.Headers\",\"Microsoft.VisualCpp.CRT.x86.Store\",\"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Store\",\"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX64\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.Core.Resources\",\"Microsoft.VisualCpp.Tools.Core.x86\",\"Microsoft.VisualCpp.Tools.Common.Utils\",\"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\"Microsoft.VisualCpp.DIA.SDK\",\"Microsoft.VisualCpp.CRT.x86.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Desktop\",\"Microsoft.VisualCpp.CRT.Source\",\"Microsoft.VisualCpp.CRT.Redist.X86\",\"Microsoft.VisualCpp.CRT.Redist.X64\",\"Microsoft.VisualCpp.CRT.Redist.Resources\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.Redist.14.Latest\",\"Microsoft.VisualCpp.Redist.14.Latest\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.CRT.Headers\",\"Microsoft.VisualStudio.VC.MSBuild.x86.v142\",\"Microsoft.VisualStudio.VC.MSBuild.X86\",\"Microsoft.VisualStudio.VC.MSBuild.X64.v142\",\"Microsoft.VisualStudio.VC.MSBuild.X64\",\"Microsoft.VS.VC.MSBuild.X64.Resources\",\"Microsoft.VisualStudio.VC.MSBuild.ARM.v142\",\"Microsoft.VisualStudio.VC.MSBuild.ARM\",\"Microsoft.VisualStudio.VC.MSBuild.Base\",\"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\"Microsoft.VisualStudio.Workload.MSBuildTools\",\"Microsoft.VisualStudio.Component.CoreBuildTools\",\"Microsoft.VisualStudio.Setup.Configuration\",\"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\"Microsoft.VisualStudio.VC.DevCmd\",\"Microsoft.VisualStudio.VC.DevCmd.Resources\",\"Microsoft.VisualStudio.BuildTools.Resources\",\"Microsoft.VisualStudio.Net.Eula.Resources\",\"Microsoft.Build.Dependencies\",\"Microsoft.Build.FileTracker.Msi\",\"Microsoft.Component.MSBuild\",\"Microsoft.PythonTools.BuildCore.Vsix\",\"Microsoft.NuGet.Build.Tasks\",\"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\"Microsoft.CodeAnalysis.Compilers\",\"Microsoft.Net.PackageGroup.4.7.2.Redist\",\"Microsoft.VisualStudio.NativeImageSupport\",\"Microsoft.Build\",\"Microsoft.VisualStudio.PackageGroup.NuGet\",\"Microsoft.VisualStudio.NuGet.BuildTools\"]}]\n"
  },
  {
    "path": "test/fixtures/VS_2019_Community_workload.txt",
    "content": "[{\"path\":\"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community\",\"version\":\"16.1.28922.388\",\"packages\":[\"Microsoft.VisualStudio.Workload.NativeDesktop\",\"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest\",\"Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest\",\"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest\",\"Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest\",\"Microsoft.VisualStudio.Component.VC.ATL\",\"Microsoft.VisualStudio.VC.Ide.ATL\",\"Microsoft.VisualStudio.VC.Ide.ATL.Resources\",\"Microsoft.VisualCpp.ATL.X86\",\"Microsoft.VisualCpp.ATL.X64\",\"Microsoft.VisualCpp.ATL.Source\",\"Microsoft.VisualCpp.ATL.Headers\",\"Microsoft.VisualStudio.Component.VC.CMake.Project\",\"Microsoft.VisualStudio.VC.CMake\",\"Microsoft.VisualStudio.VC.CMake.Project\",\"Microsoft.VisualStudio.VC.ExternalBuildFramework\",\"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Native\",\"Microsoft.VisualStudio.Component.VC.Redist.14.Latest\",\"Microsoft.VisualStudio.VC.Templates.UnitTest\",\"Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP\",\"Microsoft.VisualStudio.VC.Templates.UnitTest.Resources\",\"Microsoft.VisualStudio.VC.Templates.Desktop\",\"Microsoft.VisualStudio.Component.Debugger.JustInTime\",\"Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi\",\"Microsoft.VisualStudio.Debugger.JustInTime\",\"Microsoft.VisualStudio.Debugger.JustInTime.Msi\",\"Microsoft.VisualStudio.Component.Windows10SDK.17763\",\"Win10SDK_10.0.17763\",\"Microsoft.VisualStudio.Component.VC.DiagnosticTools\",\"Microsoft.VisualStudio.Component.Graphics.Tools\",\"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX86\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX64\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.PGO.X86\",\"Microsoft.VisualCpp.PGO.X64\",\"Microsoft.VisualCpp.PGO.Headers\",\"Microsoft.VisualCpp.CRT.x86.Store\",\"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Store\",\"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX64\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.Core.Resources\",\"Microsoft.VisualCpp.Tools.Core.x86\",\"Microsoft.VisualCpp.DIA.SDK\",\"Microsoft.VisualCpp.CRT.x86.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Desktop\",\"Microsoft.VisualCpp.CRT.Source\",\"Microsoft.VisualCpp.CRT.Redist.X86\",\"Microsoft.VisualCpp.CRT.Redist.X64\",\"Microsoft.VisualCpp.CRT.Redist.Resources\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.Redist.14.Latest\",\"Microsoft.VisualCpp.Redist.14.Latest\",\"Microsoft.VisualCpp.CRT.Headers\",\"Microsoft.VisualStudio.Graphics.Viewers\",\"Microsoft.VisualStudio.Graphics.Viewers.Resources\",\"Microsoft.VisualStudio.Graphics.Msi\",\"Microsoft.VisualStudio.Graphics.Msi\",\"Microsoft.VisualStudio.Graphics.Analyzer\",\"Microsoft.VisualStudio.Graphics.Analyzer.Targeted\",\"Microsoft.VisualStudio.Graphics.Analyzer.Resources\",\"Microsoft.VisualStudio.Graphics.Appid\",\"Microsoft.VisualStudio.Graphics.Appid.Resources\",\"Microsoft.VisualStudio.Component.VC.CoreIde\",\"Microsoft.VisualStudio.VC.Ide.Pro\",\"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\"Microsoft.VisualStudio.VC.Templates.Pro\",\"Microsoft.VisualStudio.VC.Templates.Pro.Resources\",\"Microsoft.VisualStudio.VC.Items.Pro\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\"Microsoft.VisualStudio.VC.Ide.x64\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\"Microsoft.VisualStudio.VC.MSBuild.X64.v142\",\"Microsoft.VisualStudio.VC.MSBuild.X64\",\"Microsoft.VS.VC.MSBuild.X64.Resources\",\"Microsoft.VisualStudio.VC.MSBuild.ARM.v142\",\"Microsoft.VisualStudio.VC.MSBuild.ARM\",\"Microsoft.VisualStudio.VC.MSBuild.x86.v142\",\"Microsoft.VisualStudio.VC.MSBuild.X86\",\"Microsoft.VisualStudio.VC.MSBuild.Base\",\"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\"Microsoft.VisualStudio.VC.Ide.Dskx\",\"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base\",\"Microsoft.VisualStudio.VC.Ide.LanguageService\",\"Microsoft.VisualStudio.VC.Ide.Core\",\"Microsoft.VisualStudio.VC.Ide.Core.Resources\",\"Microsoft.VisualStudio.VC.Ide.VCPkgDatabase\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\"Component.Microsoft.VisualStudio.LiveShare\",\"Microsoft.VisualStudio.LiveShare\",\"Microsoft.Icecap.Analysis\",\"Microsoft.Icecap.Analysis.Targeted\",\"Microsoft.Icecap.Analysis.Resources\",\"Microsoft.Icecap.Analysis.Resources.Targeted\",\"Microsoft.Icecap.Collection.Msi\",\"Microsoft.Icecap.Collection.Msi.Targeted\",\"Microsoft.Icecap.Collection.Msi.Resources\",\"Microsoft.Icecap.Collection.Msi.Resources.Targeted\",\"Microsoft.DiagnosticsHub.Instrumentation\",\"Microsoft.DiagnosticsHub.CpuSampling.ExternalDependencies\",\"Microsoft.DiagnosticsHub.CpuSampling\",\"Microsoft.DiagnosticsHub.CpuSampling.Targeted\",\"Microsoft.PackageGroup.DiagnosticsHub.Platform\",\"Microsoft.DiagnosticsHub.Runtime.ExternalDependencies\",\"Microsoft.DiagnosticsHub.Runtime.ExternalDependencies.Targeted\",\"Microsoft.DiagnosticsHub.Collection.ExternalDependencies.x64\",\"Microsoft.DiagnosticsHub.Collection.StopService.Uninstall\",\"Microsoft.DiagnosticsHub.Runtime\",\"Microsoft.DiagnosticsHub.Runtime.Targeted\",\"Microsoft.DiagnosticsHub.Collection\",\"Microsoft.DiagnosticsHub.Collection.Service\",\"Microsoft.DiagnosticsHub.Collection.StopService.Install\",\"Microsoft.VisualStudio.Component.IntelliCode\",\"Microsoft.VisualStudio.IntelliCode\",\"Microsoft.Net.4.TargetingPack\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\"Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Core\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI\",\"Microsoft.VisualStudio.TestTools.Pex.Common\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy\",\"Microsoft.VisualStudio.PackageGroup.MinShell.Interop\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestTools\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE\",\"Microsoft.VisualStudio.TestTools.TestWIExtension\",\"Microsoft.VisualStudio.TestTools.TestPlatform.IDE\",\"Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors\",\"Microsoft.VisualStudio.LiveShareApi\",\"Microsoft.VisualStudio.Component.TextTemplating\",\"Microsoft.VisualStudio.TextTemplating.MSBuild\",\"Microsoft.VisualStudio.TextTemplating.Integration\",\"Microsoft.VisualStudio.TextTemplating.Core\",\"Microsoft.VisualStudio.TextTemplating.Integration.Resources\",\"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\"Microsoft.Component.MSBuild\",\"Microsoft.NuGet.Build.Tasks\",\"Microsoft.DiagnosticsHub.KB2882822.Win7\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script.Msi\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions\",\"Microsoft.VisualStudio.ProTools\",\"sqlsysclrtypes\",\"sqlsysclrtypes\",\"SQLCommon\",\"Microsoft.VisualStudio.ProTools.Resources\",\"Microsoft.VisualStudio.WebToolsExtensions\",\"Microsoft.VisualStudio.WebTools\",\"Microsoft.VisualStudio.WebTools.Resources\",\"Microsoft.VisualStudio.WebTools.MSBuild\",\"Microsoft.VisualStudio.WebTools.WSP.FSA\",\"Microsoft.VisualStudio.WebTools.WSP.FSA.Resources\",\"Microsoft.VisualStudio.VC.Ide.MDD\",\"Microsoft.VisualStudio.VisualC.Logging\",\"Microsoft.WebTools.Shared\",\"Microsoft.WebTools.DotNet.Core.ItemTemplates\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.Windows.UniversalCRT.Msu.7\",\"Microsoft.VisualStudio.StaticAnalysis\",\"Microsoft.VisualStudio.StaticAnalysis.Resources\",\"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\"Microsoft.CodeAnalysis.Compilers\",\"Microsoft.VisualStudio.Component.NuGet\",\"Microsoft.CredentialProvider\",\"Microsoft.VisualStudio.NuGet.PowershellBindingRedirect\",\"Microsoft.VisualStudio.NuGet.Licenses\",\"Microsoft.VisualStudio.PackageGroup.Community\",\"Microsoft.VisualStudio.Community.Extra.Resources\",\"Microsoft.VisualStudio.Community.Extra\",\"Microsoft.VisualStudio.PackageGroup.Core\",\"Microsoft.VisualStudio.CodeSense.Community\",\"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\"Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Record\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Runtime\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Runtime\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Agent\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Record\",\"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\"Microsoft.VisualStudio.VC.Ide.Debugger\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Concord\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\"Microsoft.VisualStudio.VC.Ide.Common\",\"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\"Microsoft.VisualStudio.Debugger.Parallel\",\"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\"Microsoft.VisualStudio.Debugger.CollectionAgents\",\"Microsoft.VisualStudio.Debugger.Managed\",\"Microsoft.CodeAnalysis.VisualStudio.Setup\",\"Microsoft.CodeAnalysis.ExpressionEvaluator\",\"Microsoft.VisualStudio.Debugger.Concord.Managed\",\"Microsoft.VisualStudio.Debugger.Concord.Managed.Resources\",\"Microsoft.VisualStudio.Debugger.Managed.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Remote.DbgHelp.Win8\",\"Microsoft.VisualStudio.Debugger.Concord.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Remote.DbgHelp.Win8\",\"Microsoft.VisualStudio.Debugger.Concord.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger\",\"Microsoft.VisualStudio.Debugger.Package.DiagHub.Client.VSx86\",\"Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client\",\"Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client\",\"Microsoft.VisualStudio.Debugger.DbgHelp.Win8\",\"Microsoft.VisualStudio.VC.MSVCDis\",\"Microsoft.VisualStudio.ScriptedHost\",\"Microsoft.VisualStudio.ScriptedHost.Targeted\",\"Microsoft.VisualStudio.ScriptedHost.Resources\",\"Microsoft.IntelliTrace.DiagnosticsHub\",\"Microsoft.VisualStudio.Debugger.Concord\",\"Microsoft.VisualStudio.Debugger.Concord.Resources\",\"Microsoft.VisualStudio.Debugger.Resources\",\"Microsoft.PackageGroup.ClientDiagnostics\",\"Microsoft.VisualStudio.AppResponsiveness\",\"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\"Microsoft.VisualStudio.AppResponsiveness.Resources\",\"Microsoft.VisualStudio.ClientDiagnostics\",\"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\"Microsoft.VisualStudio.ProjectSystem.Full\",\"Microsoft.VisualStudio.ProjectSystem\",\"Microsoft.VisualStudio.Community.x86\",\"Microsoft.VisualStudio.Community.x64\",\"Microsoft.VisualStudio.Community\",\"Microsoft.IntelliTrace.CollectorCab\",\"Microsoft.VisualStudio.Community.Resources\",\"Microsoft.VisualStudio.Net.Eula.Resources\",\"Microsoft.VisualStudio.WebSiteProject.DTE\",\"Microsoft.MSHtml\",\"Microsoft.VisualStudio.Platform.CallHierarchy\",\"Microsoft.VisualStudio.Community.Msi.Resources\",\"Microsoft.VisualStudio.Community.Msi\",\"Microsoft.VisualStudio.Devenv.Msi\",\"Microsoft.VisualStudio.MinShell.Interop.Msi\",\"Microsoft.VisualStudio.Editors\",\"Microsoft.VisualStudio.Product.Community\",\"Microsoft.VisualStudio.Workload.CoreEditor\",\"Microsoft.VisualStudio.Component.CoreEditor\",\"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\"Microsoft.VisualCpp.Tools.Common.UtilsPrereq\",\"Microsoft.VisualCpp.Tools.Common.Utils\",\"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\"Microsoft.VisualStudio.VC.DevCmd\",\"Microsoft.VisualStudio.VC.DevCmd.Resources\",\"Microsoft.VisualStudio.VirtualTree\",\"Microsoft.VisualStudio.PackageGroup.Progression\",\"Microsoft.VisualStudio.PerformanceProvider\",\"Microsoft.VisualStudio.GraphModel\",\"Microsoft.VisualStudio.GraphProvider\",\"Microsoft.DiaSymReader\",\"Microsoft.Build.Dependencies\",\"Microsoft.Build.FileTracker.Msi\",\"Microsoft.Build\",\"Microsoft.VisualStudio.PackageGroup.NuGet\",\"Microsoft.VisualStudio.NuGet.Core\",\"Microsoft.VisualStudio.TextMateGrammars\",\"Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common\",\"Microsoft.VisualStudio.TeamExplorer\",\"Microsoft.ServiceHub\",\"Microsoft.VisualStudio.ProjectServices\",\"Microsoft.VisualStudio.OpenFolder.VSIX\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.PackageGroup.MinShell\",\"Microsoft.VisualStudio.MinShell.Interop\",\"Microsoft.VisualStudio.Log\",\"Microsoft.VisualStudio.Log.Targeted\",\"Microsoft.VisualStudio.Log.Resources\",\"Microsoft.VisualStudio.Finalizer\",\"Microsoft.VisualStudio.Devenv\",\"Microsoft.VisualStudio.Devenv.Resources\",\"Microsoft.VisualStudio.CoreEditor\",\"Microsoft.VisualStudio.Platform.NavigateTo\",\"Microsoft.VisualStudio.Connected\",\"Microsoft.VisualStudio.PerfLib\",\"Microsoft.VisualStudio.Connected.Resources\",\"Microsoft.VisualStudio.MinShell\",\"Microsoft.VisualStudio.Setup.Configuration\",\"Microsoft.VisualStudio.MinShell.Platform\",\"Microsoft.VisualStudio.MinShell.Platform.Resources\",\"Microsoft.VisualStudio.MefHosting\",\"Microsoft.VisualStudio.MefHosting.Resources\",\"Microsoft.VisualStudio.Initializer\",\"Microsoft.VisualStudio.ExtensionManager\",\"Microsoft.VisualStudio.Platform.Editor\",\"Microsoft.VisualStudio.MinShell.x86\",\"Microsoft.VisualStudio.NativeImageSupport\",\"Microsoft.VisualStudio.MinShell.Msi\",\"Microsoft.VisualStudio.MinShell.Msi.Resources\",\"Microsoft.VisualStudio.LanguageServer\",\"Microsoft.VisualStudio.Devenv.Config\",\"Microsoft.VisualStudio.MinShell.Resources\",\"Microsoft.Net.PackageGroup.4.7.2.Redist\",\"Microsoft.Net.4.7.2.FullRedist\",\"Microsoft.VisualStudio.Branding.Community\"]}]\n"
  },
  {
    "path": "test/fixtures/VS_2019_Preview.txt",
    "content": "[{\"path\":\"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Preview\",\"version\":\"16.0.28608.199\",\"packages\":[\"Microsoft.VisualStudio.Product.Enterprise\",\"Microsoft.VisualStudio.Workload.NativeDesktop\",\"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest\",\"Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest\",\"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest\",\"Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest\",\"Microsoft.VisualStudio.Component.VC.ATL\",\"Microsoft.VisualStudio.VC.Ide.ATL\",\"Microsoft.VisualStudio.VC.Ide.ATL.Resources\",\"Microsoft.VisualCpp.ATL.X86\",\"Microsoft.VisualCpp.ATL.X64\",\"Microsoft.VisualCpp.ATL.Source\",\"Microsoft.VisualCpp.ATL.Headers\",\"Microsoft.VisualStudio.Component.VC.CMake.Project\",\"Microsoft.VisualStudio.VC.CMake\",\"Microsoft.VisualStudio.VC.CMake.Project\",\"Microsoft.VisualStudio.VC.ExternalBuildFramework\",\"Microsoft.VisualStudio.Component.VC.DiagnosticTools\",\"Microsoft.VisualStudio.Component.Graphics.Tools\",\"Microsoft.VisualStudio.Graphics.Viewers\",\"Microsoft.VisualStudio.Graphics.Viewers.Resources\",\"Microsoft.VisualStudio.Graphics.EnableTools\",\"Microsoft.VisualStudio.Graphics.Msi\",\"Microsoft.VisualStudio.Graphics.Msi\",\"Microsoft.VisualStudio.Graphics.Analyzer\",\"Microsoft.VisualStudio.Graphics.Analyzer.Targeted\",\"Microsoft.VisualStudio.Graphics.Analyzer.Resources\",\"Microsoft.VisualStudio.Graphics.Appid\",\"Microsoft.VisualStudio.Graphics.Appid.Resources\",\"Microsoft.VisualStudio.Component.Windows10SDK.17763\",\"Win10SDK_10.0.17763\",\"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources\",\"Microsoft.VisualCpp.CodeAnalysis.Extensions.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64\",\"Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX86\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.VCTip.HostX64.TargetX64\",\"Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources\",\"Microsoft.VisualCpp.PGO.X86\",\"Microsoft.VisualCpp.PGO.X64\",\"Microsoft.VisualCpp.PGO.Headers\",\"Microsoft.VisualCpp.CRT.x86.Store\",\"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Store\",\"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX64\",\"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\"Microsoft.VisualCpp.VCTip.hostX86.targetX86\",\"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources\",\"Microsoft.VisualCpp.Tools.Core.Resources\",\"Microsoft.VisualCpp.Tools.Core.x86\",\"Microsoft.VisualCpp.DIA.SDK\",\"Microsoft.VisualCpp.CRT.x86.Desktop\",\"Microsoft.VisualCpp.CRT.x64.Desktop\",\"Microsoft.VisualCpp.CRT.Source\",\"Microsoft.VisualCpp.CRT.Redist.X86\",\"Microsoft.VisualCpp.CRT.Redist.X64\",\"Microsoft.VisualCpp.CRT.Redist.Resources\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.RuntimeDebug.14\",\"Microsoft.VisualCpp.CRT.Headers\",\"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Native\",\"Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native\",\"Microsoft.VisualStudio.Component.ClassDesigner\",\"Microsoft.VisualStudio.ClassDesigner\",\"Microsoft.VisualStudio.ClassDesigner.Resources\",\"Microsoft.VisualStudio.Component.VC.Redist.14.Latest\",\"Microsoft.VisualCpp.Redist.14.Latest\",\"Microsoft.VisualCpp.Redist.14.Latest\",\"Microsoft.VisualStudio.VC.Templates.UnitTest\",\"Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP\",\"Microsoft.VisualStudio.VC.Templates.UnitTest.Resources\",\"Microsoft.VisualStudio.VC.Templates.Desktop\",\"Microsoft.VisualStudio.Component.VC.CoreIde\",\"Microsoft.VisualStudio.VC.Ide.Pro\",\"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\"Microsoft.VisualStudio.VC.Templates.Pro\",\"Microsoft.VisualStudio.VC.Templates.Pro.Resources\",\"Microsoft.VisualStudio.VC.Items.Pro\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\"Microsoft.VisualStudio.VC.Ide.x64\",\"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\"Microsoft.VisualStudio.VC.MSBuild.X64.v142\",\"Microsoft.VisualStudio.VC.MSBuild.X64\",\"Microsoft.VS.VC.MSBuild.X64.Resources\",\"Microsoft.VisualStudio.VC.MSBuild.ARM.v142\",\"Microsoft.VisualStudio.VC.MSBuild.ARM\",\"Microsoft.VisualStudio.VC.MSBuild.x86.v142\",\"Microsoft.VisualStudio.VC.MSBuild.X86\",\"Microsoft.VisualStudio.VC.MSBuild.Base\",\"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\"Microsoft.VisualStudio.VC.Ide.Dskx\",\"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base\",\"Microsoft.VisualStudio.VC.Ide.LanguageService\",\"Microsoft.VisualStudio.VC.Ide.Core\",\"Microsoft.VisualStudio.VC.Ide.Core.Resources\",\"Microsoft.VisualStudio.VC.Ide.VCPkgDatabase\",\"Microsoft.VisualStudio.VC.Ide.Progression.Enterprise\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\"Microsoft.VisualStudio.Component.CodeMap\",\"Microsoft.VisualStudio.Component.GraphDocument\",\"Microsoft.VisualStudio.Vmp\",\"Microsoft.VisualStudio.GraphDocument\",\"Microsoft.VisualStudio.GraphDocument.Resources\",\"Microsoft.VisualStudio.CodeMap\",\"Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime\",\"Microsoft.VisualStudio.Component.SQL.NCLI\",\"sqllocaldb\",\"sqlncli\",\"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions\",\"Microsoft.VisualStudio.WebToolsExtensions\",\"Microsoft.VisualStudio.WebTools\",\"Microsoft.VisualStudio.WebTools.Resources\",\"Microsoft.VisualStudio.WebTools.MSBuild\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script.Msi\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.Debugger.Script.Resources\",\"Microsoft.VisualStudio.VC.Ide.MDD\",\"Microsoft.VisualStudio.Component.NuGet\",\"Microsoft.CredentialProvider\",\"Component.Microsoft.VisualStudio.LiveShare\",\"Microsoft.VisualStudio.LiveShare\",\"Microsoft.VisualStudio.Component.Debugger.JustInTime\",\"Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi\",\"Microsoft.VisualStudio.Debugger.JustInTime\",\"Microsoft.VisualStudio.Debugger.JustInTime.Msi\",\"Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd\",\"Microsoft.IntelliTrace.DiagnosticsHubAgent.Targeted\",\"Microsoft.IntelliTrace.Debugger\",\"Microsoft.IntelliTrace.Debugger.Targeted\",\"Microsoft.IntelliTrace.FrontEnd\",\"Microsoft.DiagnosticsHub.Instrumentation\",\"Microsoft.DiagnosticsHub.CpuSampling\",\"Microsoft.DiagnosticsHub.CpuSampling.Targeted\",\"Microsoft.PackageGroup.DiagnosticsHub.Platform\",\"Microsoft.DiagnosticsHub.Collection.StopService.Uninstall\",\"Microsoft.DiagnosticsHub.Runtime\",\"Microsoft.DiagnosticsHub.Runtime.Targeted\",\"Microsoft.DiagnosticsHub.Runtime.Resources\",\"Microsoft.DiagnosticsHub.Collection\",\"Microsoft.DiagnosticsHub.Collection.Service\",\"Microsoft.DiagnosticsHub.Collection.StopService.Install\",\"Microsoft.VisualStudio.Dsl.GraphObject\",\"Microsoft.Net.4.TargetingPack\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\"Microsoft.VisualStudio.NuGet.Licenses\",\"Microsoft.WebTools.Shared\",\"Microsoft.VisualStudio.WebToolsExtensions.DotNet.Core.ItemTemplates\",\"Microsoft.VisualStudio.Component.TextTemplating\",\"Microsoft.VisualStudio.TextTemplating.MSBuild\",\"Microsoft.VisualStudio.TextTemplating.Integration\",\"Microsoft.VisualStudio.TextTemplating.Core\",\"Microsoft.VisualStudio.TextTemplating.Integration.Resources\",\"Microsoft.VisualStudio.ProTools\",\"sqlsysclrtypes\",\"sqlsysclrtypes\",\"SQLCommon\",\"Microsoft.VisualStudio.ProTools.Resources\",\"Microsoft.VisualStudio.NuGet.Core\",\"Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage\",\"Microsoft.VisualStudio.PackageGroup.IntelliTrace.Core\",\"Microsoft.IntelliTrace.Core\",\"Microsoft.IntelliTrace.Core.Concord\",\"Microsoft.IntelliTrace.Core.Targeted\",\"Microsoft.IntelliTrace.ProfilerProxy.Msi.x64\",\"Microsoft.IntelliTrace.ProfilerProxy.Msi\",\"Microsoft.VisualStudio.TestTools.DynamicCodeCoverage\",\"Microsoft.VisualStudio.TestTools.CodeCoverage.Msi\",\"Microsoft.VisualStudio.TestTools.CodeCoverage\",\"Microsoft.Icecap.Analysis\",\"Microsoft.Icecap.Analysis.Targeted\",\"Microsoft.Icecap.Analysis.Resources\",\"Microsoft.Icecap.Analysis.Resources.Targeted\",\"Microsoft.Icecap.Collection.Msi\",\"Microsoft.Icecap.Collection.Msi.Targeted\",\"Microsoft.Icecap.Collection.Msi.Resources\",\"Microsoft.Icecap.Collection.Msi.Resources.Targeted\",\"Microsoft.VisualStudio.PackageGroup.TestTools.Core\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI\",\"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI\",\"Microsoft.VisualStudio.TestTools.Pex.Common\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy\",\"Microsoft.VisualStudio.PackageGroup.MinShell.Interop\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestTools\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Remote\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Premium\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common\",\"Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources\",\"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent\",\"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE\",\"Microsoft.VisualStudio.TestTools.TestWIExtension\",\"Microsoft.VisualStudio.TestTools.TestPlatform.IDE\",\"Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors\",\"Microsoft.VisualStudio.TestTools.NE.Msi.Targeted\",\"Microsoft.VisualStudio.TestTools.NetworkEmulation\",\"Microsoft.VisualStudio.TestTools.DataCollectors\",\"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\"Microsoft.VisualStudio.WebTools.WSP.FSA\",\"Microsoft.VisualStudio.WebTools.WSP.FSA.Resources\",\"Microsoft.VisualStudio.Component.Static.Analysis.Tools\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualCpp.Redist.14\",\"Microsoft.VisualStudio.StaticAnalysis\",\"Microsoft.VisualStudio.StaticAnalysis.Resources\",\"Microsoft.VisualStudio.PackageGroup.Community\",\"Microsoft.VisualStudio.Community.Extra.Resources\",\"Microsoft.VisualStudio.Community.Extra\",\"Microsoft.VisualStudio.PackageGroup.Core\",\"Microsoft.VisualStudio.CodeSense\",\"Microsoft.VisualStudio.CodeSense.Community\",\"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\"Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Record\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Runtime\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Runtime\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Agent\",\"Microsoft.VisualStudio.Debugger.TimeTravel.Record\",\"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\"Microsoft.VisualStudio.VC.Ide.Debugger\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Concord\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources\",\"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\"Microsoft.VisualStudio.VC.Ide.Common\",\"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\"Microsoft.VisualStudio.Debugger.Parallel\",\"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\"Microsoft.VisualStudio.Debugger.CollectionAgents\",\"Microsoft.VisualStudio.Debugger.Managed\",\"Microsoft.VisualStudio.Debugger.Concord.Managed\",\"Microsoft.VisualStudio.Debugger.Concord.Managed.Resources\",\"Microsoft.VisualStudio.Debugger.Managed.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote\",\"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger.Remote.Resources\",\"Microsoft.VisualStudio.Debugger\",\"Microsoft.VisualStudio.Debugger.Package.DiagHub.Client.VSx86\",\"Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client\",\"Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client\",\"Microsoft.VisualStudio.VC.MSVCDis\",\"Microsoft.VisualStudio.ScriptedHost\",\"Microsoft.VisualStudio.ScriptedHost.Targeted\",\"Microsoft.VisualStudio.ScriptedHost.Resources\",\"Microsoft.IntelliTrace.DiagnosticsHub\",\"Microsoft.VisualStudio.Debugger.Concord\",\"Microsoft.VisualStudio.Debugger.Concord.Resources\",\"Microsoft.VisualStudio.Debugger.Resources\",\"Microsoft.PackageGroup.ClientDiagnostics\",\"Microsoft.VisualStudio.AppResponsiveness\",\"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\"Microsoft.VisualStudio.AppResponsiveness.Resources\",\"Microsoft.VisualStudio.ClientDiagnostics\",\"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\"Microsoft.VisualStudio.PackageGroup.ProfessionalCore\",\"Microsoft.VisualStudio.Professional\",\"Microsoft.VisualStudio.Professional.Msi\",\"Microsoft.VisualStudio.PackageGroup.EnterpriseCore\",\"Microsoft.VisualStudio.Enterprise.Msi\",\"Microsoft.VisualStudio.Enterprise\",\"Microsoft.ShDocVw\",\"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\"Microsoft.VisualStudio.ProjectSystem.Full\",\"Microsoft.VisualStudio.ProjectSystem\",\"Microsoft.VisualStudio.Community.x86\",\"Microsoft.VisualStudio.Community.x64\",\"Microsoft.VisualStudio.Community\",\"Microsoft.IntelliTrace.CollectorCab\",\"Microsoft.VisualStudio.Community.Resources\",\"Microsoft.VisualStudio.WebSiteProject.DTE\",\"Microsoft.MSHtml\",\"Microsoft.VisualStudio.Platform.CallHierarchy\",\"Microsoft.VisualStudio.Community.Msi.Resources\",\"Microsoft.VisualStudio.Community.Msi\",\"Microsoft.VisualStudio.Devenv.Msi\",\"Microsoft.VisualStudio.MinShell.Interop.Msi\",\"Microsoft.VisualStudio.Editors\",\"Microsoft.VisualStudio.Net.Eula.Resources\",\"Microsoft.CodeAnalysis.ExpressionEvaluator\",\"Microsoft.CodeAnalysis.VisualStudio.Setup\",\"Microsoft.Component.MSBuild\",\"Microsoft.NuGet.Build.Tasks\",\"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\"Microsoft.CodeAnalysis.Compilers\",\"Microsoft.VisualStudio.Workload.CoreEditor\",\"Microsoft.VisualStudio.Component.CoreEditor\",\"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\"Microsoft.VisualCpp.Tools.Common.UtilsPrereq\",\"Microsoft.VisualCpp.Tools.Common.Utils\",\"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\"Microsoft.VisualStudio.VC.DevCmd\",\"Microsoft.VisualStudio.VC.DevCmd.Resources\",\"Microsoft.VisualStudio.VirtualTree\",\"Microsoft.VisualStudio.PackageGroup.Progression\",\"Microsoft.VisualStudio.PerformanceProvider\",\"Microsoft.VisualStudio.GraphModel\",\"Microsoft.VisualStudio.GraphProvider\",\"Microsoft.DiaSymReader\",\"Microsoft.Build.Dependencies\",\"Microsoft.Build.FileTracker.Msi\",\"Microsoft.Build\",\"Microsoft.VisualStudio.TextMateGrammars\",\"Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common\",\"Microsoft.VisualStudio.TeamExplorer\",\"Microsoft.ServiceHub\",\"Microsoft.VisualStudio.ProjectServices\",\"Microsoft.VisualStudio.SLNX.VSIX\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.FileHandler.Msi\",\"Microsoft.VisualStudio.PackageGroup.MinShell\",\"Microsoft.VisualStudio.MinShell.Interop\",\"Microsoft.VisualStudio.Log\",\"Microsoft.VisualStudio.Log.Targeted\",\"Microsoft.VisualStudio.Log.Resources\",\"Microsoft.VisualStudio.Finalizer\",\"Microsoft.VisualStudio.Devenv\",\"Microsoft.VisualStudio.Devenv.Resources\",\"Microsoft.VisualStudio.CoreEditor\",\"Microsoft.VisualStudio.Platform.NavigateTo\",\"Microsoft.VisualStudio.Connected\",\"Microsoft.VisualStudio.Connected.Resources\",\"Microsoft.VisualStudio.MinShell\",\"Microsoft.VisualStudio.Setup.Configuration\",\"Microsoft.VisualStudio.Platform.Search\",\"Microsoft.VisualStudio.MinShell.Platform\",\"Microsoft.VisualStudio.MinShell.Platform.Resources\",\"Microsoft.VisualStudio.MefHosting\",\"Microsoft.VisualStudio.MefHosting.Resources\",\"Microsoft.VisualStudio.Initializer\",\"Microsoft.VisualStudio.ExtensionManager\",\"Microsoft.VisualStudio.Platform.Editor\",\"Microsoft.VisualStudio.MinShell.x86\",\"Microsoft.VisualStudio.NativeImageSupport\",\"Microsoft.VisualStudio.MinShell.Msi\",\"Microsoft.VisualStudio.MinShell.Msi.Resources\",\"Microsoft.VisualStudio.LanguageServer\",\"Microsoft.VisualStudio.Devenv.Config\",\"Microsoft.VisualStudio.MinShell.Resources\",\"Microsoft.Net.PackageGroup.4.7.2.Redist\",\"Microsoft.VisualStudio.Branding.Enterprise\"]}]\n"
  },
  {
    "path": "test/fixtures/VS_2022_BuildTools_arm64_only.txt",
    "content": "[\n  {\n    \"path\": \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2022\\\\BuildTools\",\n    \"version\": \"17.11.35222.181\",\n    \"packages\": [\n      \"Microsoft.VisualStudio.Component.VC.Tools.ARM64\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM64.v143\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM64\",\n      \"Microsoft.VS.VC.vcvars.arm64.Shortcuts\",\n      \"Microsoft.VisualCpp.CA.Ext.Hostx64.TargetARM64\",\n      \"Microsoft.VC.14.41.17.11.CA.Ext.Hostx64.TargetARM64.base\",\n      \"Microsoft.VC.14.41.17.11.CA.Ext.Hostx64.TargetARM64.Res.base\",\n      \"Microsoft.VisualCpp.CA.Ext.Hostx86.TargetARM64\",\n      \"Microsoft.VC.14.41.17.11.CA.Ext.Hostx86.TargetARM64.base\",\n      \"Microsoft.VC.14.41.17.11.CA.Ext.Hostx86.TargetARM64.Res.base\",\n      \"Microsoft.VisualCpp.CA.Ext.HostARM64.TargetARM64\",\n      \"Microsoft.VC.14.41.17.11.CA.Ext.HostARM64.TargetARM64.base\",\n      \"Microsoft.VC.14.41.17.11.CA.Ext.HostARM64.TargetARM64.Res.base\",\n      \"Microsoft.VisualCpp.Tools.Hostx86.Targetarm64\",\n      \"Microsoft.VC.14.41.17.11.Tools.Hostx86.Targetarm64.base\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX86.TargetARM64.Res.base\",\n      \"Microsoft.VisualCpp.Tools.HostARM64.TargetARM64\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostARM64.TargetARM64.base\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostARM64.TargetARM64.Res.base\",\n      \"Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop\",\n      \"Microsoft.VC.14.40.17.10.CRT.Redist.ARM64.OneCore.Desktop.base\",\n      \"Microsoft.VisualCpp.CRT.Redist.ARM64\",\n      \"Microsoft.VC.14.40.17.10.CRT.Redist.ARM64.base\",\n      \"Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop\",\n      \"Microsoft.VC.14.41.17.11.CRT.ARM64.OneCore.Desktop.base\",\n      \"Microsoft.VC.14.41.17.11.CRT.ARM64.OneCore.Desktop.debug.base\",\n      \"Microsoft.VisualCpp.CRT.ARM64.Store\",\n      \"Microsoft.VC.14.41.17.11.CRT.ARM64.Store.base\",\n      \"Microsoft.VisualCpp.CRT.ARM64.Desktop\",\n      \"Microsoft.VC.14.41.17.11.CRT.ARM64.Desktop.base\",\n      \"Microsoft.VC.14.41.17.11.CRT.ARM64.Desktop.debug.base\",\n      \"Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM64\",\n      \"Microsoft.VisualCpp.Tools.Core\",\n      \"Microsoft.VisualCpp.PGO.ARM64\",\n      \"Microsoft.VC.14.41.17.11.PGO.ARM64.base\",\n      \"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm64\",\n      \"Microsoft.VC.14.41.17.11.Premium.Tools.Hostx86.Targetarm64.base\",\n      \"Microsoft.VC.14.41.17.11.Prem.HostX86.TargetARM64.Res.base\",\n      \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64\",\n      \"Microsoft.VC.14.41.17.11.Premium.Tools.HostX64.TargetARM64.base\",\n      \"Microsoft.VC.14.41.17.11.Prem.HostX64.TargetARM64.Res.base\",\n      \"Microsoft.VisualCpp.Premium.Tools.ARM64.Base\",\n      \"Microsoft.VC.14.41.17.11.Premium.Tools.ARM64.Base.base\",\n      \"Microsoft.VisualCpp.Tools.HostX64.TargetARM64\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX64.TargetARM64.base\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX64.TargetARM64.Res.base\",\n      \"Microsoft.VC.14.41.17.11.Props.ARM64\",\n      \"Microsoft.VisualStudio.TestTools.TestWIExtension\",\n      \"Microsoft.VisualStudio.TestTools.TestPlatform.IDE\",\n      \"Microsoft.VisualStudio.VC.Ide.Pro\",\n      \"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\n      \"Microsoft.VisualStudio.VC.Templates.General\",\n      \"Microsoft.VisualStudio.VC.Templates.General.Resources\",\n      \"Microsoft.VisualStudio.VC.Items.Pro\",\n      \"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\n      \"Microsoft.VisualStudio.VC.Ide.MDD\",\n      \"Microsoft.VisualStudio.PackageGroup.Core\",\n      \"Microsoft.VisualStudio.CodeSense.Community\",\n      \"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\n      \"Microsoft.PackageGroup.ClientDiagnostics\",\n      \"Microsoft.VisualStudio.AppResponsiveness\",\n      \"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\n      \"Microsoft.VisualStudio.AppResponsiveness.Resources\",\n      \"Microsoft.VisualStudio.ClientDiagnostics\",\n      \"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\n      \"Microsoft.VisualStudio.Component.VC.Llvm.Clang\",\n      \"Microsoft.VisualStudio.VC.Llvm.Clang\",\n      \"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\n      \"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\n      \"Microsoft.VisualStudio.ProjectSystem.Full\",\n      \"Microsoft.VisualStudio.Product.BuildTools\",\n      \"Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager\",\n      \"Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager.Resources\",\n      \"Microsoft.VisualStudio.PackageGroup.TestTools.Core\",\n      \"Microsoft.VC.14.41.17.11.Props.x86\",\n      \"Microsoft.VC.14.41.17.11.Props\",\n      \"Microsoft.VisualCpp.RuntimeDebug.14\",\n      \"Microsoft.VisualCpp.RuntimeDebug.14.ARM64\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX86.TargetX86.Res.base\",\n      \"Microsoft.VisualCpp.Tools.Core.Resources\",\n      \"Microsoft.VisualCpp.Tools.Core.x86\",\n      \"Microsoft.VC.14.41.17.11.Tools.Core.Props\",\n      \"Microsoft.VisualCpp.Tools.Common.Utils\",\n      \"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\n      \"Microsoft.VisualCpp.DIA.SDK\",\n      \"Microsoft.VisualCpp.Servicing.DIASDK\",\n      \"Microsoft.VisualCpp.CRT.x86.Desktop\",\n      \"Microsoft.VisualStudio.Workload.VCTools\",\n      \"Microsoft.VC.14.41.17.11.CRT.x64.Desktop.base\",\n      \"Microsoft.VisualCpp.CRT.Source\",\n      \"Microsoft.VC.14.41.17.11.CRT.Source.base\",\n      \"Microsoft.VisualCpp.CRT.Headers\",\n      \"Microsoft.VC.14.41.17.11.CRT.Headers.Resources\",\n      \"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset\",\n      \"Microsoft.VisualCpp.CRT.Redist.Resources\",\n      \"Microsoft.VC.14.41.17.11.CRT.Headers.Resources.base\",\n      \"Microsoft.VisualStudio.VC.MSBuild.Llvm\",\n      \"Microsoft.VisualStudio.VC.MSBuild.Llvm.Resources\",\n      \"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core\",\n      \"Microsoft.VisualStudio.PackageGroup.TestTools.Native\",\n      \"Microsoft.VisualStudio.VC.Templates.UnitTest\",\n      \"Microsoft.VisualStudio.VC.Templates.UnitTest.Resources\",\n      \"Microsoft.VisualCpp.ATL.ARM64\",\n      \"Microsoft.VC.14.41.17.11.ATL.ARM64.base\",\n      \"Microsoft.VisualStudio.Community.VB.Targeted\",\n      \"Microsoft.VisualStudio.Community.VB.Neutral\",\n      \"Microsoft.VisualStudio.Community.CSharp.Targeted\",\n      \"Microsoft.VisualStudio.Community.CSharp.Neutral\",\n      \"Microsoft.VisualStudio.Community.ProductArch.TargetedExtra\",\n      \"Microsoft.VisualStudio.VC.MSBuild.Base\",\n      \"Microsoft.VisualStudio.VC.MSBuild.Base.Resources\",\n      \"Microsoft.VisualStudio.VC.Templates.Desktop\",\n      \"Microsoft.VisualStudio.Component.VC.CoreIde\",\n      \"Microsoft.VisualCpp.ATL.ARM64.Spectre\",\n      \"Microsoft.VisualStudio.Component.VC.ATL.ARM64\",\n      \"Microsoft.VisualCpp.CRT.x86.Store\",\n      \"Microsoft.VC.14.41.17.11.ATL.ARM64.Spectre.base\",\n      \"Microsoft.VC.14.41.17.11.CRT.x86.Store.base\",\n      \"Microsoft.VC.14.41.17.11.Props.ARM64.Spectre\",\n      \"Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre\",\n      \"Microsoft.VisualStudio.Community.x64\",\n      \"Microsoft.VisualStudio.Community.ProductArch.Targeted\",\n      \"Microsoft.VisualStudio.Community.ProductArch.NeutralExtra\",\n      \"Microsoft.IntelliTrace.CollectorCab\",\n      \"Microsoft.VisualStudio.Community.VB.Resources.Targeted\",\n      \"Microsoft.VisualStudio.Community.VB.Resources.Neutral\",\n      \"Microsoft.VisualStudio.Community.CSharp.Resources.Targeted\",\n      \"Microsoft.VisualStudio.Community.CSharp.Resources.Neutral\",\n      \"Microsoft.VisualStudio.Community.ProductArch.Resources.Targeted\",\n      \"Microsoft.VisualStudio.Community.ProductArch.Resources.NeutralExtra\",\n      \"Microsoft.VisualStudio.Community.ProductArch.Resources.Neutral\",\n      \"Microsoft.VisualStudio.WebSiteProject.DTE\",\n      \"Microsoft.VisualStudio.Diagnostics.AspNetHelper\",\n      \"Microsoft.MSHtml\",\n      \"Microsoft.VisualStudio.Platform.CallHierarchy\",\n      \"Microsoft.VisualStudio.Community.ProductArch.Neutral\",\n      \"Microsoft.VisualStudio.Community.Msi.Resources\",\n      \"Microsoft.VisualStudio.Community.Msi\",\n      \"Microsoft.VisualStudio.Community.Shared.Msi\",\n      \"Microsoft.VisualStudio.MinShell.Interop.Msi\",\n      \"Microsoft.VisualStudio.MinShell.Interop.Shared.Msi\",\n      \"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\n      \"Microsoft.VisualStudio.ScriptedHost\",\n      \"Microsoft.VisualStudio.ScriptedHost.Targeted\",\n      \"Microsoft.VisualStudio.VirtualTree\",\n      \"Microsoft.VisualStudio.PackageGroup.Progression\",\n      \"Microsoft.VisualStudio.PerformanceProvider\",\n      \"Microsoft.VisualStudio.GraphModel\",\n      \"Microsoft.VisualStudio.GraphProvider\",\n      \"Microsoft.VisualStudio.TextMateGrammars\",\n      \"Microsoft.VisualStudio.Platform.Markdown\",\n      \"Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common\",\n      \"Microsoft.VisualStudio.PackageGroup.ServiceHub\",\n      \"Microsoft.ServiceHub.Node\",\n      \"Microsoft.ServiceHub.Managed\",\n      \"Microsoft.VisualStudio.OpenFolder.VSIX\",\n      \"Microsoft.VisualStudio.FileHandler.Msi\",\n      \"Microsoft.VisualStudio.FileHandler.Msi\",\n      \"Microsoft.VisualStudio.PackageGroup.MinShell\",\n      \"Microsoft.VisualStudio.MinShell.Msi\",\n      \"Microsoft.VisualStudio.MinShell.Shared.Msi\",\n      \"Microsoft.VisualStudio.MinShell.Msi.Resources\",\n      \"Microsoft.VisualStudio.MinShell.Interop\",\n      \"Microsoft.VisualStudio.Log\",\n      \"Microsoft.VisualStudio.Log.Targeted\",\n      \"Microsoft.VisualStudio.Log.Resources\",\n      \"Microsoft.VisualStudio.Finalizer\",\n      \"Microsoft.VisualStudio.CoreEditor\",\n      \"Microsoft.VisualStudio.Platform.NavigateTo\",\n      \"Microsoft.VisualStudio.Connected\",\n      \"Microsoft.VisualStudio.Identity\",\n      \"Microsoft.Developer.IdentityServiceGS\",\n      \"SQLitePCLRaw\",\n      \"SQLitePCLRaw.Targeted\",\n      \"Microsoft.VisualStudio.Connected.Auto\",\n      \"Microsoft.VisualStudio.Connected.Auto.Resources\",\n      \"Microsoft.VisualStudio.Connected.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.x64\",\n      \"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\n      \"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\n      \"Microsoft.VisualStudio.Debugger.Script\",\n      \"Microsoft.VisualStudio.Debugger.Script.Resources\",\n      \"Microsoft.VisualStudio.Debugger.Script.Remote\",\n      \"Microsoft.WebView2\",\n      \"Microsoft.VisualStudio.Debugger.Script.Remote\",\n      \"Microsoft.VisualStudio.Debugger.Script.Remote.Resources\",\n      \"Microsoft.VisualStudio.Debugger.Script.Remote.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\n      \"Microsoft.VisualStudio.VC.Ide.Dskx\",\n      \"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.Base\",\n      \"Microsoft.VisualStudio.VC.Ide.LanguageService\",\n      \"Microsoft.VisualStudio.VC.Copilot.Setup\",\n      \"Microsoft.VisualStudio.VC.Ide.VCPkgDatabase\",\n      \"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\n      \"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.Core\",\n      \"Microsoft.VisualStudio.VisualC.Utilities\",\n      \"Microsoft.VisualStudio.VisualC.Utilities.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\n      \"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\n      \"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\n      \"Microsoft.VisualStudio.VC.Llvm.Base\",\n      \"CoreEditorFonts\",\n      \"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\n      \"Microsoft.VisualStudio.Component.TextTemplating\",\n      \"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\n      \"Microsoft.VisualStudio.Debugger.BrokeredServices\",\n      \"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\n      \"Microsoft.VisualStudio.Debugger.AzureAttach\",\n      \"Microsoft.VisualStudio.Web.Azure.Common\",\n      \"Microsoft.WebTools.Shared\",\n      \"Microsoft.WebTools.DotNet.Core.ItemTemplates\",\n      \"Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Replay\",\n      \"Microsoft.VisualStudio.VC.Ide.Debugger\",\n      \"Microsoft.VisualStudio.VC.Ide.Debugger.Concord\",\n      \"Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.Common\",\n      \"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\n      \"Microsoft.VisualStudio.Debugger.CollectionAgents\",\n      \"Microsoft.VisualStudio.Debugger.Parallel\",\n      \"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\n      \"Microsoft.VisualStudio.Debugger.Managed\",\n      \"Microsoft.DiaSymReader\",\n      \"Microsoft.CodeAnalysis.ExpressionEvaluator\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Managed\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Managed.Resources\",\n      \"Microsoft.VisualStudio.Debugger.Managed.Resources\",\n      \"Microsoft.VisualStudio.Debugger.TargetComposition\",\n      \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote.arm64\",\n      \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote\",\n      \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote\",\n      \"Microsoft.VisualStudio.Debugger.Remote\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Remote\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\n      \"Microsoft.VisualStudio.VC.Ide.LanguageService.Dependencies\",\n      \"Microsoft.VisualStudio.Debugger.Remote\",\n      \"Microsoft.VisualStudio.Debugger.Remote.ARM64\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Remote.ARM64\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources.ARM64\",\n      \"Microsoft.VisualStudio.Debugger.Remote.ARM\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Remote.ARM\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources.ARM\",\n      \"Microsoft.VisualStudio.Debugger.Remote.Resources.ARM\",\n      \"Microsoft.VisualStudio.Debugger.Remote.Resources.ARM64\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Remote\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\n      \"Microsoft.VisualStudio.Debugger.Remote.Resources\",\n      \"Microsoft.VisualStudio.Debugger.Remote.Resources\",\n      \"Microsoft.VisualStudio.Debugger\",\n      \"Microsoft.VisualStudio.AzureSDK\",\n      \"Microsoft.VisualStudio.Editors\",\n      \"Microsoft.VisualStudio.VC.MSVCDis\",\n      \"Microsoft.IntelliTrace.DiagnosticsHub\",\n      \"Microsoft.VisualStudio.MinShell\",\n      \"Microsoft.VisualStudio.Copilot.Contracts\",\n      \"Microsoft.VisualStudio.Licensing\",\n      \"Microsoft.VisualStudio.IdentityDependencies\",\n      \"Microsoft.VisualStudio.GitHubProtocolHandler.Msi\",\n      \"Microsoft.VisualStudio.VsWebProtocolSelector.Msi\",\n      \"Microsoft.VisualStudio.Extensibility.Container\",\n      \"Microsoft.VisualStudio.LanguageServer\",\n      \"Microsoft.VisualStudio.MefHosting\",\n      \"Microsoft.VisualStudio.Initializer\",\n      \"Microsoft.VisualStudio.ExtensionManager\",\n      \"Microsoft.VisualStudio.ExtensionManager.Auto\",\n      \"Microsoft.VisualStudio.Platform.Editor\",\n      \"Microsoft.VisualStudio.MinShell.Targeted\",\n      \"Microsoft.VisualStudio.Devenv.Config\",\n      \"Microsoft.VisualStudio.MinShell.Resources\",\n      \"Microsoft.VisualStudio.UIInternal.Guide\",\n      \"Microsoft.VisualStudio.UIInternal\",\n      \"Microsoft.VisualStudio.UIInternal.Resources\",\n      \"Microsoft.VisualStudio.CoreDotNet\",\n      \"Microsoft.VisualStudio.MinShell.Auto\",\n      \"Microsoft.VisualStudio.MinShell.Auto.Resources\",\n      \"Microsoft.VisualStudio.Debugger.Concord\",\n      \"Microsoft.VisualStudio.Debugger.Concord.Resources\",\n      \"Microsoft.VisualStudio.Debugger.Resources\",\n      \"Microsoft.DiaSymReader.PortablePdb\",\n      \"Microsoft.VisualStudio.PerfLib\",\n      \"Microsoft.VisualStudio.Debugger.Package.DiagHub.Client\",\n      \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n      \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n      \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n      \"Microsoft.VisualStudio.TextTemplating.MSBuild\",\n      \"Microsoft.VisualStudio.TextTemplating.Integration\",\n      \"Microsoft.VisualStudio.TextTemplating.Core\",\n      \"Microsoft.VisualStudio.PackageGroup.Roslyn.LanguageServices\",\n      \"Microsoft.CodeAnalysis.VisualStudio.Setup\",\n      \"Microsoft.VisualStudio.TextTemplating.Integration.Resources\",\n      \"Microsoft.VC.14.41.17.11.Props.IFC\",\n      \"Microsoft.VisualStudio.Component.VC.ASAN\",\n      \"Microsoft.VisualCpp.ASAN.X86\",\n      \"Microsoft.VC.14.41.17.11.ASAN.X86.base\",\n      \"Microsoft.VC.14.41.17.11.ASAN.X64.base\",\n      \"Microsoft.VC.14.41.17.11.ASAN.Headers.base\",\n      \"Microsoft.VC.14.41.17.11.Props.ATLMFC\",\n      \"Microsoft.VisualCpp.ATL.Source\",\n      \"Microsoft.VC.14.41.17.11.ATL.Source.base\",\n      \"Microsoft.VisualCpp.ATL.Headers\",\n      \"Microsoft.VC.14.41.17.11.ATL.Headers.base\",\n      \"Microsoft.VC.14.41.17.11.Servicing.ATL\",\n      \"Microsoft.VisualStudio.Component.TestTools.BuildTools\",\n      \"Microsoft.VisualStudio.PackageGroup.TestTools.BuildTools\",\n      \"Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage\",\n      \"Microsoft.VisualStudio.TestTools.DynamicCodeCoverage\",\n      \"Microsoft.CodeCoverage.Console.Targeted\",\n      \"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI\",\n      \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI\",\n      \"Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI\",\n      \"Microsoft.VisualStudio.Component.Windows11SDK.22621\",\n      \"Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core\",\n      \"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP\",\n      \"Microsoft.VisualStudio.Component.VC.Redist.14.Latest\",\n      \"Microsoft.VC.14.41.17.11.CA.Rulesets.base\",\n      \"Microsoft.VC.14.41.17.11.Servicing.CARulesets\",\n      \"Microsoft.VC.14.41.17.11.Servicing.CAExtensions\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX64.TargetX86.base\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX64.TargetX86.Res.base\",\n      \"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX64.TargetX64.base\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX64.TargetX64.Res.base\",\n      \"Microsoft.VisualCpp.Tools.HostARM64.TargetX86\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostARM64.TargetX86.base\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostARM64.TargetX86.Res.base\",\n      \"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\n      \"Microsoft.VC.14.41.17.11.Premium.Tools.HostX86.TargetX86.base\",\n      \"Microsoft.VisualStudio.Component.VC.Modules.ARM64\",\n      \"Microsoft.VC.14.41.17.11.Prem.HostX86.TargetX86.Res.base\",\n      \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\n      \"Microsoft.VC.14.41.17.11.Premium.Tools.HostX64.TargetX64.base\",\n      \"Microsoft.VC.14.41.17.11.Prem.HostX64.TargetX64.Res.base\",\n      \"Microsoft.Build.Arm64\",\n      \"Microsoft.Build.UnGAC\",\n      \"Microsoft.VisualStudio.VC.Icons\",\n      \"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\n      \"Microsoft.VC.14.41.17.11.CRT.x86.OneCore.Desktop.base\",\n      \"Microsoft.VisualCpp.CRT.x64.Store\",\n      \"Microsoft.VC.14.41.17.11.CRT.x64.Store.base\",\n      \"Microsoft.VisualStudio.InstrumentationEngine.ARM64\",\n      \"Microsoft.VisualStudio.InstrumentationEngine\",\n      \"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\n      \"Microsoft.VC.14.41.17.11.CRT.x64.OneCore.Desktop.base\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX86.TargetX64.base\",\n      \"Microsoft.VC.14.41.17.11.Props.x64\",\n      \"Microsoft.VC.14.41.17.11.Tools.Hostx86.Targetx64.Res.base\",\n      \"Win11SDK_10.0.22621\",\n      \"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\n      \"Microsoft.VC.14.41.17.11.Tools.HostX86.TargetX86.base\",\n      \"Microsoft.VC.14.41.17.11.Servicing.Compilers\",\n      \"Microsoft.VisualCpp.Redist.14.Latest\",\n      \"Microsoft.VisualCpp.Redist.14.Latest\",\n      \"Microsoft.VisualStudio.LiveShareApi\",\n      \"Microsoft.VisualStudio.ProjectSystem.Query\",\n      \"Microsoft.VisualStudio.Component.VC.Tools.ARM64EC\",\n      \"Microsoft.VisualCpp.CRT.ARM64EC.Store\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM64EC.v143\",\n      \"Microsoft.VC.14.41.17.11.CRT.ARM64EC.Store.base\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM64EC\",\n      \"Microsoft.VC.14.41.17.11.CRT.x86.Desktop.base\",\n      \"Microsoft.VisualCpp.CRT.x64.Desktop\",\n      \"Microsoft.VisualStudio.ProjectSystem\",\n      \"Microsoft.VisualStudio.Community.x86\",\n      \"Microsoft.VisualCpp.IFC.arm64\",\n      \"Microsoft.VisualCpp.Redist.14\",\n      \"Microsoft.VisualCpp.Redist.14\",\n      \"Microsoft.VisualCpp.Servicing.Redist\",\n      \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE\",\n      \"Microsoft.VC.14.41.17.11.CRT.Headers.base\",\n      \"Microsoft.VC.14.41.17.11.Servicing.CrtHeaders\",\n      \"Microsoft.VC.14.41.17.11.Servicing\",\n      \"Microsoft.VisualStudio.Component.VC.CoreBuildTools\",\n      \"Microsoft.VisualStudio.VC.vcvars\",\n      \"Microsoft.VS.VC.vcvars.x86.Shortcuts\",\n      \"Microsoft.Windows.UniversalCRT.Redistributable.Msi\",\n      \"Microsoft.VS.VC.vcvars.x64.Shortcuts\",\n      \"Microsoft.VS.VC.vcvars.arm64_x64.Shortcuts\",\n      \"Microsoft.VisualStudio.Component.Windows10SDK\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.x86.v143\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.X86\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.X64.v143\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.X64\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM.v143\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.Base\",\n      \"Microsoft.VisualStudio.VC.MSBuild.v170.Base.Resources\",\n      \"Microsoft.VisualStudio.Workload.MSBuildTools\",\n      \"Microsoft.VisualStudio.Component.CoreBuildTools\",\n      \"Microsoft.VisualStudio.Setup.Configuration\",\n      \"Microsoft.VisualStudio.PackageGroup.Setup.Common\",\n      \"Microsoft.VisualStudio.Setup.WMIProvider\",\n      \"Microsoft.VisualStudio.Setup.Configuration.Interop\",\n      \"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\n      \"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\n      \"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\n      \"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\n      \"Microsoft.VisualStudio.VC.DevCmd\",\n      \"Microsoft.VisualStudio.VC.DevCmd.Resources\",\n      \"Microsoft.VisualStudio.BuildTools.Resources\",\n      \"Microsoft.VisualStudio.Net.Eula.Resources\",\n      \"Microsoft.Build.Dependencies\",\n      \"Microsoft.NuGet.Build.Tasks.Setup\",\n      \"Microsoft.Build.FileTracker.Msi\",\n      \"Microsoft.Component.MSBuild\",\n      \"Microsoft.PythonTools.BuildCore.Vsix\",\n      \"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\n      \"Microsoft.CodeAnalysis.Compilers\",\n      \"Microsoft.VisualStudio.NativeImageSupport\",\n      \"Microsoft.Build\",\n      \"Microsoft.VisualStudio.PackageGroup.NuGet\",\n      \"Microsoft.VisualStudio.NuGet.BuildTools\"\n    ]\n  }\n]\n"
  },
  {
    "path": "test/fixtures/VS_2022_Community_workload.txt",
    "content": "[\n    {\n        \"path\": \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community\",\n        \"version\": \"17.4.33213.308\",\n        \"packages\": [\n            \"Microsoft.VisualStudio.Product.Community\",\n            \"Microsoft.VisualStudio.PackageGroup.LiveShare.VSCore\",\n            \"Microsoft.VisualStudio.LiveShare.VSCore\",\n            \"Microsoft.VisualStudio.Workload.NativeDesktop\",\n            \"Microsoft.VisualStudio.Component.VC.ASAN\",\n            \"Microsoft.VisualCpp.ASAN.X86\",\n            \"Microsoft.VC.14.34.17.4.ASAN.X86.base\",\n            \"Microsoft.VC.14.34.17.4.ASAN.X64.base\",\n            \"Microsoft.VC.14.34.17.4.ASAN.Headers.base\",\n            \"Microsoft.VisualStudio.VC.IDE.Project.Factories\",\n            \"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest\",\n            \"Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest\",\n            \"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest\",\n            \"Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest\",\n            \"Microsoft.VisualStudio.Component.VC.CMake.Project\",\n            \"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake\",\n            \"Microsoft.VisualStudio.VC.CMake\",\n            \"Microsoft.VisualStudio.VC.CMake.Project\",\n            \"Microsoft.VisualStudio.VC.CMake.Client\",\n            \"Microsoft.VisualStudio.VC.ExternalBuildFramework\",\n            \"Microsoft.VisualStudio.Component.VC.DiagnosticTools\",\n            \"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.Native\",\n            \"Microsoft.VisualStudio.Component.VC.Redist.14.Latest\",\n            \"Microsoft.VisualStudio.VC.Templates.UnitTest\",\n            \"Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP\",\n            \"Microsoft.VisualStudio.VC.Templates.UnitTest.Resources\",\n            \"Microsoft.VisualStudio.VC.Templates.Desktop\",\n            \"Microsoft.VisualStudio.Component.Graphics\",\n            \"Microsoft.VisualStudio.Graphics.Viewers\",\n            \"Microsoft.VisualStudio.Graphics.Viewers.Resources\",\n            \"Microsoft.VisualStudio.Component.VC.ATL.ARM64\",\n            \"Microsoft.VisualCpp.ATL.ARM64\",\n            \"Microsoft.VC.14.34.17.4.ATL.ARM64.base\",\n            \"Microsoft.VisualStudio.Component.VC.ATL\",\n            \"Microsoft.VisualStudio.VC.Ide.ATL\",\n            \"Microsoft.VisualStudio.VC.Ide.ATL.Resources\",\n            \"Microsoft.VisualCpp.ATL.X86\",\n            \"Microsoft.VC.14.34.17.4.ATL.X86.base\",\n            \"Microsoft.VisualCpp.ATL.X64\",\n            \"Microsoft.VC.14.34.17.4.ATL.X64.base\",\n            \"Microsoft.VC.14.34.17.4.Props.ATLMFC\",\n            \"Microsoft.VisualCpp.ATL.Source\",\n            \"Microsoft.VC.14.34.17.4.ATL.Source.base\",\n            \"Microsoft.VisualCpp.ATL.Headers\",\n            \"Microsoft.VC.14.34.17.4.ATL.Headers.base\",\n            \"Microsoft.VC.14.34.17.4.Servicing.ATL\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.ARM64\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM64.v143\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM64\",\n            \"Microsoft.VS.VC.vcvars.arm64.Shortcuts\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.TargetARM64\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.TargetARM64.base\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.TargetARM64\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.TargetARM64.base\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.TargetARM64\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.TargetARM64.base\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.Hostx86.Targetarm64\",\n            \"Microsoft.VC.14.34.17.4.Tools.Hostx86.Targetarm64.base\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetARM64\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetARM64.base\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.Redist.ARM64.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.ARM64\",\n            \"Microsoft.VC.14.34.17.4.CRT.Redist.ARM64.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.ARM64.OneCore.Desktop.base\",\n            \"Microsoft.VC.14.34.17.4.CRT.ARM64.OneCore.Desktop.debug.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.Store\",\n            \"Microsoft.VC.14.34.17.4.CRT.ARM64.Store.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.ARM64.Desktop.base\",\n            \"Microsoft.VC.14.34.17.4.CRT.ARM64.Desktop.debug.base\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM64\",\n            \"Microsoft.VisualCpp.Tools.Core\",\n            \"Microsoft.VisualCpp.PGO.ARM64\",\n            \"Microsoft.VC.14.34.17.4.PGO.ARM64.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm64\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.Hostx86.Targetarm64.base\",\n            \"Microsoft.VC.14.34.17.4.Prem.HostX86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.HostX64.TargetARM64.base\",\n            \"Microsoft.VC.14.34.17.4.Prem.HostX64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.ARM64.Base\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.ARM64.Base.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetARM64\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX64.TargetARM64.base\",\n            \"Microsoft.VC.14.34.17.4.Props.ARM64\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX64.TargetARM64.Res.base\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.ARM64EC\",\n            \"Microsoft.VisualStudio.Component.Windows11SDK.22621\",\n            \"Win11SDK_10.0.22621\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM64EC.v143\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM64EC\",\n            \"Microsoft.VisualCpp.CRT.ARM64EC.Store\",\n            \"Microsoft.VC.14.34.17.4.CRT.ARM64EC.Store.base\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n            \"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.Targetx64\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.Targetx64.base\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.Targetx86\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.Targetx86.base\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.Targetx64\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.Targetx64.base\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.Targetx86\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.Targetx86.base\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.Targetx64\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.Targetx64.base\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.Targetx86\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.Targetx86.base\",\n            \"Microsoft.VC.14.34.17.4.Servicing.CAExtensions\",\n            \"Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX64.TargetX86.base\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX64.TargetX64.base\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX64.TargetX64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetX86\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetX86.base\",\n            \"Microsoft.VisualCpp.RuntimeDebug.14\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetX64\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetX64.base\",\n            \"Microsoft.VisualCpp.RuntimeDebug.14.ARM64\",\n            \"Microsoft.VisualCpp.Redist.14.Latest\",\n            \"Microsoft.VisualCpp.Redist.14.Latest\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.HostX86.TargetX64.base\",\n            \"Microsoft.VC.14.34.17.4.Prem.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.HostX86.TargetX86.base\",\n            \"Microsoft.VC.14.34.17.4.Prem.HostX86.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostARM64.TargetX86\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.HostARM64.TargetX86.base\",\n            \"Microsoft.VC.14.34.17.4.Prem.HostARM64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostARM64.TargetX64\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.HostARM64.TargetX64.base\",\n            \"Microsoft.VC.14.34.17.4.Prem.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.HostX64.TargetX86.base\",\n            \"Microsoft.VC.14.34.17.4.Prem.HostX64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\n            \"Microsoft.VC.14.34.17.4.Premium.Tools.HostX64.TargetX64.base\",\n            \"Microsoft.VC.14.34.17.4.Prem.HostX64.TargetX64.Res.base\",\n            \"Microsoft.VisualCpp.PGO.X86\",\n            \"Microsoft.VC.14.34.17.4.PGO.X86.base\",\n            \"Microsoft.VisualCpp.PGO.X64\",\n            \"Microsoft.VC.14.34.17.4.PGO.X64.base\",\n            \"Microsoft.VisualCpp.PGO.Headers\",\n            \"Microsoft.VC.14.34.17.4.PGO.Headers.base\",\n            \"Microsoft.VisualCpp.CRT.x86.Store\",\n            \"Microsoft.VC.14.34.17.4.CRT.x86.Store.base\",\n            \"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.x86.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.x64.Store\",\n            \"Microsoft.VC.14.34.17.4.CRT.x64.Store.base\",\n            \"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.x64.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.Redist.x86.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.Redist.x64.OneCore.Desktop.base\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\n            \"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Res\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX86.TargetX64.base\",\n            \"Microsoft.VC.14.34.17.4.Props.x64\",\n            \"Microsoft.VC.14.34.17.4.Tools.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Res\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX86.TargetX86.base\",\n            \"Microsoft.VC.14.34.17.4.Servicing.Compilers\",\n            \"Microsoft.VC.14.34.17.4.Props.x86\",\n            \"Microsoft.VC.14.34.17.4.Props\",\n            \"Microsoft.VC.14.34.17.4.Tools.HostX86.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.Core.Resources\",\n            \"Microsoft.VisualCpp.Tools.Core.x86\",\n            \"Microsoft.VC.14.34.17.4.Tools.Core.Props\",\n            \"Microsoft.VisualCpp.DIA.SDK\",\n            \"Microsoft.VisualCpp.Servicing.DIASDK\",\n            \"Microsoft.VisualCpp.CRT.x86.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.x86.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.x64.Desktop\",\n            \"Microsoft.VC.14.34.17.4.CRT.x64.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Source\",\n            \"Microsoft.VC.14.34.17.4.CRT.Source.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.X86\",\n            \"Microsoft.VC.14.34.17.4.CRT.Redist.X86.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.X64\",\n            \"Microsoft.VisualCpp.CRT.Redist.Resources\",\n            \"Microsoft.VC.14.34.17.4.CRT.Redist.X64.base\",\n            \"Microsoft.VisualCpp.CRT.Headers\",\n            \"Microsoft.VC.14.34.17.4.CRT.Headers.base\",\n            \"Microsoft.VC.14.34.17.4.Servicing.CrtHeaders\",\n            \"Microsoft.VC.14.34.17.4.Servicing\",\n            \"Microsoft.VisualStudio.Component.VC.CoreIde\",\n            \"Microsoft.VisualStudio.VC.Ide.Pro\",\n            \"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\n            \"Microsoft.VisualStudio.VC.Templates.General\",\n            \"Microsoft.VisualStudio.VC.Templates.General.Resources\",\n            \"Microsoft.VisualStudio.VC.Items.Pro\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\n            \"Microsoft.VisualStudio.VC.Ide.x64\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\n            \"Microsoft.VisualStudio.VC.vcvars\",\n            \"Microsoft.VS.VC.vcvars.x86.Shortcuts\",\n            \"Microsoft.VS.VC.vcvars.x64.Shortcuts\",\n            \"Microsoft.VS.VC.vcvars.arm64_x64.Shortcuts\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.X64.v143\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.X64\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM.v143\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.ARM\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.x86.v143\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.X86\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.Base\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v170.Base.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\n            \"Microsoft.VisualStudio.VC.Ide.Dskx\",\n            \"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Base\",\n            \"Microsoft.VisualStudio.VC.Ide.LanguageService\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.Scripts\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.PythonDistro\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.10\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.9\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.8\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.7\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.6\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.5\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.4\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.3\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.2\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.1\",\n            \"Microsoft.VisualStudio.VC.Ide.VCPkgDatabase\",\n            \"Microsoft.VisualStudio.VC.Ide.Core\",\n            \"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\n            \"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\n            \"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\n            \"Microsoft.VisualStudio.VC.Llvm.Base\",\n            \"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\n            \"Microsoft.Net.PackageGroup.4.8.1.Redist\",\n            \"Microsoft.VisualStudio.Component.IntelliCode\",\n            \"Microsoft.VisualStudio.IntelliCode.CSharp\",\n            \"Microsoft.VisualStudio.IntelliCode\",\n            \"Component.Microsoft.VisualStudio.LiveShare.2022\",\n            \"Microsoft.VisualStudio.Component.Debugger.JustInTime\",\n            \"Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi\",\n            \"Microsoft.VisualStudio.Debugger.JustInTime\",\n            \"Microsoft.VisualStudio.Debugger.JustInTime.Msi\",\n            \"Microsoft.VisualStudio.LiveShare.2022\",\n            \"Microsoft.Icecap.Analysis\",\n            \"Microsoft.Icecap.Analysis.Resources\",\n            \"Microsoft.Icecap.Analysis.Resources.Targeted\",\n            \"Microsoft.Icecap.Collection.Msi\",\n            \"Microsoft.Icecap.Collection.Msi.Targeted\",\n            \"Microsoft.Icecap.Collection.Msi.Resources\",\n            \"Microsoft.Icecap.Collection.Msi.Resources.Targeted\",\n            \"Microsoft.DiagnosticsHub.Instrumentation\",\n            \"Microsoft.DiagnosticsHub.Instrumentation.Targeted\",\n            \"Microsoft.DiagnosticsHub.CpuSampling\",\n            \"Microsoft.DiagnosticsHub.CpuSampling.Targeted\",\n            \"Microsoft.PackageGroup.DiagnosticsHub.Platform\",\n            \"Microsoft.VisualStudio.InstrumentationEngine.ARM64\",\n            \"Microsoft.VisualStudio.InstrumentationEngine\",\n            \"Microsoft.DiagnosticsHub.Runtime.ExternalDependencies\",\n            \"SQLiteCore\",\n            \"SQLiteCore.Targeted\",\n            \"Microsoft.DiagnosticsHub.Runtime.ExternalDependencies.Targeted\",\n            \"Microsoft.DiagnosticsHub.Runtime\",\n            \"Microsoft.DiagnosticsHub.Runtime.Targeted\",\n            \"Microsoft.DiagnosticsHub.Collection.ExternalDependencies.arm64\",\n            \"Microsoft.DiagnosticsHub.Collection\",\n            \"Microsoft.DiagnosticsHub.Collection.Service\",\n            \"Microsoft.VisualStudio.VC.Ide.MDD\",\n            \"Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager\",\n            \"Microsoft.VisualStudio.VisualC.Utilities\",\n            \"Microsoft.VisualStudio.VisualC.Utilities.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\n            \"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.Core\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI\",\n            \"Microsoft.VisualStudio.TestTools.Pex.Common\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy\",\n            \"Microsoft.VisualStudio.PackageGroup.MinShell.Interop\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestSettings\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE\",\n            \"Microsoft.VisualStudio.Cache.Service\",\n            \"Microsoft.VisualStudio.TestTools.TestWIExtension\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.IDE\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors\",\n            \"Microsoft.VisualStudio.Component.NuGet\",\n            \"Microsoft.CredentialProvider\",\n            \"Microsoft.VisualStudio.NuGet.Licenses\",\n            \"Microsoft.VisualStudio.Component.TextTemplating\",\n            \"Microsoft.VisualStudio.TextTemplating.MSBuild\",\n            \"Microsoft.VisualStudio.TextTemplating.Integration\",\n            \"Microsoft.VisualStudio.TextTemplating.Core\",\n            \"Microsoft.VisualStudio.TextTemplating.Integration.Resources\",\n            \"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\n            \"Microsoft.VisualStudio.Component.Roslyn.LanguageServices\",\n            \"Microsoft.VisualStudio.InteractiveWindow\",\n            \"Microsoft.DiaSymReader.Native\",\n            \"Microsoft.VisualCpp.Redist.14\",\n            \"Microsoft.VisualCpp.Redist.14\",\n            \"Microsoft.VisualCpp.Servicing.Redist\",\n            \"Microsoft.VisualStudio.PackageGroup.StaticAnalysis\",\n            \"Microsoft.VisualStudio.StaticAnalysis.IDE\",\n            \"Microsoft.VisualStudio.StaticAnalysis.IDE.Resources\",\n            \"Microsoft.VisualStudio.StaticAnalysis.FxCop.Resources\",\n            \"Microsoft.VisualStudio.StaticAnalysis.auxil\",\n            \"Microsoft.VisualStudio.StaticAnalysis.auxil.Resources\",\n            \"Roslyn.VisualStudio.Setup.ServiceHub\",\n            \"Microsoft.Component.MSBuild\",\n            \"Microsoft.NuGet.Build.Tasks.Setup\",\n            \"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\n            \"Microsoft.CodeAnalysis.Compilers\",\n            \"Microsoft.VisualStudio.Component.JavaScript.TypeScript\",\n            \"Microsoft.VisualStudio.JavaScript.ProjectSystem\",\n            \"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions\",\n            \"Microsoft.VisualStudio.ProTools\",\n            \"sqlsysclrtypes\",\n            \"SQLCommon\",\n            \"Microsoft.VisualStudio.ProTools.Resources\",\n            \"Microsoft.VisualStudio.Web.Scaffolding\",\n            \"Microsoft.VisualStudio.WebToolsExtensions\",\n            \"Microsoft.VisualStudio.ConnectedServices.Core\",\n            \"Microsoft.VisualStudio.WebTools\",\n            \"Microsoft.VisualStudio.WebToolsExtensions.MSBuild\",\n            \"Microsoft.VisualStudio.WebTools.Resources\",\n            \"Microsoft.VisualStudio.WebTools.WSP.FSA\",\n            \"Microsoft.VisualStudio.WebTools.WSP.FSA.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\n            \"Microsoft.VisualStudio.Component.TypeScript.TSServer\",\n            \"Microsoft.VisualStudio.Package.TypeScript.TSServer\",\n            \"Microsoft.VisualStudio.PackageGroup.JavaScript.Language\",\n            \"Microsoft.VisualStudio.Package.NodeJs\",\n            \"TypeScript.Build\",\n            \"TypeScript.LanguageService\",\n            \"TypeScript.Tools\",\n            \"Microsoft.VisualStudio.PackageGroup.Community\",\n            \"Microsoft.VisualStudio.Community.VB.x86\",\n            \"Microsoft.VisualStudio.Community.VB.x64\",\n            \"Microsoft.VisualStudio.PackageGroup.Core\",\n            \"Microsoft.VisualStudio.CodeSense.Community\",\n            \"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\n            \"Microsoft.VisualStudio.Debugger.BrokeredServices\",\n            \"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\n            \"Microsoft.VisualStudio.Debugger.AzureAttach\",\n            \"Microsoft.VisualStudio.Web.Azure.Common\",\n            \"Microsoft.WebTools.Shared\",\n            \"Microsoft.WebTools.DotNet.Core.ItemTemplates\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Replay\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Concord\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Common\",\n            \"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\n            \"Microsoft.VisualStudio.Debugger.CollectionAgents\",\n            \"Microsoft.VisualStudio.Debugger.Parallel\",\n            \"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Managed\",\n            \"Microsoft.CodeAnalysis.ExpressionEvaluator\",\n            \"Microsoft.CodeAnalysis.VisualStudio.Setup\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Managed\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Managed.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Managed.Resources\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote.arm64\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Remote.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Remote.ARM\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.ARM\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources.ARM\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources.ARM\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger\",\n            \"Microsoft.VisualStudio.VC.MSVCDis\",\n            \"Microsoft.IntelliTrace.DiagnosticsHub\",\n            \"Microsoft.VisualStudio.Debugger.Concord\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Package.DiagHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.PackageGroup.ClientDiagnostics\",\n            \"Microsoft.VisualStudio.AppResponsiveness\",\n            \"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\n            \"Microsoft.VisualStudio.AppResponsiveness.Resources\",\n            \"Microsoft.VisualStudio.ClientDiagnostics\",\n            \"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\n            \"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\n            \"Microsoft.VisualStudio.ProjectSystem.Full\",\n            \"Microsoft.VisualStudio.LiveShareApi\",\n            \"Microsoft.VisualStudio.ProjectSystem.Query\",\n            \"Microsoft.VisualStudio.ProjectSystem\",\n            \"Microsoft.VisualStudio.Community.x86\",\n            \"Microsoft.VisualStudio.Community.x64\",\n            \"Microsoft.VisualStudio.Community.Msi.Resources\",\n            \"Microsoft.VisualStudio.Community.Msi\",\n            \"Microsoft.VisualStudio.Community.Shared.Msi\",\n            \"Microsoft.VisualStudio.Devenv.Msi\",\n            \"Microsoft.VisualStudio.Devenv.Shared.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Interop.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Interop.Shared.Msi\",\n            \"Microsoft.VisualStudio.Editors\",\n            \"Microsoft.VisualStudio.Workload.CoreEditor\",\n            \"Microsoft.VisualStudio.Component.CoreEditor\",\n            \"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\n            \"Microsoft.WebView2\",\n            \"Microsoft.VisualStudio.ScriptedHost\",\n            \"Microsoft.VisualStudio.ScriptedHost.Targeted\",\n            \"Microsoft.VisualCpp.Tools.Common.UtilsPrereq\",\n            \"Microsoft.VisualCpp.Tools.Common.Utils\",\n            \"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\n            \"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\n            \"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\n            \"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\n            \"Microsoft.VisualStudio.VC.DevCmd\",\n            \"Microsoft.VisualStudio.VC.DevCmd.Resources\",\n            \"Microsoft.VisualStudio.VirtualTree\",\n            \"Microsoft.DiaSymReader\",\n            \"Microsoft.Build.Dependencies\",\n            \"Microsoft.Build.FileTracker.Msi\",\n            \"Microsoft.Build\",\n            \"Microsoft.VisualStudio.PackageGroup.NuGet\",\n            \"Microsoft.DataAI.NuGetRecommender\",\n            \"Microsoft.VisualStudio.NuGet.Core\",\n            \"Microsoft.Build.Arm64\",\n            \"Microsoft.Build.UnGAC\",\n            \"Microsoft.VisualStudio.TextMateGrammars\",\n            \"Microsoft.VisualStudio.Platform.Markdown\",\n            \"Microsoft.VisualStudio.Platform.CrossRepositorySearch\",\n            \"Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common\",\n            \"Microsoft.VisualStudio.TeamExplorer\",\n            \"Microsoft.VisualStudio.PackageGroup.ServiceHub\",\n            \"Microsoft.ServiceHub.Node\",\n            \"Microsoft.ServiceHub.Managed\",\n            \"Microsoft.ServiceHub.arm64\",\n            \"Microsoft.VisualStudio.ProjectServices\",\n            \"Microsoft.VisualStudio.OpenFolder.VSIX\",\n            \"Microsoft.VisualStudio.FileHandler.Msi\",\n            \"Microsoft.VisualStudio.FileHandler.Msi\",\n            \"Microsoft.VisualStudio.PackageGroup.MinShell\",\n            \"Microsoft.VisualStudio.MinShell.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Shared.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Msi.Resources\",\n            \"Microsoft.VisualStudio.MinShell.Interop\",\n            \"CoreEditorFonts\",\n            \"Microsoft.VisualStudio.Log\",\n            \"Microsoft.VisualStudio.Log.Targeted\",\n            \"Microsoft.VisualStudio.Log.Resources\",\n            \"Microsoft.VisualStudio.Finalizer\",\n            \"Microsoft.VisualStudio.Devenv\",\n            \"Microsoft.VisualStudio.Devenv.Resources\",\n            \"Microsoft.VisualStudio.CoreEditor\",\n            \"Microsoft.VisualStudio.Navigation.RichCodeNav\",\n            \"Microsoft.VisualStudio.Platform.NavigateTo\",\n            \"Microsoft.VisualStudio.Connected\",\n            \"SQLitePCLRaw\",\n            \"SQLitePCLRaw.Targeted\",\n            \"Microsoft.VisualStudio.Connected.Auto\",\n            \"Microsoft.VisualStudio.Connected.Auto.Resources\",\n            \"Microsoft.VisualStudio.AzureSDK\",\n            \"Microsoft.VisualStudio.PerfLib\",\n            \"Microsoft.VisualStudio.Connected.Resources\",\n            \"Microsoft.Net.PackageGroup.4.8.Redist\",\n            \"Microsoft.VisualStudio.PackageGroup.Progression\",\n            \"Microsoft.VisualStudio.PerformanceProvider\",\n            \"Microsoft.VisualStudio.GraphModel\",\n            \"Microsoft.VisualStudio.GraphProvider\",\n            \"Microsoft.VisualStudio.Community.VB.Targeted\",\n            \"Microsoft.VisualStudio.Community.VB.Neutral\",\n            \"Microsoft.VisualStudio.Community.CSharp.Targeted\",\n            \"Microsoft.VisualStudio.Community.CSharp.Neutral\",\n            \"Microsoft.VisualStudio.Community.ProductArch.TargetedExtra\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Targeted\",\n            \"Microsoft.VisualStudio.Community.ProductArch.NeutralExtra\",\n            \"Microsoft.DiaSymReader.PortablePdb\",\n            \"Microsoft.IntelliTrace.CollectorCab\",\n            \"Microsoft.VisualStudio.Community.VB.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.VB.Resources.Neutral\",\n            \"Microsoft.VisualStudio.Community.CSharp.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.CSharp.Resources.Neutral\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.NeutralExtra\",\n            \"Microsoft.VisualStudio.Net.Eula.Resources\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.Neutral\",\n            \"Microsoft.VisualStudio.WebSiteProject.DTE\",\n            \"Microsoft.VisualStudio.Diagnostics.AspNetHelper\",\n            \"Microsoft.VisualStudio.Diagnostics.AspNetHelper.Standard\",\n            \"Microsoft.MSHtml\",\n            \"Microsoft.VisualStudio.Platform.CallHierarchy\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Neutral\",\n            \"Microsoft.VisualStudio.MinShell\",\n            \"Microsoft.VisualStudio.VsWebProtocolSelector.Msi\",\n            \"Microsoft.Net.6.WindowsDesktop.Runtime\",\n            \"Microsoft.Net.6.Runtime\",\n            \"Microsoft.VisualStudio.PackageGroup.Setup.Common\",\n            \"Microsoft.VisualStudio.Setup.WMIProvider\",\n            \"Microsoft.VisualStudio.Setup.Configuration.Interop\",\n            \"Microsoft.VisualStudio.Setup.Configuration\",\n            \"Microsoft.VisualStudio.Extensibility.Container\",\n            \"Microsoft.VisualStudio.LanguageServer\",\n            \"Microsoft.VisualStudio.Platform.Terminal\",\n            \"Microsoft.VisualStudio.MefHosting\",\n            \"Microsoft.VisualStudio.Initializer\",\n            \"Microsoft.VisualStudio.ExtensionManager\",\n            \"Microsoft.VisualStudio.Platform.Editor\",\n            \"Microsoft.VisualStudio.MinShell.Targeted\",\n            \"Microsoft.VisualStudio.NativeImageSupport\",\n            \"Microsoft.VisualStudio.Devenv.Config\",\n            \"Microsoft.VisualStudio.MinShell.Resources.arm64\",\n            \"Microsoft.VisualStudio.MinShell.Auto\",\n            \"Microsoft.VisualStudio.MinShell.Auto.Resources\",\n            \"Microsoft.VisualStudio.Branding.Community\"\n        ]\n    }\n]\n"
  },
  {
    "path": "test/fixtures/VS_2026_Community_workload.txt",
    "content": "[\n    {\n        \"path\": \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2026\\\\Community\",\n        \"version\": \"18.0.1000.100\",\n        \"packages\": [\n            \"Microsoft.VisualStudio.Product.Community\",\n            \"Microsoft.VisualStudio.PackageGroup.LiveShare.VSCore\",\n            \"Microsoft.VisualStudio.LiveShare.VSCore\",\n            \"Microsoft.VisualStudio.Workload.NativeDesktop\",\n            \"Microsoft.VisualStudio.Component.VC.ASAN\",\n            \"Microsoft.VisualCpp.ASAN.X86\",\n            \"Microsoft.VC.14.50.18.0.ASAN.X86.base\",\n            \"Microsoft.VC.14.50.18.0.ASAN.X64.base\",\n            \"Microsoft.VC.14.50.18.0.ASAN.Headers.base\",\n            \"Microsoft.VisualStudio.VC.IDE.Project.Factories\",\n            \"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest\",\n            \"Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest\",\n            \"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest\",\n            \"Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest\",\n            \"Microsoft.VisualStudio.Component.VC.CMake.Project\",\n            \"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake\",\n            \"Microsoft.VisualStudio.VC.CMake\",\n            \"Microsoft.VisualStudio.VC.CMake.Project\",\n            \"Microsoft.VisualStudio.VC.CMake.Client\",\n            \"Microsoft.VisualStudio.VC.ExternalBuildFramework\",\n            \"Microsoft.VisualStudio.Component.VC.DiagnosticTools\",\n            \"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.Native\",\n            \"Microsoft.VisualStudio.Component.VC.Redist.14.Latest\",\n            \"Microsoft.VisualStudio.VC.Templates.UnitTest\",\n            \"Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP\",\n            \"Microsoft.VisualStudio.VC.Templates.UnitTest.Resources\",\n            \"Microsoft.VisualStudio.VC.Templates.Desktop\",\n            \"Microsoft.VisualStudio.Component.Graphics\",\n            \"Microsoft.VisualStudio.Graphics.Viewers\",\n            \"Microsoft.VisualStudio.Graphics.Viewers.Resources\",\n            \"Microsoft.VisualStudio.Component.VC.ATL.ARM64\",\n            \"Microsoft.VisualCpp.ATL.ARM64\",\n            \"Microsoft.VC.14.50.18.0.ATL.ARM64.base\",\n            \"Microsoft.VisualStudio.Component.VC.ATL\",\n            \"Microsoft.VisualStudio.VC.Ide.ATL\",\n            \"Microsoft.VisualStudio.VC.Ide.ATL.Resources\",\n            \"Microsoft.VisualCpp.ATL.X86\",\n            \"Microsoft.VC.14.50.18.0.ATL.X86.base\",\n            \"Microsoft.VisualCpp.ATL.X64\",\n            \"Microsoft.VC.14.50.18.0.ATL.X64.base\",\n            \"Microsoft.VC.14.50.18.0.Props.ATLMFC\",\n            \"Microsoft.VisualCpp.ATL.Source\",\n            \"Microsoft.VC.14.50.18.0.ATL.Source.base\",\n            \"Microsoft.VisualCpp.ATL.Headers\",\n            \"Microsoft.VC.14.50.18.0.ATL.Headers.base\",\n            \"Microsoft.VC.14.50.18.0.Servicing.ATL\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.ARM64\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM64.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM64\",\n            \"Microsoft.VS.VC.vcvars.arm64.Shortcuts\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.Hostx86.Targetarm64\",\n            \"Microsoft.VC.14.50.18.0.Tools.Hostx86.Targetarm64.base\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.ARM64.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.ARM64\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.ARM64.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.OneCore.Desktop.base\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.OneCore.Desktop.debug.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.Store\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.Store.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.Desktop.base\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.Desktop.debug.base\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM64\",\n            \"Microsoft.VisualCpp.Tools.Core\",\n            \"Microsoft.VisualCpp.PGO.ARM64\",\n            \"Microsoft.VC.14.50.18.0.PGO.ARM64.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.Hostx86.Targetarm64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.ARM64.Base\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.ARM64.Base.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.Props.ARM64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetARM64.Res.base\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.ARM64EC\",\n            \"Microsoft.VisualStudio.Component.Windows11SDK.26100\",\n            \"Win11SDK_10.0.26100\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM64EC.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM64EC\",\n            \"Microsoft.VisualCpp.CRT.ARM64EC.Store\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64EC.Store.base\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n            \"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.Targetx64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.Targetx64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.Targetx86\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.Targetx86.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.Targetx64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.Targetx64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.Targetx86\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.Targetx86.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.Targetx64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.Targetx64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.Targetx86\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.Targetx86.base\",\n            \"Microsoft.VC.14.50.18.0.Servicing.CAExtensions\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetX64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetX86.base\",\n            \"Microsoft.VisualCpp.RuntimeDebug.14\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetX64.base\",\n            \"Microsoft.VisualCpp.RuntimeDebug.14.ARM64\",\n            \"Microsoft.VisualCpp.Redist.14.Latest\",\n            \"Microsoft.VisualCpp.Redist.14.Latest\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX86.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX86.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX86.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostARM64.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostARM64.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostARM64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostARM64.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostARM64.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX64.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX64.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX64.TargetX64.Res.base\",\n            \"Microsoft.VisualCpp.PGO.X86\",\n            \"Microsoft.VC.14.50.18.0.PGO.X86.base\",\n            \"Microsoft.VisualCpp.PGO.X64\",\n            \"Microsoft.VC.14.50.18.0.PGO.X64.base\",\n            \"Microsoft.VisualCpp.PGO.Headers\",\n            \"Microsoft.VC.14.50.18.0.PGO.Headers.base\",\n            \"Microsoft.VisualCpp.CRT.x86.Store\",\n            \"Microsoft.VC.14.50.18.0.CRT.x86.Store.base\",\n            \"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.x86.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.x64.Store\",\n            \"Microsoft.VC.14.50.18.0.CRT.x64.Store.base\",\n            \"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.x64.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.x86.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.x64.OneCore.Desktop.base\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\n            \"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Res\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX86.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Props.x64\",\n            \"Microsoft.VC.14.50.18.0.Tools.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Res\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX86.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Servicing.Compilers\",\n            \"Microsoft.VC.14.50.18.0.Props.x86\",\n            \"Microsoft.VC.14.50.18.0.Props\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX86.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.Core.Resources\",\n            \"Microsoft.VisualCpp.Tools.Core.x86\",\n            \"Microsoft.VC.14.50.18.0.Tools.Core.Props\",\n            \"Microsoft.VisualCpp.DIA.SDK\",\n            \"Microsoft.VisualCpp.Servicing.DIASDK\",\n            \"Microsoft.VisualCpp.CRT.x86.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.x86.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.x64.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.x64.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Source\",\n            \"Microsoft.VC.14.50.18.0.CRT.Source.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.X86\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.X86.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.X64\",\n            \"Microsoft.VisualCpp.CRT.Redist.Resources\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.X64.base\",\n            \"Microsoft.VisualCpp.CRT.Headers\",\n            \"Microsoft.VC.14.50.18.0.CRT.Headers.base\",\n            \"Microsoft.VC.14.50.18.0.Servicing.CrtHeaders\",\n            \"Microsoft.VC.14.50.18.0.Servicing\",\n            \"Microsoft.VisualStudio.Component.VC.CoreIde\",\n            \"Microsoft.VisualStudio.VC.Ide.Pro\",\n            \"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\n            \"Microsoft.VisualStudio.VC.Templates.General\",\n            \"Microsoft.VisualStudio.VC.Templates.General.Resources\",\n            \"Microsoft.VisualStudio.VC.Items.Pro\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\n            \"Microsoft.VisualStudio.VC.Ide.x64\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\n            \"Microsoft.VisualStudio.VC.vcvars\",\n            \"Microsoft.VS.VC.vcvars.x86.Shortcuts\",\n            \"Microsoft.VS.VC.vcvars.x64.Shortcuts\",\n            \"Microsoft.VS.VC.vcvars.arm64_x64.Shortcuts\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.X64.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.X64\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.x86.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.X86\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.Base\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.Base.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\n            \"Microsoft.VisualStudio.VC.Ide.Dskx\",\n            \"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Base\",\n            \"Microsoft.VisualStudio.VC.Ide.LanguageService\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.Scripts\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.PythonDistro\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.10\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.9\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.8\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.7\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.6\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.5\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.4\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.3\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.2\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.1\",\n            \"Microsoft.VisualStudio.VC.Ide.VCPkgDatabase\",\n            \"Microsoft.VisualStudio.VC.Ide.Core\",\n            \"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\n            \"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\n            \"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\n            \"Microsoft.VisualStudio.VC.Llvm.Base\",\n            \"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\n            \"Microsoft.Net.PackageGroup.4.8.1.Redist\",\n            \"Microsoft.VisualStudio.Component.IntelliCode\",\n            \"Microsoft.VisualStudio.IntelliCode.CSharp\",\n            \"Microsoft.VisualStudio.IntelliCode\",\n            \"Component.Microsoft.VisualStudio.LiveShare.2026\",\n            \"Microsoft.VisualStudio.Component.Debugger.JustInTime\",\n            \"Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi\",\n            \"Microsoft.VisualStudio.Debugger.JustInTime\",\n            \"Microsoft.VisualStudio.Debugger.JustInTime.Msi\",\n            \"Microsoft.VisualStudio.LiveShare.2026\",\n            \"Microsoft.Icecap.Analysis\",\n            \"Microsoft.Icecap.Analysis.Resources\",\n            \"Microsoft.Icecap.Analysis.Resources.Targeted\",\n            \"Microsoft.Icecap.Collection.Msi\",\n            \"Microsoft.Icecap.Collection.Msi.Targeted\",\n            \"Microsoft.Icecap.Collection.Msi.Resources\",\n            \"Microsoft.Icecap.Collection.Msi.Resources.Targeted\",\n            \"Microsoft.DiagnosticsHub.Instrumentation\",\n            \"Microsoft.DiagnosticsHub.Instrumentation.Targeted\",\n            \"Microsoft.DiagnosticsHub.CpuSampling\",\n            \"Microsoft.DiagnosticsHub.CpuSampling.Targeted\",\n            \"Microsoft.PackageGroup.DiagnosticsHub.Platform\",\n            \"Microsoft.VisualStudio.InstrumentationEngine.ARM64\",\n            \"Microsoft.VisualStudio.InstrumentationEngine\",\n            \"Microsoft.DiagnosticsHub.Runtime.ExternalDependencies\",\n            \"SQLiteCore\",\n            \"SQLiteCore.Targeted\",\n            \"Microsoft.DiagnosticsHub.Runtime.ExternalDependencies.Targeted\",\n            \"Microsoft.DiagnosticsHub.Runtime\",\n            \"Microsoft.DiagnosticsHub.Runtime.Targeted\",\n            \"Microsoft.DiagnosticsHub.Collection.ExternalDependencies.arm64\",\n            \"Microsoft.DiagnosticsHub.Collection\",\n            \"Microsoft.DiagnosticsHub.Collection.Service\",\n            \"Microsoft.VisualStudio.VC.Ide.MDD\",\n            \"Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager\",\n            \"Microsoft.VisualStudio.VisualC.Utilities\",\n            \"Microsoft.VisualStudio.VisualC.Utilities.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\n            \"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.Core\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI\",\n            \"Microsoft.VisualStudio.TestTools.Pex.Common\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy\",\n            \"Microsoft.VisualStudio.PackageGroup.MinShell.Interop\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestSettings\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE\",\n            \"Microsoft.VisualStudio.Cache.Service\",\n            \"Microsoft.VisualStudio.TestTools.TestWIExtension\",\n            \"Microsoft.VisualStudio.TestTools.TestWIExtension.Res\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI\",\n            \"Microsoft.VisualStudio.TestTools.TP.V1.CLI.Resources\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.IDE\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors\",\n            \"Microsoft.VisualStudio.Component.NuGet\",\n            \"Microsoft.CredentialProvider\",\n            \"Microsoft.VisualStudio.NuGet.Licenses\",\n            \"Microsoft.VisualStudio.Component.TextTemplating\",\n            \"Microsoft.VisualStudio.TextTemplating.MSBuild\",\n            \"Microsoft.VisualStudio.TextTemplating.Integration\",\n            \"Microsoft.VisualStudio.TextTemplating.Core\",\n            \"Microsoft.VisualStudio.TextTemplating.Integration.Resources\",\n            \"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\n            \"Microsoft.VisualStudio.Component.Roslyn.LanguageServices\",\n            \"Microsoft.VisualStudio.InteractiveWindow\",\n            \"Microsoft.DiaSymReader.Native\",\n            \"Microsoft.VisualCpp.Redist.14\",\n            \"Microsoft.VisualCpp.Redist.14\",\n            \"Microsoft.VisualCpp.Servicing.Redist\",\n            \"Microsoft.VisualStudio.PackageGroup.StaticAnalysis\",\n            \"Microsoft.VisualStudio.StaticAnalysis.IDE\",\n            \"Microsoft.VisualStudio.StaticAnalysis.IDE.Resources\",\n            \"Microsoft.VisualStudio.StaticAnalysis.FxCop.Resources\",\n            \"Microsoft.VisualStudio.StaticAnalysis.auxil\",\n            \"Microsoft.VisualStudio.StaticAnalysis.auxil.Resources\",\n            \"Roslyn.VisualStudio.Setup.ServiceHub\",\n            \"Microsoft.Component.MSBuild\",\n            \"Microsoft.NuGet.Build.Tasks.Setup\",\n            \"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\n            \"Microsoft.CodeAnalysis.Compilers\",\n            \"Microsoft.VisualStudio.Component.JavaScript.TypeScript\",\n            \"Microsoft.VisualStudio.JavaScript.ProjectSystem\",\n            \"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions\",\n            \"Microsoft.VisualStudio.ProTools\",\n            \"sqlsysclrtypes\",\n            \"SQLCommon\",\n            \"Microsoft.VisualStudio.ProTools.Resources\",\n            \"Microsoft.VisualStudio.Web.Scaffolding\",\n            \"Microsoft.VisualStudio.WebToolsExtensions\",\n            \"Microsoft.VisualStudio.ConnectedServices.Core\",\n            \"Microsoft.VisualStudio.WebTools\",\n            \"Microsoft.VisualStudio.WebToolsExtensions.MSBuild\",\n            \"Microsoft.VisualStudio.WebTools.Resources\",\n            \"Microsoft.VisualStudio.WebTools.WSP.FSA\",\n            \"Microsoft.VisualStudio.WebTools.WSP.FSA.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\n            \"Microsoft.VisualStudio.Component.TypeScript.TSServer\",\n            \"Microsoft.VisualStudio.Package.TypeScript.TSServer\",\n            \"Microsoft.VisualStudio.PackageGroup.JavaScript.Language\",\n            \"Microsoft.VisualStudio.Package.NodeJs\",\n            \"TypeScript.Build\",\n            \"TypeScript.LanguageService\",\n            \"TypeScript.Tools\",\n            \"Microsoft.VisualStudio.PackageGroup.Community\",\n            \"Microsoft.VisualStudio.Community.VB.x86\",\n            \"Microsoft.VisualStudio.Community.VB.x64\",\n            \"Microsoft.VisualStudio.PackageGroup.Core\",\n            \"Microsoft.VisualStudio.CodeSense.Community\",\n            \"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\n            \"Microsoft.VisualStudio.Debugger.BrokeredServices\",\n            \"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\n            \"Microsoft.VisualStudio.Debugger.AzureAttach\",\n            \"Microsoft.VisualStudio.Web.Azure.Common\",\n            \"Microsoft.WebTools.Shared\",\n            \"Microsoft.WebTools.DotNet.Core.ItemTemplates\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Replay\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Concord\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Common\",\n            \"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\n            \"Microsoft.VisualStudio.Debugger.CollectionAgents\",\n            \"Microsoft.VisualStudio.Debugger.Parallel\",\n            \"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Managed\",\n            \"Microsoft.CodeAnalysis.ExpressionEvaluator\",\n            \"Microsoft.CodeAnalysis.VisualStudio.Setup\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Managed\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Managed.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Managed.Resources\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote.arm64\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Remote.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources.ARM\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger\",\n            \"Microsoft.VisualStudio.VC.MSVCDis\",\n            \"Microsoft.IntelliTrace.DiagnosticsHub\",\n            \"Microsoft.VisualStudio.Debugger.Concord\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Package.DiagHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.PackageGroup.ClientDiagnostics\",\n            \"Microsoft.VisualStudio.AppResponsiveness\",\n            \"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\n            \"Microsoft.VisualStudio.AppResponsiveness.Resources\",\n            \"Microsoft.VisualStudio.ClientDiagnostics\",\n            \"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\n            \"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\n            \"Microsoft.VisualStudio.ProjectSystem.Full\",\n            \"Microsoft.VisualStudio.LiveShareApi\",\n            \"Microsoft.VisualStudio.ProjectSystem.Query\",\n            \"Microsoft.VisualStudio.ProjectSystem\",\n            \"Microsoft.VisualStudio.Community.x86\",\n            \"Microsoft.VisualStudio.Community.x64\",\n            \"Microsoft.VisualStudio.Community.Msi.Resources\",\n            \"Microsoft.VisualStudio.Community.Msi\",\n            \"Microsoft.VisualStudio.Community.Shared.Msi\",\n            \"Microsoft.VisualStudio.Devenv.Msi\",\n            \"Microsoft.VisualStudio.Devenv.Shared.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Interop.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Interop.Shared.Msi\",\n            \"Microsoft.VisualStudio.Editors\",\n            \"Microsoft.VisualStudio.Workload.CoreEditor\",\n            \"Microsoft.VisualStudio.Component.CoreEditor\",\n            \"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\n            \"Microsoft.WebView2\",\n            \"Microsoft.VisualStudio.ScriptedHost\",\n            \"Microsoft.VisualStudio.ScriptedHost.Targeted\",\n            \"Microsoft.VisualCpp.Tools.Common.UtilsPrereq\",\n            \"Microsoft.VisualCpp.Tools.Common.Utils\",\n            \"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\n            \"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\n            \"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\n            \"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\n            \"Microsoft.VisualStudio.VC.DevCmd\",\n            \"Microsoft.VisualStudio.VC.DevCmd.Resources\",\n            \"Microsoft.VisualStudio.VirtualTree\",\n            \"Microsoft.DiaSymReader\",\n            \"Microsoft.Build.Dependencies\",\n            \"Microsoft.Build.FileTracker.Msi\",\n            \"Microsoft.Build\",\n            \"Microsoft.VisualStudio.PackageGroup.NuGet\",\n            \"Microsoft.DataAI.NuGetRecommender\",\n            \"Microsoft.VisualStudio.NuGet.Core\",\n            \"Microsoft.Build.Arm64\",\n            \"Microsoft.Build.UnGAC\",\n            \"Microsoft.VisualStudio.TextMateGrammars\",\n            \"Microsoft.VisualStudio.Platform.Markdown\",\n            \"Microsoft.VisualStudio.Platform.CrossRepositorySearch\",\n            \"Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common\",\n            \"Microsoft.VisualStudio.TeamExplorer\",\n            \"Microsoft.VisualStudio.PackageGroup.ServiceHub\",\n            \"Microsoft.ServiceHub.Node\",\n            \"Microsoft.ServiceHub.Managed\",\n            \"Microsoft.ServiceHub.arm64\",\n            \"Microsoft.VisualStudio.ProjectServices\",\n            \"Microsoft.VisualStudio.OpenFolder.VSIX\",\n            \"Microsoft.VisualStudio.FileHandler.Msi\",\n            \"Microsoft.VisualStudio.FileHandler.Msi\",\n            \"Microsoft.VisualStudio.PackageGroup.MinShell\",\n            \"Microsoft.VisualStudio.MinShell.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Shared.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Msi.Resources\",\n            \"Microsoft.VisualStudio.MinShell.Interop\",\n            \"CoreEditorFonts\",\n            \"Microsoft.VisualStudio.Log\",\n            \"Microsoft.VisualStudio.Log.Targeted\",\n            \"Microsoft.VisualStudio.Log.Resources\",\n            \"Microsoft.VisualStudio.Finalizer\",\n            \"Microsoft.VisualStudio.Devenv\",\n            \"Microsoft.VisualStudio.Devenv.Resources\",\n            \"Microsoft.VisualStudio.CoreEditor\",\n            \"Microsoft.VisualStudio.Navigation.RichCodeNav\",\n            \"Microsoft.VisualStudio.Platform.NavigateTo\",\n            \"Microsoft.VisualStudio.Connected\",\n            \"SQLitePCLRaw\",\n            \"SQLitePCLRaw.Targeted\",\n            \"Microsoft.VisualStudio.Connected.Auto\",\n            \"Microsoft.VisualStudio.Connected.Auto.Resources\",\n            \"Microsoft.VisualStudio.AzureSDK\",\n            \"Microsoft.VisualStudio.PerfLib\",\n            \"Microsoft.VisualStudio.Connected.Resources\",\n            \"Microsoft.Net.PackageGroup.4.8.Redist\",\n            \"Microsoft.VisualStudio.PackageGroup.Progression\",\n            \"Microsoft.VisualStudio.PerformanceProvider\",\n            \"Microsoft.VisualStudio.GraphModel\",\n            \"Microsoft.VisualStudio.GraphProvider\",\n            \"Microsoft.VisualStudio.Community.VB.Targeted\",\n            \"Microsoft.VisualStudio.Community.VB.Neutral\",\n            \"Microsoft.VisualStudio.Community.CSharp.Targeted\",\n            \"Microsoft.VisualStudio.Community.CSharp.Neutral\",\n            \"Microsoft.VisualStudio.Community.ProductArch.TargetedExtra\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Targeted\",\n            \"Microsoft.VisualStudio.Community.ProductArch.NeutralExtra\",\n            \"Microsoft.DiaSymReader.PortablePdb\",\n            \"Microsoft.IntelliTrace.CollectorCab\",\n            \"Microsoft.VisualStudio.Community.VB.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.VB.Resources.Neutral\",\n            \"Microsoft.VisualStudio.Community.CSharp.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.CSharp.Resources.Neutral\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.NeutralExtra\",\n            \"Microsoft.VisualStudio.Net.Eula.Resources\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.Neutral\",\n            \"Microsoft.VisualStudio.WebSiteProject.DTE\",\n            \"Microsoft.VisualStudio.Diagnostics.AspNetHelper\",\n            \"Microsoft.VisualStudio.Diagnostics.AspNetHelper.Standard\",\n            \"Microsoft.MSHtml\",\n            \"Microsoft.VisualStudio.Platform.CallHierarchy\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Neutral\",\n            \"Microsoft.VisualStudio.MinShell\",\n            \"Microsoft.VisualStudio.VsWebProtocolSelector.Msi\",\n            \"Microsoft.Net.8.0.WindowsDesktop.Runtime\",\n            \"Microsoft.Net.8.0.Runtime\",\n            \"Microsoft.VisualStudio.PackageGroup.Setup.Common\",\n            \"Microsoft.VisualStudio.Setup.WMIProvider\",\n            \"Microsoft.VisualStudio.Setup.Configuration.Interop\",\n            \"Microsoft.VisualStudio.Setup.Configuration\",\n            \"Microsoft.VisualStudio.Extensibility.Container\",\n            \"Microsoft.VisualStudio.LanguageServer\",\n            \"Microsoft.VisualStudio.Platform.Terminal\",\n            \"Microsoft.VisualStudio.MefHosting\",\n            \"Microsoft.VisualStudio.Initializer\",\n            \"Microsoft.VisualStudio.ExtensionManager\",\n            \"Microsoft.VisualStudio.Platform.Editor\",\n            \"Microsoft.VisualStudio.MinShell.Targeted\",\n            \"Microsoft.VisualStudio.NativeImageSupport\",\n            \"Microsoft.VisualStudio.Devenv.Config\",\n            \"Microsoft.VisualStudio.MinShell.Resources.arm64\",\n            \"Microsoft.VisualStudio.MinShell.Auto\",\n            \"Microsoft.VisualStudio.MinShell.Auto.Resources\",\n            \"Microsoft.VisualStudio.Branding.Community\"\n        ]\n    }\n]\n"
  },
  {
    "path": "test/fixtures/VS_2026_Insiders_workload.txt",
    "content": "[\n    {\n        \"path\": \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\18\\\\Insiders\",\n        \"version\": \"18.3.11206.111\",\n        \"packages\": [\n            \"Microsoft.VisualStudio.Product.Community\",\n            \"Microsoft.VisualStudio.PackageGroup.LiveShare.VSCore\",\n            \"Microsoft.VisualStudio.LiveShare.VSCore\",\n            \"Microsoft.VisualStudio.Workload.NativeDesktop\",\n            \"Microsoft.VisualStudio.Component.VC.ASAN\",\n            \"Microsoft.VisualCpp.ASAN.X86\",\n            \"Microsoft.VC.14.50.18.0.ASAN.X86.base\",\n            \"Microsoft.VC.14.50.18.0.ASAN.X64.base\",\n            \"Microsoft.VC.14.50.18.0.ASAN.Headers.base\",\n            \"Microsoft.VisualStudio.VC.IDE.Project.Factories\",\n            \"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest\",\n            \"Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest\",\n            \"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest\",\n            \"Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest\",\n            \"Microsoft.VisualStudio.Component.VC.CMake.Project\",\n            \"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake\",\n            \"Microsoft.VisualStudio.VC.CMake\",\n            \"Microsoft.VisualStudio.VC.CMake.Project\",\n            \"Microsoft.VisualStudio.VC.CMake.Client\",\n            \"Microsoft.VisualStudio.VC.ExternalBuildFramework\",\n            \"Microsoft.VisualStudio.Component.VC.DiagnosticTools\",\n            \"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.Native\",\n            \"Microsoft.VisualStudio.Component.VC.Redist.14.Latest\",\n            \"Microsoft.VisualStudio.VC.Templates.UnitTest\",\n            \"Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP\",\n            \"Microsoft.VisualStudio.VC.Templates.UnitTest.Resources\",\n            \"Microsoft.VisualStudio.VC.Templates.Desktop\",\n            \"Microsoft.VisualStudio.Component.Graphics\",\n            \"Microsoft.VisualStudio.Graphics.Viewers\",\n            \"Microsoft.VisualStudio.Graphics.Viewers.Resources\",\n            \"Microsoft.VisualStudio.Component.VC.ATL.ARM64\",\n            \"Microsoft.VisualCpp.ATL.ARM64\",\n            \"Microsoft.VC.14.50.18.0.ATL.ARM64.base\",\n            \"Microsoft.VisualStudio.Component.VC.ATL\",\n            \"Microsoft.VisualStudio.VC.Ide.ATL\",\n            \"Microsoft.VisualStudio.VC.Ide.ATL.Resources\",\n            \"Microsoft.VisualCpp.ATL.X86\",\n            \"Microsoft.VC.14.50.18.0.ATL.X86.base\",\n            \"Microsoft.VisualCpp.ATL.X64\",\n            \"Microsoft.VC.14.50.18.0.ATL.X64.base\",\n            \"Microsoft.VC.14.50.18.0.Props.ATLMFC\",\n            \"Microsoft.VisualCpp.ATL.Source\",\n            \"Microsoft.VC.14.50.18.0.ATL.Source.base\",\n            \"Microsoft.VisualCpp.ATL.Headers\",\n            \"Microsoft.VC.14.50.18.0.ATL.Headers.base\",\n            \"Microsoft.VC.14.50.18.0.Servicing.ATL\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.ARM64\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM64.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM64\",\n            \"Microsoft.VS.VC.vcvars.arm64.Shortcuts\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.Hostx86.Targetarm64\",\n            \"Microsoft.VC.14.50.18.0.Tools.Hostx86.Targetarm64.base\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.ARM64.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.ARM64\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.ARM64.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.OneCore.Desktop.base\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.OneCore.Desktop.debug.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.Store\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.Store.base\",\n            \"Microsoft.VisualCpp.CRT.ARM64.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.Desktop.base\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64.Desktop.debug.base\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM64\",\n            \"Microsoft.VisualCpp.Tools.Core\",\n            \"Microsoft.VisualCpp.PGO.ARM64\",\n            \"Microsoft.VC.14.50.18.0.PGO.ARM64.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.Hostx86.Targetarm64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX86.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX64.TargetARM64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.ARM64.Base\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.ARM64.Base.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetARM64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetARM64.base\",\n            \"Microsoft.VC.14.50.18.0.Props.ARM64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetARM64.Res.base\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.ARM64EC\",\n            \"Microsoft.VisualStudio.Component.Windows11SDK.26100\",\n            \"Win11SDK_10.0.26100\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM64EC.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM64EC\",\n            \"Microsoft.VisualCpp.CRT.ARM64EC.Store\",\n            \"Microsoft.VC.14.50.18.0.CRT.ARM64EC.Store.base\",\n            \"Microsoft.VisualStudio.Component.VC.Tools.x86.x64\",\n            \"Microsoft.VisualCpp.CodeAnalysis.Extensions\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.Targetx64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.Targetx64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.HostARM64.Targetx86\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.Targetx86.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.HostARM64.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.Targetx64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.Targetx64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx86.Targetx86\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.Targetx86.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx86.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.Targetx64\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.Targetx64.base\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.CA.Ext.Hostx64.Targetx86\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.Targetx86.base\",\n            \"Microsoft.VC.14.50.18.0.Servicing.CAExtensions\",\n            \"Microsoft.VC.14.50.18.0.CA.Ext.Hostx64.Targetx86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX64.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX64.TargetX64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetX86.base\",\n            \"Microsoft.VisualCpp.RuntimeDebug.14\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostARM64.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.TargetX64.base\",\n            \"Microsoft.VisualCpp.RuntimeDebug.14.ARM64\",\n            \"Microsoft.VisualCpp.Redist.14.Latest\",\n            \"Microsoft.VisualCpp.Redist.14.Latest\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX86.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX86.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX86.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostARM64.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostARM64.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostARM64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostARM64.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostARM64.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostARM64.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX64.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX64.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Premium.Tools.HostX64.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Prem.HostX64.TargetX64.Res.base\",\n            \"Microsoft.VisualCpp.PGO.X86\",\n            \"Microsoft.VC.14.50.18.0.PGO.X86.base\",\n            \"Microsoft.VisualCpp.PGO.X64\",\n            \"Microsoft.VC.14.50.18.0.PGO.X64.base\",\n            \"Microsoft.VisualCpp.PGO.Headers\",\n            \"Microsoft.VC.14.50.18.0.PGO.Headers.base\",\n            \"Microsoft.VisualCpp.CRT.x86.Store\",\n            \"Microsoft.VC.14.50.18.0.CRT.x86.Store.base\",\n            \"Microsoft.VisualCpp.CRT.x86.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.x86.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.x64.Store\",\n            \"Microsoft.VC.14.50.18.0.CRT.x64.Store.base\",\n            \"Microsoft.VisualCpp.CRT.x64.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.x64.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.x86.OneCore.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.x64.OneCore.Desktop.base\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.Tools.x86\",\n            \"Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Res\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX64\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX86.TargetX64.base\",\n            \"Microsoft.VC.14.50.18.0.Props.x64\",\n            \"Microsoft.VC.14.50.18.0.Tools.Hostx86.Targetx64.Res.base\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX86.Res\",\n            \"Microsoft.VisualCpp.Tools.HostX86.TargetX86\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX86.TargetX86.base\",\n            \"Microsoft.VC.14.50.18.0.Servicing.Compilers\",\n            \"Microsoft.VC.14.50.18.0.Props.x86\",\n            \"Microsoft.VC.14.50.18.0.Props\",\n            \"Microsoft.VC.14.50.18.0.Tools.HostX86.TargetX86.Res.base\",\n            \"Microsoft.VisualCpp.Tools.Core.Resources\",\n            \"Microsoft.VisualCpp.Tools.Core.x86\",\n            \"Microsoft.VC.14.50.18.0.Tools.Core.Props\",\n            \"Microsoft.VisualCpp.DIA.SDK\",\n            \"Microsoft.VisualCpp.Servicing.DIASDK\",\n            \"Microsoft.VisualCpp.CRT.x86.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.x86.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.x64.Desktop\",\n            \"Microsoft.VC.14.50.18.0.CRT.x64.Desktop.base\",\n            \"Microsoft.VisualCpp.CRT.Source\",\n            \"Microsoft.VC.14.50.18.0.CRT.Source.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.X86\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.X86.base\",\n            \"Microsoft.VisualCpp.CRT.Redist.X64\",\n            \"Microsoft.VisualCpp.CRT.Redist.Resources\",\n            \"Microsoft.VC.14.50.18.0.CRT.Redist.X64.base\",\n            \"Microsoft.VisualCpp.CRT.Headers\",\n            \"Microsoft.VC.14.50.18.0.CRT.Headers.base\",\n            \"Microsoft.VC.14.50.18.0.Servicing.CrtHeaders\",\n            \"Microsoft.VC.14.50.18.0.Servicing\",\n            \"Microsoft.VisualStudio.Component.VC.CoreIde\",\n            \"Microsoft.VisualStudio.VC.Ide.Pro\",\n            \"Microsoft.VisualStudio.VC.Ide.Pro.Resources\",\n            \"Microsoft.VisualStudio.VC.Templates.General\",\n            \"Microsoft.VisualStudio.VC.Templates.General.Resources\",\n            \"Microsoft.VisualStudio.VC.Items.Pro\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced\",\n            \"Microsoft.VisualStudio.VC.Ide.x64\",\n            \"Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express\",\n            \"Microsoft.VisualStudio.VC.vcvars\",\n            \"Microsoft.VS.VC.vcvars.x86.Shortcuts\",\n            \"Microsoft.VS.VC.vcvars.x64.Shortcuts\",\n            \"Microsoft.VS.VC.vcvars.arm64_x64.Shortcuts\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.X64.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.X64\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.ARM\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.x86.v145\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.X86\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.Base\",\n            \"Microsoft.VisualStudio.VC.MSBuild.v180.Base.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.WinXPlus\",\n            \"Microsoft.VisualStudio.VC.Ide.Dskx\",\n            \"Microsoft.VisualStudio.VC.Ide.Dskx.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Base\",\n            \"Microsoft.VisualStudio.VC.Ide.LanguageService\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.Scripts\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.PythonDistro\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.10\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.9\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.8\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.7\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.6\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.5\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.4\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.3\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.2\",\n            \"Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.1\",\n            \"Microsoft.VisualStudio.VC.Ide.VCPkgDatabase\",\n            \"Microsoft.VisualStudio.VC.Ide.Core\",\n            \"Microsoft.VisualStudio.VC.Ide.ProjectSystem\",\n            \"Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine\",\n            \"Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.LanguageService.Resources\",\n            \"Microsoft.VisualStudio.VC.Llvm.Base\",\n            \"Microsoft.VisualStudio.VC.Ide.Base.Resources\",\n            \"Microsoft.Net.PackageGroup.4.8.1.Redist\",\n            \"Microsoft.VisualStudio.Component.IntelliCode\",\n            \"Microsoft.VisualStudio.IntelliCode.CSharp\",\n            \"Microsoft.VisualStudio.IntelliCode\",\n            \"Component.Microsoft.VisualStudio.LiveShare.2026\",\n            \"Microsoft.VisualStudio.Component.Debugger.JustInTime\",\n            \"Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi\",\n            \"Microsoft.VisualStudio.Debugger.JustInTime\",\n            \"Microsoft.VisualStudio.Debugger.JustInTime.Msi\",\n            \"Microsoft.VisualStudio.LiveShare.2026\",\n            \"Microsoft.Icecap.Analysis\",\n            \"Microsoft.Icecap.Analysis.Resources\",\n            \"Microsoft.Icecap.Analysis.Resources.Targeted\",\n            \"Microsoft.Icecap.Collection.Msi\",\n            \"Microsoft.Icecap.Collection.Msi.Targeted\",\n            \"Microsoft.Icecap.Collection.Msi.Resources\",\n            \"Microsoft.Icecap.Collection.Msi.Resources.Targeted\",\n            \"Microsoft.DiagnosticsHub.Instrumentation\",\n            \"Microsoft.DiagnosticsHub.Instrumentation.Targeted\",\n            \"Microsoft.DiagnosticsHub.CpuSampling\",\n            \"Microsoft.DiagnosticsHub.CpuSampling.Targeted\",\n            \"Microsoft.PackageGroup.DiagnosticsHub.Platform\",\n            \"Microsoft.VisualStudio.InstrumentationEngine.ARM64\",\n            \"Microsoft.VisualStudio.InstrumentationEngine\",\n            \"Microsoft.DiagnosticsHub.Runtime.ExternalDependencies\",\n            \"SQLiteCore\",\n            \"SQLiteCore.Targeted\",\n            \"Microsoft.DiagnosticsHub.Runtime.ExternalDependencies.Targeted\",\n            \"Microsoft.DiagnosticsHub.Runtime\",\n            \"Microsoft.DiagnosticsHub.Runtime.Targeted\",\n            \"Microsoft.DiagnosticsHub.Collection.ExternalDependencies.arm64\",\n            \"Microsoft.DiagnosticsHub.Collection\",\n            \"Microsoft.DiagnosticsHub.Collection.Service\",\n            \"Microsoft.VisualStudio.VC.Ide.MDD\",\n            \"Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager\",\n            \"Microsoft.VisualStudio.VisualC.Utilities\",\n            \"Microsoft.VisualStudio.VisualC.Utilities.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.ResourceEditor\",\n            \"Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.Core\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI\",\n            \"Microsoft.VisualStudio.TestTools.Pex.Common\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy\",\n            \"Microsoft.VisualStudio.PackageGroup.MinShell.Interop\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestSettings\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common\",\n            \"Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE\",\n            \"Microsoft.VisualStudio.Cache.Service\",\n            \"Microsoft.VisualStudio.TestTools.TestWIExtension\",\n            \"Microsoft.VisualStudio.TestTools.TestWIExtension.Res\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI\",\n            \"Microsoft.VisualStudio.TestTools.TP.V1.CLI.Resources\",\n            \"Microsoft.VisualStudio.TestTools.TestPlatform.IDE\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage\",\n            \"Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors\",\n            \"Microsoft.VisualStudio.Component.NuGet\",\n            \"Microsoft.CredentialProvider\",\n            \"Microsoft.VisualStudio.NuGet.Licenses\",\n            \"Microsoft.VisualStudio.Component.TextTemplating\",\n            \"Microsoft.VisualStudio.TextTemplating.MSBuild\",\n            \"Microsoft.VisualStudio.TextTemplating.Integration\",\n            \"Microsoft.VisualStudio.TextTemplating.Core\",\n            \"Microsoft.VisualStudio.TextTemplating.Integration.Resources\",\n            \"Microsoft.VisualCpp.CRT.ClickOnce.Msi\",\n            \"Microsoft.VisualStudio.Component.Roslyn.LanguageServices\",\n            \"Microsoft.VisualStudio.InteractiveWindow\",\n            \"Microsoft.DiaSymReader.Native\",\n            \"Microsoft.VisualCpp.Redist.14\",\n            \"Microsoft.VisualCpp.Redist.14\",\n            \"Microsoft.VisualCpp.Servicing.Redist\",\n            \"Microsoft.VisualStudio.PackageGroup.StaticAnalysis\",\n            \"Microsoft.VisualStudio.StaticAnalysis.IDE\",\n            \"Microsoft.VisualStudio.StaticAnalysis.IDE.Resources\",\n            \"Microsoft.VisualStudio.StaticAnalysis.FxCop.Resources\",\n            \"Microsoft.VisualStudio.StaticAnalysis.auxil\",\n            \"Microsoft.VisualStudio.StaticAnalysis.auxil.Resources\",\n            \"Roslyn.VisualStudio.Setup.ServiceHub\",\n            \"Microsoft.Component.MSBuild\",\n            \"Microsoft.NuGet.Build.Tasks.Setup\",\n            \"Microsoft.VisualStudio.Component.Roslyn.Compiler\",\n            \"Microsoft.CodeAnalysis.Compilers\",\n            \"Microsoft.VisualStudio.Component.JavaScript.TypeScript\",\n            \"Microsoft.VisualStudio.JavaScript.ProjectSystem\",\n            \"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions\",\n            \"Microsoft.VisualStudio.ProTools\",\n            \"sqlsysclrtypes\",\n            \"SQLCommon\",\n            \"Microsoft.VisualStudio.ProTools.Resources\",\n            \"Microsoft.VisualStudio.Web.Scaffolding\",\n            \"Microsoft.VisualStudio.WebToolsExtensions\",\n            \"Microsoft.VisualStudio.ConnectedServices.Core\",\n            \"Microsoft.VisualStudio.WebTools\",\n            \"Microsoft.VisualStudio.WebToolsExtensions.MSBuild\",\n            \"Microsoft.VisualStudio.WebTools.Resources\",\n            \"Microsoft.VisualStudio.WebTools.WSP.FSA\",\n            \"Microsoft.VisualStudio.WebTools.WSP.FSA.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.Script\",\n            \"Microsoft.VisualStudio.Component.TypeScript.TSServer\",\n            \"Microsoft.VisualStudio.Package.TypeScript.TSServer\",\n            \"Microsoft.VisualStudio.PackageGroup.JavaScript.Language\",\n            \"Microsoft.VisualStudio.Package.NodeJs\",\n            \"TypeScript.Build\",\n            \"TypeScript.LanguageService\",\n            \"TypeScript.Tools\",\n            \"Microsoft.VisualStudio.PackageGroup.Community\",\n            \"Microsoft.VisualStudio.Community.VB.x86\",\n            \"Microsoft.VisualStudio.Community.VB.x64\",\n            \"Microsoft.VisualStudio.PackageGroup.Core\",\n            \"Microsoft.VisualStudio.CodeSense.Community\",\n            \"Microsoft.VisualStudio.TestTools.TeamFoundationClient\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.Core\",\n            \"Microsoft.VisualStudio.Debugger.BrokeredServices\",\n            \"Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost\",\n            \"Microsoft.VisualStudio.Debugger.AzureAttach\",\n            \"Microsoft.VisualStudio.Web.Azure.Common\",\n            \"Microsoft.WebTools.Shared\",\n            \"Microsoft.WebTools.DotNet.Core.ItemTemplates\",\n            \"Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Replay\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Concord\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Debugger.Resources\",\n            \"Microsoft.VisualStudio.VC.Ide.Common\",\n            \"Microsoft.VisualStudio.VC.Ide.Common.Resources\",\n            \"Microsoft.VisualStudio.Debugger.CollectionAgents\",\n            \"Microsoft.VisualStudio.Debugger.Parallel\",\n            \"Microsoft.VisualStudio.Debugger.Parallel.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Managed\",\n            \"Microsoft.CodeAnalysis.ExpressionEvaluator\",\n            \"Microsoft.CodeAnalysis.VisualStudio.Setup\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Managed\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Managed.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Managed.Resources\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote.arm64\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote\",\n            \"Microsoft.VisualStudio.Debugger.TargetComposition.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Remote.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources.ARM\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources.ARM64\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Remote.Resources\",\n            \"Microsoft.VisualStudio.Debugger\",\n            \"Microsoft.VisualStudio.VC.MSVCDis\",\n            \"Microsoft.IntelliTrace.DiagnosticsHub\",\n            \"Microsoft.VisualStudio.Debugger.Concord\",\n            \"Microsoft.VisualStudio.Debugger.Concord.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Resources\",\n            \"Microsoft.VisualStudio.Debugger.Package.DiagHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client\",\n            \"Microsoft.PackageGroup.ClientDiagnostics\",\n            \"Microsoft.VisualStudio.AppResponsiveness\",\n            \"Microsoft.VisualStudio.AppResponsiveness.Targeted\",\n            \"Microsoft.VisualStudio.AppResponsiveness.Resources\",\n            \"Microsoft.VisualStudio.ClientDiagnostics\",\n            \"Microsoft.VisualStudio.ClientDiagnostics.Targeted\",\n            \"Microsoft.VisualStudio.ClientDiagnostics.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.CommunityCore\",\n            \"Microsoft.VisualStudio.ProjectSystem.Full\",\n            \"Microsoft.VisualStudio.LiveShareApi\",\n            \"Microsoft.VisualStudio.ProjectSystem.Query\",\n            \"Microsoft.VisualStudio.ProjectSystem\",\n            \"Microsoft.VisualStudio.Community.x86\",\n            \"Microsoft.VisualStudio.Community.x64\",\n            \"Microsoft.VisualStudio.Community.Msi.Resources\",\n            \"Microsoft.VisualStudio.Community.Msi\",\n            \"Microsoft.VisualStudio.Community.Shared.Msi\",\n            \"Microsoft.VisualStudio.Devenv.Msi\",\n            \"Microsoft.VisualStudio.Devenv.Shared.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Interop.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Interop.Shared.Msi\",\n            \"Microsoft.VisualStudio.Editors\",\n            \"Microsoft.VisualStudio.Workload.CoreEditor\",\n            \"Microsoft.VisualStudio.Component.CoreEditor\",\n            \"Microsoft.VisualStudio.PackageGroup.CoreEditor\",\n            \"Microsoft.WebView2\",\n            \"Microsoft.VisualStudio.ScriptedHost\",\n            \"Microsoft.VisualStudio.ScriptedHost.Targeted\",\n            \"Microsoft.VisualCpp.Tools.Common.UtilsPrereq\",\n            \"Microsoft.VisualCpp.Tools.Common.Utils\",\n            \"Microsoft.VisualCpp.Tools.Common.Utils.Resources\",\n            \"Microsoft.VisualStudio.PackageGroup.VsDevCmd\",\n            \"Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk\",\n            \"Microsoft.VisualStudio.VsDevCmd.Core.WinSdk\",\n            \"Microsoft.VisualStudio.VsDevCmd.Core.DotNet\",\n            \"Microsoft.VisualStudio.VC.DevCmd\",\n            \"Microsoft.VisualStudio.VC.DevCmd.Resources\",\n            \"Microsoft.VisualStudio.VirtualTree\",\n            \"Microsoft.DiaSymReader\",\n            \"Microsoft.Build.Dependencies\",\n            \"Microsoft.Build.FileTracker.Msi\",\n            \"Microsoft.Build\",\n            \"Microsoft.VisualStudio.PackageGroup.NuGet\",\n            \"Microsoft.DataAI.NuGetRecommender\",\n            \"Microsoft.VisualStudio.NuGet.Core\",\n            \"Microsoft.Build.Arm64\",\n            \"Microsoft.Build.UnGAC\",\n            \"Microsoft.VisualStudio.TextMateGrammars\",\n            \"Microsoft.VisualStudio.Platform.Markdown\",\n            \"Microsoft.VisualStudio.Platform.CrossRepositorySearch\",\n            \"Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common\",\n            \"Microsoft.VisualStudio.TeamExplorer\",\n            \"Microsoft.VisualStudio.PackageGroup.ServiceHub\",\n            \"Microsoft.ServiceHub.Node\",\n            \"Microsoft.ServiceHub.Managed\",\n            \"Microsoft.ServiceHub.arm64\",\n            \"Microsoft.VisualStudio.ProjectServices\",\n            \"Microsoft.VisualStudio.OpenFolder.VSIX\",\n            \"Microsoft.VisualStudio.FileHandler.Msi\",\n            \"Microsoft.VisualStudio.FileHandler.Msi\",\n            \"Microsoft.VisualStudio.PackageGroup.MinShell\",\n            \"Microsoft.VisualStudio.MinShell.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Shared.Msi\",\n            \"Microsoft.VisualStudio.MinShell.Msi.Resources\",\n            \"Microsoft.VisualStudio.MinShell.Interop\",\n            \"CoreEditorFonts\",\n            \"Microsoft.VisualStudio.Log\",\n            \"Microsoft.VisualStudio.Log.Targeted\",\n            \"Microsoft.VisualStudio.Log.Resources\",\n            \"Microsoft.VisualStudio.Finalizer\",\n            \"Microsoft.VisualStudio.Devenv\",\n            \"Microsoft.VisualStudio.Devenv.Resources\",\n            \"Microsoft.VisualStudio.CoreEditor\",\n            \"Microsoft.VisualStudio.Navigation.RichCodeNav\",\n            \"Microsoft.VisualStudio.Platform.NavigateTo\",\n            \"Microsoft.VisualStudio.Connected\",\n            \"SQLitePCLRaw\",\n            \"SQLitePCLRaw.Targeted\",\n            \"Microsoft.VisualStudio.Connected.Auto\",\n            \"Microsoft.VisualStudio.Connected.Auto.Resources\",\n            \"Microsoft.VisualStudio.AzureSDK\",\n            \"Microsoft.VisualStudio.PerfLib\",\n            \"Microsoft.VisualStudio.Connected.Resources\",\n            \"Microsoft.Net.PackageGroup.4.8.Redist\",\n            \"Microsoft.VisualStudio.PackageGroup.Progression\",\n            \"Microsoft.VisualStudio.PerformanceProvider\",\n            \"Microsoft.VisualStudio.GraphModel\",\n            \"Microsoft.VisualStudio.GraphProvider\",\n            \"Microsoft.VisualStudio.Community.VB.Targeted\",\n            \"Microsoft.VisualStudio.Community.VB.Neutral\",\n            \"Microsoft.VisualStudio.Community.CSharp.Targeted\",\n            \"Microsoft.VisualStudio.Community.CSharp.Neutral\",\n            \"Microsoft.VisualStudio.Community.ProductArch.TargetedExtra\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Targeted\",\n            \"Microsoft.VisualStudio.Community.ProductArch.NeutralExtra\",\n            \"Microsoft.DiaSymReader.PortablePdb\",\n            \"Microsoft.IntelliTrace.CollectorCab\",\n            \"Microsoft.VisualStudio.Community.VB.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.VB.Resources.Neutral\",\n            \"Microsoft.VisualStudio.Community.CSharp.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.CSharp.Resources.Neutral\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.Targeted\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.NeutralExtra\",\n            \"Microsoft.VisualStudio.Net.Eula.Resources\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Resources.Neutral\",\n            \"Microsoft.VisualStudio.WebSiteProject.DTE\",\n            \"Microsoft.VisualStudio.Diagnostics.AspNetHelper\",\n            \"Microsoft.VisualStudio.Diagnostics.AspNetHelper.Standard\",\n            \"Microsoft.MSHtml\",\n            \"Microsoft.VisualStudio.Platform.CallHierarchy\",\n            \"Microsoft.VisualStudio.Community.ProductArch.Neutral\",\n            \"Microsoft.VisualStudio.MinShell\",\n            \"Microsoft.VisualStudio.VsWebProtocolSelector.Msi\",\n            \"Microsoft.Net.8.0.WindowsDesktop.Runtime\",\n            \"Microsoft.Net.8.0.Runtime\",\n            \"Microsoft.VisualStudio.PackageGroup.Setup.Common\",\n            \"Microsoft.VisualStudio.Setup.WMIProvider\",\n            \"Microsoft.VisualStudio.Setup.Configuration.Interop\",\n            \"Microsoft.VisualStudio.Setup.Configuration\",\n            \"Microsoft.VisualStudio.Extensibility.Container\",\n            \"Microsoft.VisualStudio.LanguageServer\",\n            \"Microsoft.VisualStudio.Platform.Terminal\",\n            \"Microsoft.VisualStudio.MefHosting\",\n            \"Microsoft.VisualStudio.Initializer\",\n            \"Microsoft.VisualStudio.ExtensionManager\",\n            \"Microsoft.VisualStudio.Platform.Editor\",\n            \"Microsoft.VisualStudio.MinShell.Targeted\",\n            \"Microsoft.VisualStudio.NativeImageSupport\",\n            \"Microsoft.VisualStudio.Devenv.Config\",\n            \"Microsoft.VisualStudio.MinShell.Resources.arm64\",\n            \"Microsoft.VisualStudio.MinShell.Auto\",\n            \"Microsoft.VisualStudio.MinShell.Auto.Resources\",\n            \"Microsoft.VisualStudio.Branding.Community\"\n        ]\n    }\n]\n"
  },
  {
    "path": "test/fixtures/certs.js",
    "content": "module.exports['ca.key'] = `\n-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAtTbG0k2UFUyCdZuip0TTEtXRHh57qosegrpHPBreSNTxt7OT\nKfOUZp2rToTHeN9w0ZbV2eKRI5AuFx8Cmlm73/KIHKzSNTBATGMeeHnGaxvL/W/s\nKJdTDRNf7/qCXHQ+gsuEWWCFzOZuHmmAQa2IBX2HAQTqXJI8+2iJ9gytFfJLxjqy\n6O4u9ugZVHSyQJWs49tGRcWMlNm7EMStADFvJn3S11xe/kwIA2mSI/eddDnzL0Mx\nAkR9dQBL66xOABLL5v3QQdhipfHluX6HLbDd/1YsFTuOpgvLRlr72rTAFrQZCokV\nhXPiqstn5zJFW5arHakvMR0+OPaICF5feh/4qQIDAQABAoIBAHWg6exnWUF+GY0Y\nCrwDS/QFASpI5UNt7M809bqJQlMKjyEMmvF3YJQ/soxUWlsWx1f1TjmR/V6VX6W4\nhmsE5pRXDY13jTfja0lqacQQYAD02TRY63XpzIpHUlYnSWmUN2OVkgKmShQYW9C3\n8P4xE4Nk2TaLJ0oRzy3uzOb/kXcVaJfknBRUnOhuaTSs+w4l4pPXueYA7xuHgVsL\nQq0S4kK+PmdwCMB7gzlAAQhCM3vQ1U4cjC9JIIKSmPy7BcvD0kBfVPIFQ2byGpA1\nVkWBLSyeig0YxA5oIshK5cLiDIfBIiCSEzm4AMhVhGf0tbGEwiPljxKjbarYUUIi\nATMk83UCgYEA7kKeOveuPbMqxmT42swfa9OU5jLUjH+VExU0Kv3BbEjv/OGt0fac\n/cs1Ze3vnrtCHudVajocFjydb8B4c62DbA4/T+LcUw/HaMaORbOoICQidi/zZ1Lj\ngjg8Ip2WKXEhSAwqUpaFd6w16NZOxiTh+NDaRKywwbe8j57eDH4uR6MCgYEAwrTS\nq5ra6+WDGUFMs0y3GMbL8j14PGhxBQBYSTM//NysI+EM6eeKn1cV3BbphEw//jgE\n0pVokkjvLAQWWEG2dZyRxRE3YAMgOAIPx5zbJCim3iBVuoqY9ckLg2jF8Fqqubsb\n3Rf2/Xzn/rFqsXdhsjGcJpdN66T9aEjwEkAnc0MCgYA5cOYk4UGormFJo147oaqR\nnFjxhp+nn7qY9yu0kajoKk1xchct337J0Qv2nv5+DjdKrArzqT7MPaDXKFfhy5s7\nmdO5tr/XZp50rCnws/d8iDmmtLjB2EHxSw10avmg1B1p+UTa1F8pEuOMVt529r1j\n9zYoCFo02c8j8PEnoeQWcQKBgQCVBCuQZu5SSM/zTkTTnU0sy0lf1qflI9IMD92B\n+JVqg8HDnAR0KF+x38a9MVP7ixgXCuy19t+XxfY269HmLjTlArWV671D4GCSPRGy\nplwZ6nr72ieCo3y57+q94jxL3jh3+bozlpnUG/q6tTKBLGs7JDjsWDSsuxOu8tO6\nRBttXQKBgB6LQFOTjDMfsFHKsnQXFUZId3GG/iLg3WCWxEo88T5Rq3JIR0zDpW8H\ncKhl/sPY+JVHsxizNCMPtp7Hn7GrB6D/v9LbO0jpG2U0BFiJ6zhiDopbP9B0EAW4\n5JJ+JGKRKoCxs3DmSVyns0gU4j4rVte97UWyVy5TZ8Acr/qrgOA1\n-----END RSA PRIVATE KEY-----\n`\n\nmodule.exports['ca.crt'] = `\n-----BEGIN CERTIFICATE-----\nMIIDmzCCAoOgAwIBAgIUDA0GrvcnG41XT6LYFeNwvq8YV1UwDQYJKoZIhvcNAQEL\nBQAwXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRAwDgYDVQQKDAdOb2RlLmpz\nMREwDwYDVQQLDAhub2RlLWd5cDEcMBoGA1UEAwwTbm9kZS1neXAubm9kZWpzLm9y\nZzAeFw0yMjA1MTEwNDIyMjRaFw00OTA5MjUwNDIyMjRaMF0xCzAJBgNVBAYTAlVT\nMQswCQYDVQQIDAJDQTEQMA4GA1UECgwHTm9kZS5qczERMA8GA1UECwwIbm9kZS1n\neXAxHDAaBgNVBAMME25vZGUtZ3lwLm5vZGVqcy5vcmcwggEiMA0GCSqGSIb3DQEB\nAQUAA4IBDwAwggEKAoIBAQC1NsbSTZQVTIJ1m6KnRNMS1dEeHnuqix6Cukc8Gt5I\n1PG3s5Mp85RmnatOhMd433DRltXZ4pEjkC4XHwKaWbvf8ogcrNI1MEBMYx54ecZr\nG8v9b+wol1MNE1/v+oJcdD6Cy4RZYIXM5m4eaYBBrYgFfYcBBOpckjz7aIn2DK0V\n8kvGOrLo7i726BlUdLJAlazj20ZFxYyU2bsQxK0AMW8mfdLXXF7+TAgDaZIj9510\nOfMvQzECRH11AEvrrE4AEsvm/dBB2GKl8eW5foctsN3/ViwVO46mC8tGWvvatMAW\ntBkKiRWFc+Kqy2fnMkVblqsdqS8xHT449ogIXl96H/ipAgMBAAGjUzBRMB0GA1Ud\nDgQWBBT6LcYYABEOAMv4hI/5bC82rGlD/DAfBgNVHSMEGDAWgBT6LcYYABEOAMv4\nhI/5bC82rGlD/DAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQA9\nD+qoKw0njub+NaFRS2DFbSiKb5JKTxVjU5aNusFONFLSXBuRpnYyjjkXpJy8JMWz\ng8GFDEPP6kiSb8xaPNrFcUzb4PFzJabNTuaLJpBpd2gNBj5AeYwwpRa2DPv/b4yw\ny2mfULuCWS09ZAguI2OcaARlAsFxYN0IuQ6pN1AvGFGee67ve9l2VF/hhwEi4lCk\nMM0CWlP6COJ8TX7X0MTtexVOgo9m3hBuTSYEZClYFIdSOk10xkPl8Y3Iz/x6mzfK\nUu2l2ZtYvSdAX1CQMds3ZWt0ChNNEjOKPv4g2QSDhGkiqrmi4wUS81g68wKqOpqn\nGbN8uKxIfyMjqZKaujPR\n-----END CERTIFICATE-----\n`\n\nmodule.exports['server.key'] = `\n-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDpxqKqzq8PuOuo\nM09X1gdh6V1nMmJ6Oqk/d8ZSAHhGBTjB5BBILtrxJPAdsNCRc8gPCtSuAzu9r0ct\nD2znJjto8HO3a0s/4mlqMQ8iSvfH0c8nGLPxRXg0C9tR0VOyqJrqAPn9X6utxVQj\nH2jLjZngZllhqlxIUxYuXO7MZfC2MQ4DRsp6GaJTftcOxTxevMdT6lK0yl3mDn0W\nDyV9aWR5oCVXKIRK7jmF9bi9ETHwJHffFrduaaKYLQ/UOEtNek/pJsz0DNO0ePkm\nDAt0GQkX3hmKd0VRgGEtaO+MAGbrDucPuDylMkC1GJm1lq6+6rkyQRNoAd8/yOJD\nGihBJmLPAgMBAAECggEBAL3+WM/3IGHnyWavJMnfQaq6rdWkJlLugAT8BCs7BITr\n04AJKY5wvjID8j4/KJM+BRbsl4NBT3lPDcq6YajO8rPL0E/+nG60RTYv3vvg79Xv\nV6uPsRbifdnW1Q1+0cY+r4CFAKeC7JVS7ZmJ+nKMh8XPiM8OVOfW1w0hLFbkdqiq\nUetA5H0oiJr0rFWh9Gfzc0avpmawXmZJqK8lKWB1rt2teu3bQWqn20dGr2IyCipz\nKlGh3QImYogjqWEqPyowPGxnq8KWQ40Pjx61dy6cqYrw77yxLHGR8Az+TlRQZf/K\nBeT3UkXCU5BTyC3PKZJpcYB/GMB8GBKRdNK+8H3OXskCgYEA963tUnLoiCwJjxvv\ngIiMY5mIUAMnTDsCxSYekfkDvt4qdttn/+Y8/5/lXMSlCt+WZcXH0V8gmVOMqfHB\nQRXWpi0uJnl9sUllb80Mw5PnS317UlJIbkro3crVUhIbrn9tKVFP1GO9xszNda8E\nMkHV8FGmSaihXGnA8KEkTKg1CisCgYEA8aEjATIpDXyxQM4M9B1S0jI/nHOrg2lr\ndMKQWJVruuvwrrZl6CFNIm2/PBXyHjCXqROXs7aXkE3vfRSypYNKBZl7BX08c0nE\nkoMVXwhGbSbUXjFx5bcUKaG/2eOK+ZV4ivNQokq1iIK+WKINAfP69ewzD7EAgbBg\nKY7owSxka+0CgYB4Urh+W3B35tzl9y5NBQkewdGk/UM0F17rI++p/o1BRnDeuQw3\nF0T+8lDc1nNPavuHiaPfJRWTJzGoxdeapN9Yb46CBnd3jy6GN9lBkjLFS7qDbZHe\ncunaBdXIPx/Pj/waHHRpu+LQF2KhD1s8hxtF2oSsOA3b9UxUGhSmYPkTbQKBgEP8\nmuTTQEnTM+yQDYUCWzNZgBx9T10CZIHN3N+P62gEywvdtn7CH/n39z7ozd9AvOuN\n37lpPuwTgbcoA7weXM2Gid7ZhhDKSM0QpQrAQVClBEwcjXedM8cjA+BC7e+b5vbx\nz1ZavwlSAEzgC9jo1Uws0ZEwtHvJLMWEuGjiHL9hAoGAWEbj2cxhpCKTK3C8Qf+C\nBscBwAZKmUasdWQBUzRFpR1UAO3fFBatjMPwrFYnt+ZgiCXTGFcoEa7mjoP/r5Mh\nj1nRCoPQVcbmB1B9AtiaEa1AA+BqYF1r2aErbcsGrCV5OHU7TYFk1dep1SAQP/0W\n9MQ+1Af5ttYSFYlJLnWJo4M=\n-----END PRIVATE KEY-----\n`\n\nmodule.exports['server.crt'] = `\n-----BEGIN CERTIFICATE-----\nMIIDPjCCAiagAwIBAgIJALrth9K8D7HIMA0GCSqGSIb3DQEBCwUAMF0xCzAJBgNV\nBAYTAlVTMQswCQYDVQQIDAJDQTEQMA4GA1UECgwHTm9kZS5qczERMA8GA1UECwwI\nbm9kZS1neXAxHDAaBgNVBAMME25vZGUtZ3lwLm5vZGVqcy5vcmcwHhcNMjMwOTI4\nMDUxODM2WhcNMzMwOTI1MDUxODM2WjBgMQswCQYDVQQGEwJVUzETMBEGA1UECAwK\nQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEQMA4GA1UECgwHTm9k\nZS5qczESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A\nMIIBCgKCAQEA6caiqs6vD7jrqDNPV9YHYeldZzJiejqpP3fGUgB4RgU4weQQSC7a\n8STwHbDQkXPIDwrUrgM7va9HLQ9s5yY7aPBzt2tLP+JpajEPIkr3x9HPJxiz8UV4\nNAvbUdFTsqia6gD5/V+rrcVUIx9oy42Z4GZZYapcSFMWLlzuzGXwtjEOA0bKehmi\nU37XDsU8XrzHU+pStMpd5g59Fg8lfWlkeaAlVyiESu45hfW4vREx8CR33xa3bmmi\nmC0P1DhLTXpP6SbM9AzTtHj5JgwLdBkJF94ZindFUYBhLWjvjABm6w7nD7g8pTJA\ntRiZtZauvuq5MkETaAHfP8jiQxooQSZizwIDAQABMA0GCSqGSIb3DQEBCwUAA4IB\nAQBwgEyrqJOV8SC7PVTtEOqfSyrM7lJjVcmwXEIFPVCPxXnDtLS9+OaQe9ybjOR/\nBi/AvZK4gwsV9G5Bvbl0/sphYEKYLEpP76jhdETcBwhaEgK3itumoREeriut4bZI\nOM6b1O45CoD67Lm87CUwLOdcNzPu4k7mat+xog5aFwaQuRjLBmmZcjl41QjVr9ti\nLa4PCMh7NwVMtHRqbYvgq785PsKAh+j4FSX1sj9NRzRPoJJ2qsre1Qn5tL/i6ovj\n6s+3GxOQ5I1UzJX22PZFu003a582ha1CEFM0VaeDzzwbGNcV5SP+g2nw55zx9YRR\nRg8nGmjRuRtbs+/XAre2eQ5p\n-----END CERTIFICATE-----\n`\n\nmodule.exports['ca-bundle.crt'] = `\n-----BEGIN CERTIFICATE-----\nMIIDJjCCAg4CAhnOMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD\nVQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UECgwQU3Ryb25n\nTG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRowGAYDVQQDDBFjYS5zdHJv\nbmdsb29wLmNvbTAeFw0xNTEyMDgyMzM1MzNaFw00MzA0MjQyMzM1MzNaMBkxFzAV\nBgNVBAMMDnN0cm9uZ2xvb3AuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwOYI7OZ2FX/YjRgLZoDQlbPc5UZXU/j0e1wwiJNPtPEax9Y5Uoza0Pnt\nIkzkc2SfvQ+IJrhXo385tI0W5juuqbHnE7UrjUuPjUX6NHevkxcs/flmjan5wnZM\ncPsGhH71WDuUEEflvZihf2Se2x+xgZtMhc5XGmVmRuZFYKvkgUhA2/w8/QrK+jPT\nn9QRJxZjWNh2RBdC1B7u4jffSmOSUljYFH1I2eTeY+Rdi6YUIYSU9gEoZxsv3Tia\nSomfMF5jt2Mouo6MzA+IhLvvFjcrcph1Qxgi9RkfdCMMd+Ipm9YWELkyG1bDRpQy\n0iyHD4gvVsAqz1Y2KdRSdc3Kt+nTqwIDAQABoxkwFzAVBgNVHREEDjAMhwQAAAAA\nhwR/AAABMA0GCSqGSIb3DQEBBQUAA4IBAQAhy4J0hML3NgmDRHdL5/iTucBe22Mf\njJjg2aifD1S187dHm+Il4qZNO2plWwAhN0h704f+8wpsaALxUvBIu6nvlvcMP5PH\njGN5JLe2Km3UaPvYOQU2SgacLilu+uBcIo2JSHLV6O7ziqUj5Gior6YxDLCtEZie\nEa8aX5/YjuACtEMJ1JjRqjgkM66XAoUe0E8onOK3FgTIO3tGoTJwRp0zS50pFuP0\nPsZtT04ck6mmXEXXknNoAyBCvPypfms9OHqcUIW9fiQnrGbS/Ri4QSQYj0DtFk/1\nna4fY1gf3zTHxH8259b/TOOaPfTnCEsOQtjUrWNR4xhmVZ+HJy4yytUW\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIDbzCCAlcCAmm6MA0GCSqGSIb3DQEBCwUAMH0xCzAJBgNVBAYTAlVTMQswCQYD\nVQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UECgwQU3Ryb25n\nTG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRowGAYDVQQDDBFjYS5zdHJv\nbmdsb29wLmNvbTAeFw0xNTEyMDgyMzM1MzNaFw00MzA0MjQyMzM1MzNaMH0xCzAJ\nBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZ\nMBcGA1UECgwQU3Ryb25nTG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRow\nGAYDVQQDDBFjYS5zdHJvbmdsb29wLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP\nADCCAQoCggEBANfj86jkvvYDjHBgiqWhk9Cj+bqiMq3MqnV0CBO4iuK33Fo6XssE\nH+yVdXlIBFbFe6t655MdBVOR2Sfj7WqNh96vhu6PyDHiwcQlTaiLU6nhIed1J4Wv\nlvnJHFmp8Wbtx5AgLT4UYu03ftvXEl2DLi3vhSL2tRM1ebXHB/KPbRWkb25DPX0P\nfoOHot3f2dgNe2x6kponf7E/QDmAu3s7Nlkfh+ryDhgGU7wocXEhXbprNqRqOGNo\nxbXgUI+/9XDxYT/7Gn5LF/fPjtN+aB0SKMnTsDhprVlZie83mlqJ46fOOrR+vrsQ\nmi/1m/TadrARtZoIExC/cQRdVM05EK4tUa8CAwEAATANBgkqhkiG9w0BAQsFAAOC\nAQEAQ7k5WhyhDTIGYCNzRnrMHWSzGqa1y4tJMW06wafJNRqTm1cthq1ibc6Hfq5a\nK10K0qMcgauRTfQ1MWrVCTW/KnJ1vkhiTOH+RvxapGn84gSaRmV6KZen0+gMsgae\nKEGe/3Hn+PmDVV+PTamHgPACfpTww38WHIe/7Ce9gHfG7MZ8cKHNZhDy0IAYPln+\nYRwMLd7JNQffHAbWb2CE1mcea4H/12U8JZW5tHCF6y9V+7IuDzqwIrLKcW3lG17n\nVUG6ODF/Ryqn3V5X+TL91YyXi6c34y34IpC7MQDV/67U7+5Bp5CfeDPWW2wVSrW+\nuGZtfEvhbNm6m2i4UNmpCXxUZQ==\n-----END CERTIFICATE-----\n`\n"
  },
  {
    "path": "test/fixtures/nodedir/include/node/config.gypi",
    "content": "# Test configuration\n{\n  'variables': {\n    'build_with_electron': true\n  }\n}\n"
  },
  {
    "path": "test/fixtures/test-charmap.py",
    "content": "import sys\nimport locale\n\ntry:\n    reload(sys)\nexcept NameError:  # Python 3\n    pass\n\n\ndef main():\n    encoding = locale.getdefaultlocale()[1]\n    if not encoding:\n        return False\n\n    try:\n        sys.setdefaultencoding(encoding)\n    except AttributeError:  # Python 3\n        pass\n\n    textmap = {\n        \"cp936\": \"\\u4e2d\\u6587\",\n        \"cp1252\": \"Lat\\u012bna\",\n        \"cp932\": \"\\u306b\\u307b\\u3093\\u3054\",\n    }\n    if encoding in textmap:\n        print(textmap[encoding])\n    return True\n\n\nif __name__ == \"__main__\":\n    print(main())\n"
  },
  {
    "path": "test/simple-proxy.js",
    "content": "'use strict'\n\nconst http = require('http')\nconst https = require('https')\nconst server = http.createServer(handler)\nconst port = +process.argv[2]\nconst prefix = process.argv[3]\nconst upstream = process.argv[4]\nlet calls = 0\n\nserver.listen(port)\n\nfunction handler (req, res) {\n  if (req.url.indexOf(prefix) !== 0) {\n    throw new Error('request url [' + req.url + '] does not start with [' + prefix + ']')\n  }\n\n  const upstreamUrl = upstream + req.url.substring(prefix.length)\n  https.get(upstreamUrl, function (ures) {\n    ures.on('end', function () {\n      if (++calls === 2) {\n        server.close()\n      }\n    })\n    ures.pipe(res)\n  })\n}\n"
  },
  {
    "path": "test/test-addon.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst path = require('path')\nconst fs = require('graceful-fs')\nconst os = require('os')\nconst cp = require('child_process')\nconst util = require('../lib/util')\nconst { platformTimeout } = require('./common')\n\nconst addonPath = path.resolve(__dirname, 'node_modules', 'hello_world')\nconst nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js')\n\nconst execFileSync = (...args) => cp.execFileSync(...args).toString().trim()\n\nconst execFile = async (cmd) => {\n  const [err,, stderr] = await util.execFile(process.execPath, cmd, {\n    env: { ...process.env, NODE_GYP_NULL_LOGGER: undefined },\n    encoding: 'utf-8'\n  })\n  return [err, stderr.toString().trim().split(/\\r?\\n/)]\n}\n\nfunction runHello (hostProcess = process.execPath) {\n  const testCode = \"console.log(require('hello_world').hello())\"\n  return execFileSync(hostProcess, ['-e', testCode], { cwd: __dirname })\n}\n\nfunction getEncoding () {\n  const code = 'import locale;print(locale.getdefaultlocale()[1])'\n  return execFileSync('python', ['-c', code])\n}\n\nfunction checkCharmapValid () {\n  try {\n    const data = execFileSync('python', ['fixtures/test-charmap.py'], { cwd: __dirname })\n    return data.split('\\n').pop() === 'True'\n  } catch {\n    return false\n  }\n}\n\ndescribe('addon', function () {\n  it('build simple addon', async function () {\n    this.timeout(platformTimeout(1, { win32: 5 }))\n\n    // Set the loglevel otherwise the output disappears when run via 'npm test'\n    const cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose']\n    const [err, logLines] = await execFile(cmd)\n    const lastLine = logLines[logLines.length - 1]\n    assert.strictEqual(err, null)\n    assert.strictEqual(lastLine, 'gyp info ok', 'should end in ok')\n    assert.strictEqual(runHello(), 'world')\n  })\n\n  it('build simple addon in path with non-ascii characters', async function () {\n    if (!checkCharmapValid()) {\n      return this.skip('python console app can\\'t encode non-ascii character.')\n    }\n\n    // Select non-ascii characters by current encoding\n    const testDirName = {\n      cp936: '文件夹',\n      cp1252: 'Latīna',\n      cp932: 'フォルダ'\n    }[getEncoding()]\n    // If encoding is UTF-8 or other then no need to test\n    if (!testDirName) {\n      return this.skip('no need to test')\n    }\n\n    this.timeout(platformTimeout(1, { win32: 5 }))\n\n    let data\n    const configPath = path.join(addonPath, 'build', 'config.gypi')\n    try {\n      data = fs.readFileSync(configPath, 'utf8')\n    } catch (err) {\n      return assert.fail(err)\n    }\n    const config = JSON.parse(data.replace(/#.+\\n/, ''))\n    const nodeDir = config.variables.nodedir\n    const testNodeDir = path.join(addonPath, testDirName)\n    // Create symbol link to path with non-ascii characters\n    try {\n      fs.symlinkSync(nodeDir, testNodeDir, 'dir')\n    } catch (err) {\n      switch (err.code) {\n        case 'EEXIST': break\n        case 'EPERM':\n          return assert.fail(err, null, 'Please try to running console as an administrator')\n        default:\n          return assert.fail(err)\n      }\n    }\n\n    const cmd = [\n      nodeGyp,\n      'rebuild',\n      '-C',\n      addonPath,\n      '--loglevel=verbose',\n      '-nodedir=' + testNodeDir\n    ]\n    const [err, logLines] = await execFile(cmd)\n    try {\n      fs.unlink(testNodeDir)\n    } catch (err) {\n      assert.fail(err)\n    }\n    const lastLine = logLines[logLines.length - 1]\n    assert.strictEqual(err, null)\n    assert.strictEqual(lastLine, 'gyp info ok', 'should end in ok')\n    assert.strictEqual(runHello(), 'world')\n  })\n\n  it('addon works with renamed host executable', async function () {\n    this.timeout(platformTimeout(1, { win32: 5 }))\n\n    const notNodePath = path.join(os.tmpdir(), 'notnode' + path.extname(process.execPath))\n    fs.copyFileSync(process.execPath, notNodePath)\n\n    const cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose']\n    const [err, logLines] = await execFile(cmd)\n    const lastLine = logLines[logLines.length - 1]\n    assert.strictEqual(err, null)\n    assert.strictEqual(lastLine, 'gyp info ok', 'should end in ok')\n    assert.strictEqual(runHello(notNodePath), 'world')\n    fs.unlinkSync(notNodePath)\n  })\n})\n"
  },
  {
    "path": "test/test-configure-nodedir.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst path = require('path')\nconst os = require('os')\nconst gyp = require('../lib/node-gyp')\nconst requireInject = require('require-inject')\nconst semver = require('semver')\n\nconst versionSemver = semver.parse(process.version)\n\nconst configure = requireInject('../lib/configure', {\n  'graceful-fs': {\n    openSync: () => 0,\n    closeSync: () => {},\n    existsSync: () => true,\n    readFileSync: () => '#define NODE_MAJOR_VERSION ' + versionSemver.major + '\\n' +\n        '#define NODE_MINOR_VERSION ' + versionSemver.minor + '\\n' +\n        '#define NODE_PATCH_VERSION ' + versionSemver.patch + '\\n',\n    promises: {\n      stat: async () => ({}),\n      mkdir: async () => {},\n      writeFile: async () => {}\n    }\n  }\n})\n\nconst configure2 = requireInject('../lib/configure', {\n  'graceful-fs': {\n    openSync: () => 0,\n    closeSync: () => {},\n    existsSync: () => true,\n    readFileSync: () => '#define NODE_MAJOR_VERSION 8\\n' +\n        '#define NODE_MINOR_VERSION 0\\n' +\n        '#define NODE_PATCH_VERSION 0\\n',\n    promises: {\n      stat: async () => ({}),\n      mkdir: async () => {},\n      writeFile: async () => {}\n    }\n  }\n})\n\nconst SPAWN_RESULT = cb => ({ on: function () { cb() } })\n\nconst driveLetter = os.platform() === 'win32' ? `${process.cwd().split(path.sep)[0]}` : ''\nfunction checkTargetPath (target, value) {\n  let targetPath = path.join(path.sep, target, 'include',\n    'node', 'common.gypi')\n  if (process.platform === 'win32') {\n    targetPath = driveLetter + targetPath\n  }\n\n  return targetPath.localeCompare(value) === 0\n}\n\ndescribe('configure-nodedir', function () {\n  it('configure nodedir with node-gyp command line', function (done) {\n    const prog = gyp()\n    prog.parseArgv(['dummy_prog', 'dummy_script', '--nodedir=' + path.sep + 'usr'])\n\n    prog.spawn = function (program, args) {\n      for (let i = 0; i < args.length; i++) {\n        if (checkTargetPath('usr', args[i])) {\n          return SPAWN_RESULT(done)\n        }\n      };\n      assert.fail()\n    }\n    configure(prog, [], assert.fail)\n  })\n\n  if (process.config.variables.use_prefix_to_find_headers) {\n    it('use-prefix-to-find-headers build time option - match', function (done) {\n      const prog = gyp()\n      prog.parseArgv(['dummy_prog', 'dummy_script'])\n\n      prog.spawn = function (program, args) {\n        for (let i = 0; i < args.length; i++) {\n          const nodedir = process.config.variables.node_prefix\n          if (checkTargetPath(nodedir, args[i])) {\n            return SPAWN_RESULT(done)\n          }\n        };\n        assert.fail()\n      }\n      configure(prog, [], assert.fail)\n    })\n\n    it('use-prefix-to-find-headers build time option - no match', function (done) {\n      const prog = gyp()\n      prog.parseArgv(['dummy_prog', 'dummy_script'])\n\n      prog.spawn = function (program, args) {\n        for (let i = 0; i < args.length; i++) {\n          const nodedir = process.config.variables.node_prefix\n          if (checkTargetPath(nodedir, args[i])) {\n            assert.fail()\n          }\n        };\n        return SPAWN_RESULT(done)\n      }\n      configure2(prog, [], assert.fail)\n    })\n\n    it('use-prefix-to-find-headers build time option, target specified', function (done) {\n      const prog = gyp()\n      prog.parseArgv(['dummy_prog', 'dummy_script', '--target=8.0.0'])\n\n      prog.spawn = function (program, args) {\n        for (let i = 0; i < args.length; i++) {\n          const nodedir = process.config.variables.node_prefix\n          if (checkTargetPath(nodedir, args[i])) {\n            assert.fail()\n          }\n        };\n        return SPAWN_RESULT(done)\n      }\n      configure(prog, [], assert.fail)\n    })\n  }\n})\n"
  },
  {
    "path": "test/test-configure-python.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst path = require('path')\nconst { devDir } = require('./common')\nconst gyp = require('../lib/node-gyp')\nconst requireInject = require('require-inject')\n\nconst configure = requireInject('../lib/configure', {\n  'graceful-fs': {\n    openSync: () => 0,\n    closeSync: () => {},\n    existsSync: () => {},\n    promises: {\n      stat: async () => ({}),\n      mkdir: async () => {},\n      writeFile: async () => {}\n    }\n  }\n})\n\nconst EXPECTED_PYPATH = path.join(__dirname, '..', 'gyp', 'pylib')\nconst SEPARATOR = process.platform === 'win32' ? ';' : ':'\nconst SPAWN_RESULT = cb => ({ on: function () { cb() } })\n\ndescribe('configure-python', function () {\n  it('configure PYTHONPATH with no existing env', function (done) {\n    delete process.env.PYTHONPATH\n\n    const prog = gyp()\n    prog.parseArgv([])\n    prog.spawn = function () {\n      assert.strictEqual(process.env.PYTHONPATH, EXPECTED_PYPATH)\n      return SPAWN_RESULT(done)\n    }\n    prog.devDir = devDir\n    configure(prog, [], assert.fail)\n  })\n\n  it('configure PYTHONPATH with existing env of one dir', function (done) {\n    const existingPath = path.join('a', 'b')\n    process.env.PYTHONPATH = existingPath\n\n    const prog = gyp()\n    prog.parseArgv([])\n    prog.spawn = function () {\n      assert.strictEqual(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR))\n\n      const dirs = process.env.PYTHONPATH.split(SEPARATOR)\n      assert.deepStrictEqual(dirs, [EXPECTED_PYPATH, existingPath])\n\n      return SPAWN_RESULT(done)\n    }\n    prog.devDir = devDir\n    configure(prog, [], assert.fail)\n  })\n\n  it('configure PYTHONPATH with existing env of multiple dirs', function (done) {\n    const pythonDir1 = path.join('a', 'b')\n    const pythonDir2 = path.join('b', 'c')\n    const existingPath = [pythonDir1, pythonDir2].join(SEPARATOR)\n    process.env.PYTHONPATH = existingPath\n\n    const prog = gyp()\n    prog.parseArgv([])\n    prog.spawn = function () {\n      assert.strictEqual(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR))\n\n      const dirs = process.env.PYTHONPATH.split(SEPARATOR)\n      assert.deepStrictEqual(dirs, [EXPECTED_PYPATH, pythonDir1, pythonDir2])\n\n      return SPAWN_RESULT(done)\n    }\n    prog.devDir = devDir\n    configure(prog, [], assert.fail)\n  })\n})\n"
  },
  {
    "path": "test/test-create-config-gypi.js",
    "content": "'use strict'\n\nconst path = require('path')\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst gyp = require('../lib/node-gyp')\nconst { parseConfigGypi, getCurrentConfigGypi } = require('../lib/create-config-gypi')\n\ndescribe('create-config-gypi', function () {\n  it('config.gypi with no options', async function () {\n    const prog = gyp()\n    prog.parseArgv([])\n\n    const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })\n    assert.strictEqual(config.target_defaults.default_configuration, 'Release')\n    assert.strictEqual(config.variables.target_arch, process.arch)\n  })\n\n  it('config.gypi with --debug', async function () {\n    const prog = gyp()\n    prog.parseArgv(['_', '_', '--debug'])\n\n    const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })\n    assert.strictEqual(config.target_defaults.default_configuration, 'Debug')\n  })\n\n  it('config.gypi with custom options', async function () {\n    const prog = gyp()\n    prog.parseArgv(['_', '_', '--shared-libxml2'])\n\n    const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })\n    assert.strictEqual(config.variables.shared_libxml2, true)\n  })\n\n  it('config.gypi with nodedir', async function () {\n    const nodeDir = path.join(__dirname, 'fixtures', 'nodedir')\n\n    const prog = gyp()\n    prog.parseArgv(['_', '_', `--nodedir=${nodeDir}`])\n\n    const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} })\n    assert.strictEqual(config.variables.build_with_electron, true)\n  })\n\n  it('config.gypi with --force-process-config', async function () {\n    const nodeDir = path.join(__dirname, 'fixtures', 'nodedir')\n\n    const prog = gyp()\n    prog.parseArgv(['_', '_', '--force-process-config', `--nodedir=${nodeDir}`])\n\n    const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} })\n    assert.strictEqual(config.variables.build_with_electron, undefined)\n  })\n\n  it('config.gypi parsing', function () {\n    const str = \"# Some comments\\n{'variables': {'multiline': 'A'\\n'B'}}\"\n    const config = parseConfigGypi(str)\n    assert.deepStrictEqual(config, { variables: { multiline: 'AB' } })\n  })\n})\n"
  },
  {
    "path": "test/test-download.js",
    "content": "'use strict'\n\nconst { describe, it, after } = require('mocha')\nconst assert = require('assert')\nconst fs = require('fs/promises')\nconst path = require('path')\nconst http = require('http')\nconst https = require('https')\nconst install = require('../lib/install')\nconst { download, readCAFile } = require('../lib/download')\nconst { FULL_TEST, devDir, platformTimeout } = require('./common')\nconst gyp = require('../lib/node-gyp')\nconst certs = require('./fixtures/certs')\n\ndescribe('download', function () {\n  it('download over http', async function () {\n    const server = http.createServer((req, res) => {\n      assert.strictEqual(req.headers['user-agent'], `node-gyp v42 (node ${process.version})`)\n      res.end('ok')\n    })\n\n    after(() => new Promise((resolve) => server.close(resolve)))\n\n    const host = 'localhost'\n    await new Promise((resolve) => server.listen(0, host, resolve))\n    const { port } = server.address()\n    const gyp = {\n      opts: {},\n      version: '42'\n    }\n    const url = `http://${host}:${port}`\n    const res = await download(gyp, url)\n    assert.strictEqual(await res.text(), 'ok')\n  })\n\n  it('download over https with custom ca', async function () {\n    const cafile = path.join(__dirname, 'fixtures/ca.crt')\n    const cacontents = certs['ca.crt']\n    const cert = certs['server.crt']\n    const key = certs['server.key']\n    await fs.writeFile(cafile, cacontents, 'utf8')\n    const ca = await readCAFile(cafile)\n\n    assert.strictEqual(ca.length, 1)\n\n    const options = { ca, cert, key }\n    const server = https.createServer(options, (req, res) => {\n      assert.strictEqual(req.headers['user-agent'], `node-gyp v42 (node ${process.version})`)\n      res.end('ok')\n    })\n\n    after(async () => {\n      await new Promise((resolve) => server.close(resolve))\n      await fs.unlink(cafile)\n    })\n\n    server.on('clientError', (err) => { throw err })\n\n    const host = 'localhost'\n    await new Promise((resolve) => server.listen(0, host, resolve))\n    const { port } = server.address()\n    const gyp = {\n      opts: { cafile },\n      version: '42'\n    }\n    const url = `https://${host}:${port}`\n    const res = await download(gyp, url)\n    assert.strictEqual(await res.text(), 'ok')\n  })\n\n  it('download over http with proxy', async function () {\n    const server = http.createServer((_, res) => {\n      res.end('ok')\n    })\n\n    const pserver = http.createServer((req, res) => {\n      assert.strictEqual(req.headers['user-agent'], `node-gyp v42 (node ${process.version})`)\n      res.end('proxy ok')\n    })\n\n    after(() => Promise.all([\n      new Promise((resolve) => server.close(resolve)),\n      new Promise((resolve) => pserver.close(resolve))\n    ]))\n\n    const host = 'localhost'\n    await new Promise((resolve) => server.listen(0, host, resolve))\n    const { port } = server.address()\n    await new Promise((resolve) => pserver.listen(port + 1, host, resolve))\n    const gyp = {\n      opts: {\n        proxy: `http://${host}:${port + 1}`,\n        noproxy: 'bad'\n      },\n      version: '42'\n    }\n    const url = `http://${host}:${port}`\n    const res = await download(gyp, url)\n    assert.strictEqual(await res.text(), 'proxy ok')\n  })\n\n  it('download over http with noproxy', async function () {\n    const server = http.createServer((req, res) => {\n      assert.strictEqual(req.headers['user-agent'], `node-gyp v42 (node ${process.version})`)\n      res.end('ok')\n    })\n\n    const pserver = http.createServer((_, res) => {\n      res.end('proxy ok')\n    })\n\n    after(() => Promise.all([\n      new Promise((resolve) => server.close(resolve)),\n      new Promise((resolve) => pserver.close(resolve))\n    ]))\n\n    const host = 'localhost'\n    await new Promise((resolve) => server.listen(0, host, resolve))\n    const { port } = server.address()\n    await new Promise((resolve) => pserver.listen(port + 1, host, resolve))\n    const gyp = {\n      opts: {\n        proxy: `http://${host}:${port + 1}`,\n        noproxy: host\n      },\n      version: '42'\n    }\n    const url = `http://${host}:${port}`\n    const res = await download(gyp, url)\n    assert.strictEqual(await res.text(), 'ok')\n  })\n\n  it('download with missing cafile', async function () {\n    const gyp = {\n      opts: { cafile: 'no.such.file' }\n    }\n    try {\n      await download(gyp, {}, 'http://bad/')\n    } catch (e) {\n      assert.ok(/no.such.file/.test(e.message))\n    }\n  })\n\n  it('check certificate splitting', async function () {\n    const cafile = path.join(__dirname, 'fixtures/ca-bundle.crt')\n    const cacontents = certs['ca-bundle.crt']\n    await fs.writeFile(cafile, cacontents, 'utf8')\n    after(async () => {\n      await fs.unlink(cafile)\n    })\n    const cas = await readCAFile(path.join(__dirname, 'fixtures/ca-bundle.crt'))\n    assert.strictEqual(cas.length, 2)\n    assert.notStrictEqual(cas[0], cas[1])\n  })\n\n  // only run this test if we are running a version of Node with predictable version path behavior\n\n  it('download headers (actual)', async function () {\n    if (!FULL_TEST) {\n      return this.skip('Skipping actual download of headers due to test environment configuration')\n    }\n\n    this.timeout(platformTimeout(1, { win32: 5 }))\n\n    const expectedDir = path.join(devDir, process.version.replace(/^v/, ''))\n    await fs.rm(expectedDir, { recursive: true, force: true, maxRetries: 3 })\n\n    const prog = gyp()\n    prog.parseArgv([])\n    prog.devDir = devDir\n    await install(prog, [])\n\n    const data = await fs.readFile(path.join(expectedDir, 'installVersion'), 'utf8')\n    assert.strictEqual(data, '11\\n', 'correct installVersion')\n\n    const list = await fs.readdir(path.join(expectedDir, 'include/node'))\n    assert.ok(list.includes('common.gypi'))\n    assert.ok(list.includes('config.gypi'))\n    assert.ok(list.includes('node.h'))\n    assert.ok(list.includes('node_version.h'))\n    assert.ok(list.includes('openssl'))\n    assert.ok(list.includes('uv'))\n    assert.ok(list.includes('uv.h'))\n    assert.ok(list.includes('v8-platform.h'))\n    assert.ok(list.includes('v8.h'))\n    assert.ok(list.includes('zlib.h'))\n\n    const lines = (await fs.readFile(path.join(expectedDir, 'include/node/node_version.h'), 'utf8')).split('\\n')\n\n    // extract the 3 version parts from the defines to build a valid version string and\n    // and check them against our current env version\n    const version = ['major', 'minor', 'patch'].reduce((version, type) => {\n      const re = new RegExp(`^#define\\\\sNODE_${type.toUpperCase()}_VERSION`)\n      const line = lines.find((l) => re.test(l))\n      const i = line ? parseInt(line.replace(/^[^0-9]+([0-9]+).*$/, '$1'), 10) : 'ERROR'\n      return `${version}${type !== 'major' ? '.' : 'v'}${i}`\n    }, '')\n\n    assert.strictEqual(version, process.version)\n  })\n})\n"
  },
  {
    "path": "test/test-find-accessible-sync.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst path = require('path')\nconst requireInject = require('require-inject')\nconst { findAccessibleSync } = requireInject('../lib/util', {\n  'graceful-fs': {\n    closeSync: function () { return undefined },\n    openSync: function (path) {\n      if (readableFiles.some(function (f) { return f === path })) {\n        return 0\n      } else {\n        const error = new Error('ENOENT - not found')\n        throw error\n      }\n    }\n  }\n})\n\nconst dir = path.sep + 'testdir'\nconst readableFile = 'readable_file'\nconst anotherReadableFile = 'another_readable_file'\nconst readableFileInDir = 'somedir' + path.sep + readableFile\nconst readableFiles = [\n  path.resolve(dir, readableFile),\n  path.resolve(dir, anotherReadableFile),\n  path.resolve(dir, readableFileInDir)\n]\n\ndescribe('find-accessible-sync', function () {\n  it('find accessible - empty array', function () {\n    const candidates = []\n    const found = findAccessibleSync('test', dir, candidates)\n    assert.strictEqual(found, undefined)\n  })\n\n  it('find accessible - single item array, readable', function () {\n    const candidates = [readableFile]\n    const found = findAccessibleSync('test', dir, candidates)\n    assert.strictEqual(found, path.resolve(dir, readableFile))\n  })\n\n  it('find accessible - single item array, readable in subdir', function () {\n    const candidates = [readableFileInDir]\n    const found = findAccessibleSync('test', dir, candidates)\n    assert.strictEqual(found, path.resolve(dir, readableFileInDir))\n  })\n\n  it('find accessible - single item array, unreadable', function () {\n    const candidates = ['unreadable_file']\n    const found = findAccessibleSync('test', dir, candidates)\n    assert.strictEqual(found, undefined)\n  })\n\n  it('find accessible - multi item array, no matches', function () {\n    const candidates = ['non_existent_file', 'unreadable_file']\n    const found = findAccessibleSync('test', dir, candidates)\n    assert.strictEqual(found, undefined)\n  })\n\n  it('find accessible - multi item array, single match', function () {\n    const candidates = ['non_existent_file', readableFile]\n    const found = findAccessibleSync('test', dir, candidates)\n    assert.strictEqual(found, path.resolve(dir, readableFile))\n  })\n\n  it('find accessible - multi item array, return first match', function () {\n    const candidates = ['non_existent_file', anotherReadableFile, readableFile]\n    const found = findAccessibleSync('test', dir, candidates)\n    assert.strictEqual(found, path.resolve(dir, anotherReadableFile))\n  })\n})\n"
  },
  {
    "path": "test/test-find-node-directory.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst path = require('path')\nconst findNodeDirectory = require('../lib/find-node-directory')\n\nconst platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32', 'aix', 'os400']\n\ndescribe('find-node-directory', function () {\n  // we should find the directory based on the directory\n  // the script is running in and it should match the layout\n  // in a build tree where npm is installed in\n  // .... /deps/npm\n  it('test find-node-directory - node install', function () {\n    for (let next = 0; next < platforms.length; next++) {\n      const processObj = { execPath: '/x/y/bin/node', platform: platforms[next] }\n      assert.strictEqual(\n        findNodeDirectory('/x/deps/npm/node_modules/node-gyp/lib', processObj),\n        path.join('/x'))\n    }\n  })\n\n  // we should find the directory based on the directory\n  // the script is running in and it should match the layout\n  // in an installed tree where npm is installed in\n  // .... /lib/node_modules/npm or .../node_modules/npm\n  // depending on the patform\n  it('test find-node-directory - node build', function () {\n    for (let next = 0; next < platforms.length; next++) {\n      const processObj = { execPath: '/x/y/bin/node', platform: platforms[next] }\n      if (platforms[next] === 'win32') {\n        assert.strictEqual(\n          findNodeDirectory('/y/node_modules/npm/node_modules/node-gyp/lib',\n            processObj), path.join('/y'))\n      } else {\n        assert.strictEqual(\n          findNodeDirectory('/y/lib/node_modules/npm/node_modules/node-gyp/lib',\n            processObj), path.join('/y'))\n      }\n    }\n  })\n\n  // we should find the directory based on the execPath\n  // for node and match because it was in the bin directory\n  it('test find-node-directory - node in bin directory', function () {\n    for (let next = 0; next < platforms.length; next++) {\n      const processObj = { execPath: '/x/y/bin/node', platform: platforms[next] }\n      assert.strictEqual(\n        findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj),\n        path.join('/x/y'))\n    }\n  })\n\n  // we should find the directory based on the execPath\n  // for node and match because it was in the Release directory\n  it('test find-node-directory - node in build release dir', function () {\n    for (let next = 0; next < platforms.length; next++) {\n      let processObj\n      if (platforms[next] === 'win32') {\n        processObj = { execPath: '/x/y/Release/node', platform: platforms[next] }\n      } else {\n        processObj = {\n          execPath: '/x/y/out/Release/node',\n          platform: platforms[next]\n        }\n      }\n\n      assert.strictEqual(\n        findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj),\n        path.join('/x/y'))\n    }\n  })\n\n  // we should find the directory based on the execPath\n  // for node and match because it was in the Debug directory\n  it('test find-node-directory - node in Debug release dir', function () {\n    for (let next = 0; next < platforms.length; next++) {\n      let processObj\n      if (platforms[next] === 'win32') {\n        processObj = { execPath: '/a/b/Debug/node', platform: platforms[next] }\n      } else {\n        processObj = { execPath: '/a/b/out/Debug/node', platform: platforms[next] }\n      }\n\n      assert.strictEqual(\n        findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj),\n        path.join('/a/b'))\n    }\n  })\n\n  // we should not find it as it will not match based on the execPath nor\n  // the directory from which the script is running\n  it('test find-node-directory - not found', function () {\n    for (let next = 0; next < platforms.length; next++) {\n      const processObj = { execPath: '/x/y/z/y', platform: next }\n      assert.strictEqual(findNodeDirectory('/a/b/c/d', processObj), '')\n    }\n  })\n\n  // we should find the directory based on the directory\n  // the script is running in and it should match the layout\n  // in a build tree where npm is installed in\n  // .... /deps/npm\n  // same test as above but make sure additional directory entries\n  // don't cause an issue\n  it('test find-node-directory - node install', function () {\n    for (let next = 0; next < platforms.length; next++) {\n      const processObj = { execPath: '/x/y/bin/node', platform: platforms[next] }\n      assert.strictEqual(\n        findNodeDirectory('/x/y/z/a/b/c/deps/npm/node_modules/node-gyp/lib',\n          processObj), path.join('/x/y/z/a/b/c'))\n    }\n  })\n})\n"
  },
  {
    "path": "test/test-find-python.js",
    "content": "'use strict'\n\ndelete process.env.PYTHON\n\nconst { describe, it, after } = require('mocha')\nconst assert = require('assert')\nconst PythonFinder = require('../lib/find-python')\nconst { execFile } = require('../lib/util')\nconst { poison } = require('./common')\nconst fs = require('fs')\nconst path = require('path')\nconst os = require('os')\n\nclass TestPythonFinder extends PythonFinder {\n  constructor (...args) {\n    super(...args)\n    delete this.env.NODE_GYP_FORCE_PYTHON\n  }\n\n  async findPython () {\n    try {\n      return { err: null, python: await super.findPython() }\n    } catch (err) {\n      return { err, python: null }\n    }\n  }\n}\n\ndescribe('find-python', function () {\n  it('find python', async function () {\n    const found = await PythonFinder.findPython(null)\n    const [err, stdout, stderr] = await execFile(found, ['-V'], { encoding: 'utf-8' })\n    assert.strictEqual(err, null)\n    assert.ok(/Python 3/.test(stdout))\n    assert.strictEqual(stderr, '')\n  })\n\n  it('find python - encoding', async function () {\n    const found = await PythonFinder.findPython(null)\n    const testFolderPath = fs.mkdtempSync(path.join(os.tmpdir(), 'test-ü-'))\n    const testFilePath = path.join(testFolderPath, 'python.exe')\n    after(function () {\n      try {\n        fs.unlinkSync(testFilePath)\n        fs.rmdirSync(testFolderPath)\n      } catch {}\n    })\n\n    try {\n      fs.symlinkSync(found, testFilePath)\n    } catch (err) {\n      switch (err.code) {\n        case 'EPERM':\n          return assert.fail(err, null, 'Please try to run console as an administrator')\n        default:\n          return assert.fail(err)\n      }\n    }\n\n    const finder = new PythonFinder(testFilePath)\n    await assert.doesNotReject(finder.checkCommand(testFilePath))\n  })\n\n  it('find python - python', async function () {\n    const f = new TestPythonFinder('python')\n    f.execFile = async function (program, args, opts) {\n      f.execFile = async function (program, args, opts) {\n        poison(f, 'execFile')\n        assert.strictEqual(program, '/path/python')\n        assert.ok(/sys\\.version_info/.test(args[1]))\n        return [null, '3.9.1']\n      }\n      assert.strictEqual(program, process.platform === 'win32' ? '\"python\"' : 'python')\n      assert.ok(/sys\\.executable/.test(args[1]))\n      return [null, '/path/python']\n    }\n\n    const { err, python } = await f.findPython()\n    assert.strictEqual(err, null)\n    assert.strictEqual(python, '/path/python')\n  })\n\n  it('find python - python too old', async function () {\n    const f = new TestPythonFinder(null)\n    f.execFile = async function (program, args, opts) {\n      if (/sys\\.executable/.test(args[args.length - 1])) {\n        return [null, '/path/python']\n      } else if (/sys\\.version_info/.test(args[args.length - 1])) {\n        return [null, '2.3.4']\n      } else {\n        assert.fail()\n      }\n    }\n\n    const { err } = await f.findPython()\n    assert.ok(/Could not find any Python/.test(err))\n    assert.ok(/not supported/i.test(f.errorLog))\n  })\n\n  it('find python - no python', async function () {\n    const f = new TestPythonFinder(null)\n    f.execFile = async function (program, args, opts) {\n      if (/sys\\.executable/.test(args[args.length - 1])) {\n        throw new Error('not found')\n      } else if (/sys\\.version_info/.test(args[args.length - 1])) {\n        throw new Error('not a Python executable')\n      } else {\n        assert.fail()\n      }\n    }\n\n    const { err } = await f.findPython()\n    assert.ok(/Could not find any Python/.test(err))\n    assert.ok(/not in PATH/.test(f.errorLog))\n  })\n\n  it('find python - no python2, no python, unix', async function () {\n    const f = new TestPythonFinder(null)\n    f.checkPyLauncher = assert.fail\n    f.win = false\n\n    f.execFile = async function (program, args, opts) {\n      if (/sys\\.executable/.test(args[args.length - 1])) {\n        throw new Error('not found')\n      } else {\n        assert.fail()\n      }\n    }\n\n    const { err } = await f.findPython()\n    assert.ok(/Could not find any Python/.test(err))\n    assert.ok(/not in PATH/.test(f.errorLog))\n  })\n\n  it('find python - no python, use python launcher', async function () {\n    const f = new TestPythonFinder(null)\n    f.win = true\n\n    f.execFile = async function (program, args, opts) {\n      if (program === 'py.exe') {\n        assert.notStrictEqual(args.indexOf('-3'), -1)\n        assert.notStrictEqual(args.indexOf('-c'), -1)\n        return [null, 'Z:\\\\snake.exe']\n      }\n      if (/sys\\.executable/.test(args[args.length - 1])) {\n        throw new Error('not found')\n      } else if (f.winDefaultLocations.includes(program)) {\n        throw new Error('not found')\n      } else if (/sys\\.version_info/.test(args[args.length - 1])) {\n        if (program === 'Z:\\\\snake.exe') {\n          return [null, '3.9.0']\n        } else {\n          assert.fail()\n        }\n      } else {\n        assert.fail()\n      }\n    }\n    const { err, python } = await f.findPython()\n    assert.strictEqual(err, null)\n    assert.strictEqual(python, 'Z:\\\\snake.exe')\n  })\n\n  it('find python - no python, no python launcher, good guess', async function () {\n    const f = new TestPythonFinder(null)\n    f.win = true\n    const expectedProgram = f.winDefaultLocations[0]\n\n    f.execFile = async function (program, args, opts) {\n      if (program === 'py.exe') {\n        throw new Error('not found')\n      }\n      if (/sys\\.executable/.test(args[args.length - 1])) {\n        throw new Error('not found')\n      } else if (program === expectedProgram &&\n                 /sys\\.version_info/.test(args[args.length - 1])) {\n        return [null, '3.7.3']\n      } else {\n        assert.fail()\n      }\n    }\n    const { err, python } = await f.findPython()\n    assert.strictEqual(err, null)\n    assert.ok(python === expectedProgram)\n  })\n\n  it('find python - no python, no python launcher, bad guess', async function () {\n    const f = new TestPythonFinder(null)\n    f.win = true\n\n    f.execFile = async function (program, args, opts) {\n      if (/sys\\.executable/.test(args[args.length - 1])) {\n        throw new Error('not found')\n      } else if (/sys\\.version_info/.test(args[args.length - 1])) {\n        throw new Error('not a Python executable')\n      } else {\n        assert.fail()\n      }\n    }\n    const { err } = await f.findPython()\n    assert.ok(/Could not find any Python/.test(err))\n    assert.ok(/not in PATH/.test(f.errorLog))\n  })\n})\n"
  },
  {
    "path": "test/test-find-visualstudio.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst fs = require('fs')\nconst path = require('path')\nconst VisualStudioFinder = require('../lib/find-visualstudio')\nconst { poison } = require('./common')\n\nconst semverV1 = { major: 1, minor: 0, patch: 0 }\n\ndelete process.env.VCINSTALLDIR\n\nclass TestVisualStudioFinder extends VisualStudioFinder {\n  async findVisualStudio () {\n    try {\n      return { err: null, info: await super.findVisualStudio() }\n    } catch (err) {\n      return { err, info: null }\n    }\n  }\n}\n\ndescribe('find-visualstudio', function () {\n  this.beforeAll(function () {\n    // Condition to skip the test suite\n    if (process.env.SystemRoot === undefined) {\n      process.env.SystemRoot = '/'\n    }\n  })\n\n  it('VS2013', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findNewVS = async () => null\n    finder.regSearchKeys = async (keys, value, addOpts) => {\n      for (let i = 0; i < keys.length; ++i) {\n        const fullName = `${keys[i]}\\\\${value}`\n        switch (fullName) {\n          case 'HKLM\\\\Software\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\14.0':\n          case 'HKLM\\\\Software\\\\Wow6432Node\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\14.0':\n            continue\n          case 'HKLM\\\\Software\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\12.0':\n            assert.ok(true, `expected search for registry value ${fullName}`)\n            return 'C:\\\\VS2013\\\\VC\\\\'\n          case 'HKLM\\\\Software\\\\Microsoft\\\\MSBuild\\\\ToolsVersions\\\\12.0\\\\MSBuildToolsPath':\n            assert.ok(true, `expected search for registry value ${fullName}`)\n            return 'C:\\\\MSBuild12\\\\'\n          default:\n            assert.fail(`unexpected search for registry value ${fullName}`)\n        }\n      }\n      throw new Error()\n    }\n\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\MSBuild12\\\\MSBuild.exe',\n      path: 'C:\\\\VS2013',\n      sdk: null,\n      toolset: 'v120',\n      version: '12.0',\n      versionMajor: 12,\n      versionMinor: 0,\n      versionYear: 2013\n    })\n  })\n\n  it('VS2013 should not be found on new node versions', async function () {\n    const finder = new TestVisualStudioFinder({\n      major: 10,\n      minor: 0,\n      patch: 0\n    }, null)\n\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures', 'VS_2017_Unusable.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures', 'VS_2017_Unusable.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    finder.regSearchKeys = async (keys, value, addOpts) => {\n      for (let i = 0; i < keys.length; ++i) {\n        const fullName = `${keys[i]}\\\\${value}`\n        switch (fullName) {\n          case 'HKLM\\\\Software\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\14.0':\n          case 'HKLM\\\\Software\\\\Wow6432Node\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\14.0':\n            continue\n          default:\n            assert.fail(`unexpected search for registry value ${fullName}`)\n        }\n      }\n      throw new Error()\n    }\n\n    const { err, info } = await finder.findVisualStudio()\n    assert.ok(/find .* Visual Studio/i.test(err), 'expect error')\n    assert.ok(!info, 'no data')\n  })\n\n  it('VS2015', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findNewVS = async () => null\n    finder.regSearchKeys = async (keys, value, addOpts) => {\n      for (let i = 0; i < keys.length; ++i) {\n        const fullName = `${keys[i]}\\\\${value}`\n        switch (fullName) {\n          case 'HKLM\\\\Software\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\14.0':\n            assert.ok(true, `expected search for registry value ${fullName}`)\n            return 'C:\\\\VS2015\\\\VC\\\\'\n          case 'HKLM\\\\Software\\\\Microsoft\\\\MSBuild\\\\ToolsVersions\\\\14.0\\\\MSBuildToolsPath':\n            assert.ok(true, `expected search for registry value ${fullName}`)\n            return 'C:\\\\MSBuild14\\\\'\n          default:\n            assert.fail(`unexpected search for registry value ${fullName}`)\n        }\n      }\n      throw new Error()\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\MSBuild14\\\\MSBuild.exe',\n      path: 'C:\\\\VS2015',\n      sdk: null,\n      toolset: 'v140',\n      version: '14.0',\n      versionMajor: 14,\n      versionMinor: 0,\n      versionYear: 2015\n    })\n  })\n\n  it('error from PowerShell', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null, null)\n\n    const vsInfo = finder.parseData(new Error('Error msg'), '', '')\n    assert.ok(/use PowerShell/i.test(finder.errorLog[0]), `expect error, output: ${finder.errorLog[0]}`)\n    assert.ok(/error msg/i.test(finder.errorLog[0]), `expect error, output: ${finder.errorLog[0]}`)\n    assert.equal(vsInfo, null)\n  })\n\n  it('empty output from PowerShell', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null, null)\n\n    const vsInfo = finder.parseData(null, '', '', { checkIsArray: true })\n    assert.ok(/use PowerShell/i.test(finder.errorLog[0]), `expect error, output: ${finder.errorLog[0]}`)\n    assert.equal(vsInfo, null)\n  })\n\n  it('output from PowerShell not JSON', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null, null)\n\n    const vsInfo = finder.parseData(null, 'AAAABBBB', '', { checkIsArray: true })\n    assert.ok(/use PowerShell/i.test(finder.errorLog[0]), `expect error, output: ${finder.errorLog[0]}`)\n    assert.equal(vsInfo, null)\n  })\n\n  it('wrong JSON from PowerShell', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null, null)\n\n    const vsInfo = finder.parseData(null, '{}', '', { checkIsArray: true })\n    assert.ok(/use PowerShell/i.test(finder.errorLog[0]), `expect error, output: ${finder.errorLog[0]}`)\n    assert.ok(/expected array/i.test(finder.errorLog[0]), `expect error, output: ${finder.errorLog[0]}`)\n    assert.equal(vsInfo, null)\n  })\n\n  it('empty JSON from PowerShell', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null, null)\n\n    const vsInfo = finder.parseData(null, '[]', '', { checkIsArray: true })\n    assert.equal(finder.errorLog.length, 0)\n    assert.equal(vsInfo.length, 0)\n  })\n\n  it('future version', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null, null)\n\n    const vsInfo = finder.parseData(null, JSON.stringify([{\n      packages: [\n        'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',\n        'Microsoft.VisualStudio.Component.Windows10SDK.17763',\n        'Microsoft.VisualStudio.VC.MSBuild.Base'\n      ],\n      path: 'C:\\\\VS',\n      version: '9999.9999.9999.9999'\n    }]), '', { checkIsArray: true })\n    assert.equal(finder.errorLog.length, 0)\n    assert.equal(vsInfo[0].packages.length, 3)\n  })\n\n  it('single unusable VS2017', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null, null)\n\n    const file = path.join(__dirname, 'fixtures', 'VS_2017_Unusable.txt')\n    const data = fs.readFileSync(file)\n    const vsInfo = finder.parseData(null, data, '', { checkIsArray: true })\n    assert.equal(finder.errorLog.length, 0)\n    assert.equal(vsInfo.length, 1)\n    assert.equal(vsInfo[0].InstallationPath, undefined)\n    assert.notEqual(vsInfo[0].path, undefined)\n    assert.ok(vsInfo[0].packages.length > 1)\n  })\n\n  it('minimal VS2017 Build Tools', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2017_BuildTools_minimal.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2017_BuildTools_minimal.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\' +\n        'BuildTools\\\\MSBuild\\\\15.0\\\\Bin\\\\MSBuild.exe',\n      path:\n        'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\BuildTools',\n      sdk: '10.0.17134.0',\n      toolset: 'v141',\n      version: '15.9.28307.665',\n      versionMajor: 15,\n      versionMinor: 9,\n      versionYear: 2017\n    })\n  })\n\n  it('VS2017 Community with C++ workload', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2017_Community_workload.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2017_Community_workload.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\' +\n        'Community\\\\MSBuild\\\\15.0\\\\Bin\\\\MSBuild.exe',\n      path:\n        'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\Community',\n      sdk: '10.0.17763.0',\n      toolset: 'v141',\n      version: '15.9.28307.665',\n      versionMajor: 15,\n      versionMinor: 9,\n      versionYear: 2017\n    })\n  })\n\n  it('VS2017 Express', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures', 'VS_2017_Express.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures', 'VS_2017_Express.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\' +\n        'WDExpress\\\\MSBuild\\\\15.0\\\\Bin\\\\MSBuild.exe',\n      path:\n        'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\WDExpress',\n      sdk: '10.0.17763.0',\n      toolset: 'v141',\n      version: '15.9.28307.858',\n      versionMajor: 15,\n      versionMinor: 9,\n      versionYear: 2017\n    })\n  })\n\n  it('VS2019 Preview with C++ workload', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2019_Preview.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2019_Preview.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\' +\n        'Preview\\\\MSBuild\\\\Current\\\\Bin\\\\MSBuild.exe',\n      path:\n        'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Preview',\n      sdk: '10.0.17763.0',\n      toolset: 'v142',\n      version: '16.0.28608.199',\n      versionMajor: 16,\n      versionMinor: 0,\n      versionYear: 2019\n    })\n  })\n\n  it('minimal VS2019 Build Tools', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2019_BuildTools_minimal.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2019_BuildTools_minimal.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\' +\n        'BuildTools\\\\MSBuild\\\\Current\\\\Bin\\\\MSBuild.exe',\n      path:\n        'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools',\n      sdk: '10.0.17134.0',\n      toolset: 'v142',\n      version: '16.1.28922.388',\n      versionMajor: 16,\n      versionMinor: 1,\n      versionYear: 2019\n    })\n  })\n\n  it('VS2019 Community with C++ workload', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2019_Community_workload.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2019_Community_workload.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\' +\n        'Community\\\\MSBuild\\\\Current\\\\Bin\\\\MSBuild.exe',\n      path:\n        'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community',\n      sdk: '10.0.17763.0',\n      toolset: 'v142',\n      version: '16.1.28922.388',\n      versionMajor: 16,\n      versionMinor: 1,\n      versionYear: 2019\n    })\n  })\n\n  it('VS2022 Preview with C++ workload', async function () {\n    const msBuildPath = process.arch === 'arm64'\n      ? 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\' +\n        'Community\\\\MSBuild\\\\Current\\\\Bin\\\\arm64\\\\MSBuild.exe'\n      : 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\' +\n        'Community\\\\MSBuild\\\\Current\\\\Bin\\\\MSBuild.exe'\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.msBuildPathExists = (path) => {\n      return true\n    }\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2022_Community_workload.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2022_Community_workload.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: msBuildPath,\n      path:\n        'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community',\n      sdk: '10.0.22621.0',\n      toolset: 'v143',\n      version: '17.4.33213.308',\n      versionMajor: 17,\n      versionMinor: 4,\n      versionYear: 2022\n    })\n  })\n\n  it('VS2026 Preview with C++ workload', async function () {\n    const msBuildPath = process.arch === 'arm64'\n      ? 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\18\\\\' +\n        'Insiders\\\\MSBuild\\\\Current\\\\Bin\\\\arm64\\\\MSBuild.exe'\n      : 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\18\\\\' +\n        'Insiders\\\\MSBuild\\\\Current\\\\Bin\\\\MSBuild.exe'\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.msBuildPathExists = (path) => {\n      return true\n    }\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2026_Insiders_workload.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2026_Insiders_workload.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: msBuildPath,\n      path:\n        'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\18\\\\Insiders',\n      sdk: '10.0.26100.0',\n      toolset: 'v145',\n      version: '18.3.11206.111',\n      versionMajor: 18,\n      versionMinor: 3,\n      versionYear: 2026\n    })\n  })\n\n  it('VS2026 Release with C++ workload', async function () {\n    const msBuildPath = process.arch === 'arm64'\n      ? 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2026\\\\' +\n        'Community\\\\MSBuild\\\\Current\\\\Bin\\\\arm64\\\\MSBuild.exe'\n      : 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2026\\\\' +\n        'Community\\\\MSBuild\\\\Current\\\\Bin\\\\MSBuild.exe'\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    finder.msBuildPathExists = (path) => {\n      return true\n    }\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      // Create mock data for release version with 2026 path\n      const releaseData = [{\n        path: 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2026\\\\Community',\n        version: '18.0.1000.100',\n        packages: [\n          'Microsoft.VisualStudio.Product.Community',\n          'Microsoft.VisualStudio.Workload.NativeDesktop',\n          'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',\n          'Microsoft.VisualStudio.Component.Windows11SDK.26100'\n        ]\n      }]\n      return finder.processData(releaseData, [2019, 2022, 2026])\n    }\n    finder.findVisualStudio2017 = async () => null\n\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: msBuildPath,\n      path:\n        'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2026\\\\Community',\n      sdk: '10.0.26100.0',\n      toolset: 'v145',\n      version: '18.0.1000.100',\n      versionMajor: 18,\n      versionMinor: 0,\n      versionYear: 2026\n    })\n  })\n\n  it('VS2022 Build Tools with ARM64 MSVC only', async function () {\n    if (process.arch !== 'arm64') {\n      return\n    }\n\n    const msBuildPath = 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2022\\\\' +\n        'BuildTools\\\\MSBuild\\\\Current\\\\Bin\\\\arm64\\\\MSBuild.exe'\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    poison(finder, 'findVisualStudio2017')\n    finder.msBuildPathExists = (path) => {\n      return true\n    }\n    finder.findNewVSUsingSetupModule = async () => null\n    finder.findVisualStudio2019OrNewer = async () => {\n      const file = path.join(__dirname, 'fixtures',\n        'VS_2022_BuildTools_arm64_only.txt')\n      const data = fs.readFileSync(file)\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: msBuildPath,\n      path:\n        'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2022\\\\BuildTools',\n      sdk: '10.0.22621.0',\n      toolset: 'v143',\n      version: '17.11.35222.181',\n      versionMajor: 17,\n      versionMinor: 11,\n      versionYear: 2022\n    })\n  })\n\n  it('VSSetup: VS2022 with C++ workload without SDK', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n    finder.msBuildPathExists = (path) => {\n      return true\n    }\n    finder.findNewVS = async () => null\n    finder.findOldVS = async () => null\n    setupExecFixture(finder, 'VSSetup_VS_2022_workload_missing_sdk.txt')\n    const { err, info } = await finder.findVisualStudio()\n    assert.match(err.message, /could not find/i)\n    assert.strictEqual(info, null)\n  })\n\n  it('VSSetup: VS2019 with C++ workload', async function () {\n    await verifyVSSetupData('VSSetup_VS_2019_Professional_workload.txt', 'Professional', 2019,\n      '10.0.19041.0', 'v142', '16.11.34407.143', 'Program Files (x86)')\n  })\n\n  it('VSSetup: VS2022 with C++ workload', async function () {\n    await verifyVSSetupData('VSSetup_VS_2022_workload.txt', 'Enterprise', 2022,\n      '10.0.22000.0', 'v143', '17.8.34330.188', 'Program Files')\n  })\n\n  it('VSSetup: VS2022 and VS2019 with C++ workload', async function () {\n    await verifyVSSetupData('VSSetup_VS_2022_VS2019_workload.txt', 'Enterprise', 2022,\n      '10.0.22000.0', 'v143', '17.8.34330.188', 'Program Files')\n  })\n\n  it('VSSetup: VS2022 with multiple installations', async function () {\n    await verifyVSSetupData('VSSetup_VS_2022_multiple_install.txt', 'Enterprise', 2022,\n      '10.0.22000.0', 'v143', '17.8.34330.188', 'Program Files')\n  })\n\n  async function verifyVSSetupData (fixtureName, vsType, vsYear, sdkVersion, toolsetVersion, vsVersion, expectedProgramFilesPath) {\n    const msBuildPath = process.arch === 'arm64'\n      ? `C:\\\\${expectedProgramFilesPath}\\\\Microsoft Visual Studio\\\\${vsYear}\\\\` +\n        `${vsType}\\\\MSBuild\\\\Current\\\\Bin\\\\arm64\\\\MSBuild.exe`\n      : `C:\\\\${expectedProgramFilesPath}\\\\Microsoft Visual Studio\\\\${vsYear}\\\\` +\n        `${vsType}\\\\MSBuild\\\\Current\\\\Bin\\\\MSBuild.exe`\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    poison(finder, 'regSearchKeys')\n    const expectedVSPath = `C:\\\\${expectedProgramFilesPath}\\\\Microsoft Visual Studio\\\\${vsYear}\\\\${vsType}`\n    finder.msBuildPathExists = (path) => {\n      if (path.startsWith(expectedVSPath) && path.endsWith('MSBuild.exe')) {\n        return true\n      }\n      return false\n    }\n    finder.findVisualStudio2019OrNewer = async () => {\n      throw new Error(\"findVisualStudio2019OrNewer shouldn't be called\")\n    }\n    finder.findVisualStudio2017 = async () => {\n      throw new Error(\"findVisualStudio2017 shouldn't be called\")\n    }\n    setupExecFixture(finder, fixtureName)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    const vsVersionTokens = vsVersion.split('.')\n    assert.deepStrictEqual(info, {\n      msBuild: msBuildPath,\n      path:\n        `C:\\\\${expectedProgramFilesPath}\\\\Microsoft Visual Studio\\\\${vsYear}\\\\${vsType}`,\n      sdk: sdkVersion,\n      toolset: toolsetVersion,\n      version: vsVersion,\n      versionMajor: parseInt(vsVersionTokens[0]),\n      versionMinor: parseInt(vsVersionTokens[1]),\n      versionYear: vsYear\n    })\n  }\n\n  function setupExecFixture (finder, fixtureName) {\n    finder.execFile = async (exec, args) => {\n      if (args.length > 2 && args[2].includes('Get-Module')) {\n        return [null, '1.0.0', '']\n      } else if (args.length > 2 && args.at(-1).includes('Get-VSSetupInstance')) {\n        const file = path.join(__dirname, 'fixtures', fixtureName)\n        return [null, fs.readFileSync(file), '']\n      }\n      return [new Error(), '', '']\n    }\n  }\n\n  function allVsVersions (finder) {\n    finder.findVisualStudio2017OrNewerUsingSetupModule = async () => {\n      return null\n    }\n    finder.findVisualStudio2017 = async () => {\n      const data0 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures',\n        'VS_2017_Unusable.txt')))\n      const data1 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures',\n        'VS_2017_BuildTools_minimal.txt')))\n      const data2 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures',\n        'VS_2017_Community_workload.txt')))\n      const data3 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures',\n        'VS_2017_Express.txt')))\n      const data = JSON.stringify(data0.concat(data1, data2, data3))\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2017])\n    }\n    finder.findVisualStudio2019OrNewer = async () => {\n      const data0 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures',\n        'VS_2019_Preview.txt')))\n      const data1 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures',\n        'VS_2019_BuildTools_minimal.txt')))\n      const data2 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures',\n        'VS_2019_Community_workload.txt')))\n      const data3 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures',\n        'VS_2022_Community_workload.txt')))\n      const data = JSON.stringify(data0.concat(data1, data2, data3))\n      const parsedData = finder.parseData(null, data, '', { checkIsArray: true })\n      return finder.processData(parsedData, [2019, 2022, 2026])\n    }\n    finder.regSearchKeys = async (keys, value, addOpts) => {\n      for (let i = 0; i < keys.length; ++i) {\n        const fullName = `${keys[i]}\\\\${value}`\n        switch (fullName) {\n          case 'HKLM\\\\Software\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\14.0':\n          case 'HKLM\\\\Software\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\12.0':\n            continue\n          case 'HKLM\\\\Software\\\\Wow6432Node\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\12.0':\n            return 'C:\\\\VS2013\\\\VC\\\\'\n          case 'HKLM\\\\Software\\\\Microsoft\\\\MSBuild\\\\ToolsVersions\\\\12.0\\\\MSBuildToolsPath':\n            return 'C:\\\\MSBuild12\\\\'\n          case 'HKLM\\\\Software\\\\Wow6432Node\\\\Microsoft\\\\VisualStudio\\\\SxS\\\\VC7\\\\14.0':\n            return 'C:\\\\VS2015\\\\VC\\\\'\n          case 'HKLM\\\\Software\\\\Microsoft\\\\MSBuild\\\\ToolsVersions\\\\14.0\\\\MSBuildToolsPath':\n            return 'C:\\\\MSBuild14\\\\'\n          default:\n            assert.fail(`unexpected search for registry value ${fullName}`)\n        }\n      }\n      throw new Error()\n    }\n  }\n\n  it('fail when looking for invalid path', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, 'AABB')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.ok(/find .* Visual Studio/i.test(err), 'expect error')\n    assert.ok(!info, 'no data')\n  })\n\n  it('look for VS2013 by version number', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, '2013')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.versionYear, 2013)\n  })\n\n  it('look for VS2013 by installation path', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, 'C:\\\\VS2013')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.path, 'C:\\\\VS2013')\n  })\n\n  it('look for VS2015 by version number', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, '2015')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.versionYear, 2015)\n  })\n\n  it('look for VS2015 by installation path', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, 'C:\\\\VS2015')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.path, 'C:\\\\VS2015')\n  })\n\n  it('look for VS2017 by version number', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, '2017')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.versionYear, 2017)\n  })\n\n  it('look for VS2017 by installation path', async function () {\n    const finder = new TestVisualStudioFinder(semverV1,\n      'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\Community')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.path,\n      'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\Community')\n  })\n\n  it('look for VS2019 by version number', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, '2019')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.versionYear, 2019)\n  })\n\n  it('look for VS2019 by installation path', async function () {\n    const finder = new TestVisualStudioFinder(semverV1,\n      'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.path,\n      'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools')\n  })\n\n  it('look for VS2022 by version number', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, '2022')\n\n    finder.msBuildPathExists = (path) => {\n      return true\n    }\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.versionYear, 2022)\n  })\n\n  it('msvs_version match should be case insensitive', async function () {\n    const finder = new TestVisualStudioFinder(semverV1,\n      'c:\\\\program files (x86)\\\\microsoft visual studio\\\\2019\\\\BUILDTOOLS')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.path,\n      'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools')\n  })\n\n  it('latest version should be found by default', async function () {\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    finder.msBuildPathExists = (path) => {\n      return true\n    }\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.versionYear, 2022)\n  })\n\n  it('run on a usable VS Command Prompt', async function () {\n    process.env.VCINSTALLDIR = 'C:\\\\VS2015\\\\VC'\n    // VSINSTALLDIR is not defined on Visual C++ Build Tools 2015\n    delete process.env.VSINSTALLDIR\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.path, 'C:\\\\VS2015')\n  })\n\n  it('VCINSTALLDIR match should be case insensitive', async function () {\n    process.env.VCINSTALLDIR =\n      'c:\\\\program files (x86)\\\\microsoft visual studio\\\\2019\\\\BUILDTOOLS\\\\VC'\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.path,\n      'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools')\n  })\n\n  it('run on a unusable VS Command Prompt', async function () {\n    process.env.VCINSTALLDIR =\n      'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildToolsUnusable\\\\VC'\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.ok(/find .* Visual Studio/i.test(err), 'expect error')\n    assert.ok(!info, 'no data')\n  })\n\n  it('run on a VS Command Prompt with matching msvs_version', async function () {\n    process.env.VCINSTALLDIR = 'C:\\\\VS2015\\\\VC'\n\n    const finder = new TestVisualStudioFinder(semverV1, 'C:\\\\VS2015')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info.path, 'C:\\\\VS2015')\n  })\n\n  it('run on a VS Command Prompt with mismatched msvs_version', async function () {\n    process.env.VCINSTALLDIR =\n      'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools\\\\VC'\n\n    const finder = new TestVisualStudioFinder(semverV1, 'C:\\\\VS2015')\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.ok(/find .* Visual Studio/i.test(err), 'expect error')\n    assert.ok(!info, 'no data')\n  })\n\n  it('run on a portable VS Command Prompt with sufficient environs', async function () {\n    process.env.VCINSTALLDIR = 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community\\\\VC'\n    process.env.VSCMD_VER = '16.0'\n    process.env.WindowsSDKVersion = '10.0.17763.0'\n\n    const finder = new TestVisualStudioFinder(semverV1, null)\n\n    allVsVersions(finder)\n    const { err, info } = await finder.findVisualStudio()\n    assert.strictEqual(err, null)\n    assert.deepStrictEqual(info, {\n      msBuild: 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\' +\n        'Community\\\\MSBuild\\\\Current\\\\Bin\\\\MSBuild.exe',\n      path:\n        'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community',\n      sdk: '10.0.17763.0',\n      toolset: 'v142',\n      // Assume version in the environ is correct.\n      version: '16.0',\n      versionMajor: 16,\n      versionMinor: 0,\n      versionYear: 2019\n    })\n  })\n})\n"
  },
  {
    "path": "test/test-install.js",
    "content": "'use strict'\n\nconst { describe, it, afterEach, beforeEach } = require('mocha')\nconst { rm, mkdtemp } = require('fs/promises')\nconst { createWriteStream } = require('fs')\nconst assert = require('assert')\nconst path = require('path')\nconst os = require('os')\nconst { pipeline: streamPipeline } = require('stream/promises')\nconst requireInject = require('require-inject')\nconst { FULL_TEST, platformTimeout } = require('./common')\nconst gyp = require('../lib/node-gyp')\nconst install = require('../lib/install')\nconst { download } = require('../lib/download')\n\ndescribe('install', function () {\n  it('EACCES retry once', async () => {\n    let statCalled = 0\n    const mockInstall = requireInject('../lib/install', {\n      'graceful-fs': {\n        promises: {\n          stat (_) {\n            const err = new Error()\n            err.code = 'EACCES'\n            statCalled++\n            throw err\n          }\n        }\n      }\n    })\n    const Gyp = {\n      devDir: __dirname,\n      opts: {\n        ensure: true\n      },\n      commands: {\n        install: (...args) => mockInstall(Gyp, ...args),\n        remove: async () => {}\n      }\n    }\n\n    let err\n    try {\n      await Gyp.commands.install([])\n    } catch (e) {\n      err = e\n    }\n\n    assert.ok(err)\n    assert.equal(statCalled, 2)\n    if (/\"pre\" versions of node cannot be installed/.test(err.message)) {\n      assert.ok(true)\n    }\n  })\n\n  describe('parallel', function () {\n    let prog\n\n    beforeEach(async () => {\n      prog = gyp()\n      prog.parseArgv([])\n      prog.devDir = await mkdtemp(path.join(os.tmpdir(), 'node-gyp-test-'))\n    })\n\n    afterEach(async () => {\n      await rm(prog.devDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 1000 })\n      prog = null\n    })\n\n    const runIt = (name, fn) => {\n      // only run these tests if we are running a version of Node with predictable version path behavior\n      if (!FULL_TEST) {\n        return it.skip('Skipping parallel installs test due to test environment configuration')\n      }\n\n      return it(name, async function () {\n        this.timeout(platformTimeout(4, { win32: 20 }))\n        await fn.call(this)\n        const expectedDir = path.join(prog.devDir, process.version.replace(/^v/, ''))\n        await rm(expectedDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 1000 })\n        await Promise.all(new Array(5).fill(0).map(async (_, i) => {\n          const title = `${' '.repeat(8)}${name} ${(i + 1).toString().padEnd(2, ' ')}`\n          console.log(`${title} : Start`)\n          console.time(title)\n          await install(prog, [])\n          console.timeEnd(title)\n        }))\n      })\n    }\n\n    runIt('ensure=true', async function () {\n      prog.opts.ensure = true\n    })\n\n    runIt('ensure=false', async function () {\n      prog.opts.ensure = false\n    })\n\n    runIt('tarball', async function () {\n      prog.opts.tarball = path.join(prog.devDir, 'node-headers.tar.gz')\n      const dl = await download(prog, `https://nodejs.org/dist/${process.version}/node-${process.version}.tar.gz`)\n      await streamPipeline(dl.body, createWriteStream(prog.opts.tarball))\n    })\n  })\n})\n"
  },
  {
    "path": "test/test-options.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst gyp = require('../lib/node-gyp')\nconst log = require('../lib/log')\n\ndescribe('options', function () {\n  it('options in environment', () => {\n    // `npm test` dumps a ton of npm_config_* variables in the environment.\n    Object.keys(process.env)\n      .filter((key) => /^npm_config_/i.test(key) || /^npm_package_config_node_gyp_/i.test(key))\n      .forEach((key) => { delete process.env[key] })\n\n    // in some platforms, certain keys are stubborn and cannot be removed\n    const keys = Object.keys(process.env)\n      .filter((key) => /^npm_config_/i.test(key) || /^npm_package_config_node_gyp_/i.test(key))\n      .map((key) => key.substring('npm_config_'.length))\n\n    // Environment variables with the following prefixes should be added to opts.\n    // - `npm_config_` for npm versions before v11.\n    // - `npm_package_config_node_gyp_` for npm versions 11 and later.\n\n    // Zero-length keys should get filtered out.\n    process.env.npm_config_ = '42'\n    process.env.npm_package_config_node_gyp_ = '42'\n    // Other keys should get added.\n    process.env.npm_package_config_node_gyp_foo = '42'\n    process.env.npm_config_x = '42'\n    process.env.npm_config_y = '41'\n    // Package config should take precedence over npm_config_ keys.\n    process.env.npm_package_config_node_gyp_y = '42'\n    // All configs should be case-insensitive.\n    process.env.NPM_PACKAGE_CONFIG_NODE_GYP_XX = 'value'\n    process.env.NPM_CONFIG_YY = 'value'\n    // loglevel does not get added to opts but will change the logger's level.\n    process.env.npm_config_loglevel = 'silly'\n\n    const g = gyp()\n\n    assert.strictEqual(log.logger.level.id, 'info')\n\n    g.parseArgv(['rebuild']) // Also sets opts.argv.\n\n    assert.strictEqual(log.logger.level.id, 'silly')\n\n    assert.deepStrictEqual(Object.keys(g.opts).sort(), [...keys, 'argv', 'x', 'y', 'foo', 'xx', 'yy'].sort())\n    assert.strictEqual(g.opts['x'], '42')\n    assert.strictEqual(g.opts['y'], '42')\n    assert.strictEqual(g.opts['foo'], '42')\n    assert.strictEqual(g.opts['xx'], 'value')\n    assert.strictEqual(g.opts['yy'], 'value')\n  })\n\n  it('options with spaces in environment', () => {\n    process.env.npm_config_force_process_config = 'true'\n\n    const g = gyp()\n    g.parseArgv(['rebuild']) // Also sets opts.argv.\n\n    assert.strictEqual(g.opts['force-process-config'], 'true')\n  })\n\n  it('options with msvs_version', () => {\n    process.env.npm_config_msvs_version = '2017'\n\n    const g = gyp()\n    g.parseArgv(['rebuild']) // Also sets opts.argv.\n\n    assert.strictEqual(g.opts['msvs-version'], '2017')\n  })\n})\n"
  },
  {
    "path": "test/test-process-release.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst processRelease = require('../lib/process-release')\n\ndescribe('process-release', function () {\n  it('test process release - process.version = 0.8.20', function () {\n    const release = processRelease([], { opts: {} }, 'v0.8.20', null)\n\n    assert.strictEqual(release.semver.version, '0.8.20')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '0.8.20',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/dist/v0.8.20/',\n      tarballUrl: 'https://nodejs.org/dist/v0.8.20/node-v0.8.20.tar.gz',\n      shasumsUrl: 'https://nodejs.org/dist/v0.8.20/SHASUMS256.txt',\n      versionDir: '0.8.20',\n      ia32: { libUrl: 'https://nodejs.org/dist/v0.8.20/node.lib', libPath: 'node.lib' },\n      x64: { libUrl: 'https://nodejs.org/dist/v0.8.20/x64/node.lib', libPath: 'x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/dist/v0.8.20/arm64/node.lib', libPath: 'arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.version = 0.10.21', function () {\n    const release = processRelease([], { opts: {} }, 'v0.10.21', null)\n\n    assert.strictEqual(release.semver.version, '0.10.21')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '0.10.21',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/dist/v0.10.21/',\n      tarballUrl: 'https://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz',\n      shasumsUrl: 'https://nodejs.org/dist/v0.10.21/SHASUMS256.txt',\n      versionDir: '0.10.21',\n      ia32: { libUrl: 'https://nodejs.org/dist/v0.10.21/node.lib', libPath: 'node.lib' },\n      x64: { libUrl: 'https://nodejs.org/dist/v0.10.21/x64/node.lib', libPath: 'x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/dist/v0.10.21/arm64/node.lib', libPath: 'arm64/node.lib' }\n    })\n  })\n\n  // prior to -headers.tar.gz\n  it('test process release - process.version = 0.12.9', function () {\n    const release = processRelease([], { opts: {} }, 'v0.12.9', null)\n\n    assert.strictEqual(release.semver.version, '0.12.9')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '0.12.9',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/dist/v0.12.9/',\n      tarballUrl: 'https://nodejs.org/dist/v0.12.9/node-v0.12.9.tar.gz',\n      shasumsUrl: 'https://nodejs.org/dist/v0.12.9/SHASUMS256.txt',\n      versionDir: '0.12.9',\n      ia32: { libUrl: 'https://nodejs.org/dist/v0.12.9/node.lib', libPath: 'node.lib' },\n      x64: { libUrl: 'https://nodejs.org/dist/v0.12.9/x64/node.lib', libPath: 'x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/dist/v0.12.9/arm64/node.lib', libPath: 'arm64/node.lib' }\n    })\n  })\n\n  // prior to -headers.tar.gz\n  it('test process release - process.version = 0.10.41', function () {\n    const release = processRelease([], { opts: {} }, 'v0.10.41', null)\n\n    assert.strictEqual(release.semver.version, '0.10.41')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '0.10.41',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/dist/v0.10.41/',\n      tarballUrl: 'https://nodejs.org/dist/v0.10.41/node-v0.10.41.tar.gz',\n      shasumsUrl: 'https://nodejs.org/dist/v0.10.41/SHASUMS256.txt',\n      versionDir: '0.10.41',\n      ia32: { libUrl: 'https://nodejs.org/dist/v0.10.41/node.lib', libPath: 'node.lib' },\n      x64: { libUrl: 'https://nodejs.org/dist/v0.10.41/x64/node.lib', libPath: 'x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/dist/v0.10.41/arm64/node.lib', libPath: 'arm64/node.lib' }\n    })\n  })\n\n  // has -headers.tar.gz\n  it('test process release - process.release ~ node@0.10.42', function () {\n    const release = processRelease([], { opts: {} }, 'v0.10.42', null)\n\n    assert.strictEqual(release.semver.version, '0.10.42')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '0.10.42',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/dist/v0.10.42/',\n      tarballUrl: 'https://nodejs.org/dist/v0.10.42/node-v0.10.42-headers.tar.gz',\n      shasumsUrl: 'https://nodejs.org/dist/v0.10.42/SHASUMS256.txt',\n      versionDir: '0.10.42',\n      ia32: { libUrl: 'https://nodejs.org/dist/v0.10.42/node.lib', libPath: 'node.lib' },\n      x64: { libUrl: 'https://nodejs.org/dist/v0.10.42/x64/node.lib', libPath: 'x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/dist/v0.10.42/arm64/node.lib', libPath: 'arm64/node.lib' }\n    })\n  })\n\n  // has -headers.tar.gz\n  it('test process release - process.release ~ node@0.12.10', function () {\n    const release = processRelease([], { opts: {} }, 'v0.12.10', null)\n\n    assert.strictEqual(release.semver.version, '0.12.10')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '0.12.10',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/dist/v0.12.10/',\n      tarballUrl: 'https://nodejs.org/dist/v0.12.10/node-v0.12.10-headers.tar.gz',\n      shasumsUrl: 'https://nodejs.org/dist/v0.12.10/SHASUMS256.txt',\n      versionDir: '0.12.10',\n      ia32: { libUrl: 'https://nodejs.org/dist/v0.12.10/node.lib', libPath: 'node.lib' },\n      x64: { libUrl: 'https://nodejs.org/dist/v0.12.10/x64/node.lib', libPath: 'x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/dist/v0.12.10/arm64/node.lib', libPath: 'arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@4.1.23', function () {\n    const release = processRelease([], { opts: {} }, 'v4.1.23', {\n      name: 'node',\n      headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.1.23')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.1.23',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/dist/v4.1.23/',\n      tarballUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz',\n      shasumsUrl: 'https://nodejs.org/dist/v4.1.23/SHASUMS256.txt',\n      versionDir: '4.1.23',\n      ia32: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@4.1.23 / corp build', function () {\n    const release = processRelease([], { opts: {} }, 'v4.1.23', {\n      name: 'node',\n      headersUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.1.23')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.1.23',\n      name: 'node',\n      baseUrl: 'https://some.custom.location/',\n      tarballUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz',\n      shasumsUrl: 'https://some.custom.location/SHASUMS256.txt',\n      versionDir: '4.1.23',\n      ia32: { libUrl: 'https://some.custom.location/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'https://some.custom.location/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'https://some.custom.location/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@12.8.0 Windows', function () {\n    const release = processRelease([], { opts: {} }, 'v12.8.0', {\n      name: 'node',\n      sourceUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0.tar.gz',\n      headersUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz',\n      libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x64/node.lib'\n    })\n\n    assert.strictEqual(release.semver.version, '12.8.0')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '12.8.0',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/download/release/v12.8.0/',\n      tarballUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz',\n      shasumsUrl: 'https://nodejs.org/download/release/v12.8.0/SHASUMS256.txt',\n      versionDir: '12.8.0',\n      ia32: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@12.8.0 Windows ARM64', function () {\n    const release = processRelease([], { opts: {} }, 'v12.8.0', {\n      name: 'node',\n      sourceUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0.tar.gz',\n      headersUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz',\n      libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-arm64/node.lib'\n    })\n\n    assert.strictEqual(release.semver.version, '12.8.0')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '12.8.0',\n      name: 'node',\n      baseUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/',\n      tarballUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz',\n      shasumsUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/SHASUMS256.txt',\n      versionDir: '12.8.0',\n      ia32: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@4.1.23 --target=0.10.40', function () {\n    const release = processRelease([], { opts: { target: '0.10.40' } }, 'v4.1.23', {\n      name: 'node',\n      headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '0.10.40')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '0.10.40',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/dist/v0.10.40/',\n      tarballUrl: 'https://nodejs.org/dist/v0.10.40/node-v0.10.40.tar.gz',\n      shasumsUrl: 'https://nodejs.org/dist/v0.10.40/SHASUMS256.txt',\n      versionDir: '0.10.40',\n      ia32: { libUrl: 'https://nodejs.org/dist/v0.10.40/node.lib', libPath: 'node.lib' },\n      x64: { libUrl: 'https://nodejs.org/dist/v0.10.40/x64/node.lib', libPath: 'x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/dist/v0.10.40/arm64/node.lib', libPath: 'arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@4.1.23 --dist-url=https://foo.bar/baz', function () {\n    const release = processRelease([], { opts: { 'dist-url': 'https://foo.bar/baz' } }, 'v4.1.23', {\n      name: 'node',\n      headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.1.23')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.1.23',\n      name: 'node',\n      baseUrl: 'https://foo.bar/baz/v4.1.23/',\n      tarballUrl: 'https://foo.bar/baz/v4.1.23/node-v4.1.23-headers.tar.gz',\n      shasumsUrl: 'https://foo.bar/baz/v4.1.23/SHASUMS256.txt',\n      versionDir: '4.1.23',\n      ia32: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'https://foo.bar/baz/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ frankenstein@4.1.23', function () {\n    const release = processRelease([], { opts: {} }, 'v4.1.23', {\n      name: 'frankenstein',\n      headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.1.23')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.1.23',\n      name: 'frankenstein',\n      baseUrl: 'https://frankensteinjs.org/dist/v4.1.23/',\n      tarballUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',\n      shasumsUrl: 'https://frankensteinjs.org/dist/v4.1.23/SHASUMS256.txt',\n      versionDir: 'frankenstein-4.1.23',\n      ia32: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x86/frankenstein.lib', libPath: 'win-x86/frankenstein.lib' },\n      x64: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' },\n      arm64: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-arm64/frankenstein.lib', libPath: 'win-arm64/frankenstein.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ frankenstein@4.1.23 --dist-url=http://foo.bar/baz/', function () {\n    const release = processRelease([], { opts: { 'dist-url': 'http://foo.bar/baz/' } }, 'v4.1.23', {\n      name: 'frankenstein',\n      headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.1.23')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.1.23',\n      name: 'frankenstein',\n      baseUrl: 'http://foo.bar/baz/v4.1.23/',\n      tarballUrl: 'http://foo.bar/baz/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',\n      shasumsUrl: 'http://foo.bar/baz/v4.1.23/SHASUMS256.txt',\n      versionDir: 'frankenstein-4.1.23',\n      ia32: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x86/frankenstein.lib', libPath: 'win-x86/frankenstein.lib' },\n      x64: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' },\n      arm64: { libUrl: 'http://foo.bar/baz/v4.1.23/win-arm64/frankenstein.lib', libPath: 'win-arm64/frankenstein.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@4.0.0-rc.4', function () {\n    const release = processRelease([], { opts: {} }, 'v4.0.0-rc.4', {\n      name: 'node',\n      headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.0.0-rc.4')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.0.0-rc.4',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',\n      tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',\n      shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',\n      versionDir: '4.0.0-rc.4',\n      ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@4.0.0-rc.4 passed as argv[0]', function () {\n  // note the missing 'v' on the arg, it should normalise when checking\n    // whether we're on the default or not\n    const release = processRelease(['4.0.0-rc.4'], { opts: {} }, 'v4.0.0-rc.4', {\n      name: 'node',\n      headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.0.0-rc.4')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.0.0-rc.4',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',\n      tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',\n      shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',\n      versionDir: '4.0.0-rc.4',\n      ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n  })\n\n  it('test process release - process.release ~ node@4.0.0-rc.4 - bogus string passed as argv[0]', function () {\n  // additional arguments can be passed in on the commandline that should be ignored if they\n    // are not specifying a valid version @ position 0\n    const release = processRelease(['this is no version!'], { opts: {} }, 'v4.0.0-rc.4', {\n      name: 'node',\n      headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.0.0-rc.4')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.0.0-rc.4',\n      name: 'node',\n      baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',\n      tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',\n      shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',\n      versionDir: '4.0.0-rc.4',\n      ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n  })\n\n  it('test process release - NODEJS_ORG_MIRROR', function () {\n    process.env.NODEJS_ORG_MIRROR = 'http://foo.bar'\n\n    const release = processRelease([], { opts: {} }, 'v4.1.23', {\n      name: 'node',\n      headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'\n    })\n\n    assert.strictEqual(release.semver.version, '4.1.23')\n    delete release.semver\n\n    assert.deepStrictEqual(release, {\n      version: '4.1.23',\n      name: 'node',\n      baseUrl: 'http://foo.bar/v4.1.23/',\n      tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz',\n      shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt',\n      versionDir: '4.1.23',\n      ia32: { libUrl: 'http://foo.bar/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' },\n      x64: { libUrl: 'http://foo.bar/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' },\n      arm64: { libUrl: 'http://foo.bar/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }\n    })\n\n    delete process.env.NODEJS_ORG_MIRROR\n  })\n})\n"
  },
  {
    "path": "test/test-windows-make.js",
    "content": "'use strict'\n\nconst { describe, it } = require('mocha')\nconst assert = require('assert')\nconst path = require('path')\nconst gracefulFs = require('graceful-fs')\nconst cp = require('child_process')\nconst util = require('../lib/util')\nconst { platformTimeout } = require('./common')\n\nconst addonPath = path.resolve(__dirname, 'node_modules', 'hello_napi')\nconst nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js')\n\nconst execFileSync = (...args) => cp.execFileSync(...args).toString().trim()\n\nconst execFile = async (cmd, env) => {\n  const [err,, stderr] = await util.execFile(process.execPath, cmd, {\n    env: {\n      ...process.env,\n      NODE_GYP_NULL_LOGGER: undefined,\n      ...env\n    },\n    encoding: 'utf-8'\n  })\n  return [err, stderr.toString().trim().split(/\\r?\\n/)]\n}\n\nfunction runHello (hostProcess = process.execPath) {\n  const testCode = \"console.log(require('hello_napi').hello())\"\n  return execFileSync(hostProcess, ['--experimental-wasi-unstable-preview1', '-e', testCode], { cwd: __dirname })\n}\n\nfunction executable (name) {\n  return name + (process.platform === 'win32' ? '.exe' : '')\n}\n\nfunction getEnv (target) {\n  const env = {\n    GYP_CROSSCOMPILE: '1',\n    AR_host: 'ar',\n    CC_host: 'clang',\n    CXX_host: 'clang++'\n  }\n  if (target === 'emscripten') {\n    env.AR_target = 'emar'\n    env.CC_target = 'emcc'\n    env.CXX_target = 'em++'\n  } else if (target === 'wasi') {\n    if (!process.env.WASI_SDK_PATH) return env\n    env.AR_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('ar'))\n    env.CC_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang'))\n    env.CXX_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang++'))\n  } else if (target === 'wasm') {\n    if (!process.env.WASI_SDK_PATH) return env\n    env.AR_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('ar'))\n    env.CC_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang'))\n    env.CXX_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang++'))\n    env.CFLAGS = '--target=wasm32'\n  } else if (target === 'win-clang') {\n    let vsdir = 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise'\n    if (!gracefulFs.existsSync(vsdir)) {\n      vsdir = 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community'\n    }\n    const llvmBin = 'VC\\\\Tools\\\\Llvm\\\\x64\\\\bin'\n    env.AR_target = path.join(vsdir, llvmBin, 'llvm-ar.exe')\n    env.CC_target = path.join(vsdir, llvmBin, 'clang.exe')\n    env.CXX_target = path.join(vsdir, llvmBin, 'clang++.exe')\n    env.CFLAGS = '--target=wasm32'\n  }\n  return env\n}\n\nfunction quote (path) {\n  if (path.includes(' ')) {\n    return `\"${path}\"`\n  }\n  return path\n}\n\ndescribe('windows-cross-compile', function () {\n  it('build simple node-api addon', async function () {\n    if (process.platform !== 'win32') {\n      return this.skip('This test is only for Windows')\n    }\n    const env = getEnv('wasm')\n    if (!gracefulFs.existsSync(env.CC_target)) {\n      return this.skip('CC_target does not exist')\n    }\n\n    // handle bash whitespace\n    env.AR_target = quote(env.AR_target)\n    env.CC_target = quote(env.CC_target)\n    env.CXX_target = quote(env.CXX_target)\n    this.timeout(platformTimeout(1, { win32: 5 }))\n\n    const cmd = [\n      nodeGyp,\n      'rebuild',\n      '-C', addonPath,\n      '--loglevel=verbose',\n      `--nodedir=${addonPath}`,\n      '--arch=wasm32',\n      '--', '-f', 'make'\n    ]\n    const [err, logLines] = await execFile(cmd, env)\n    const lastLine = logLines[logLines.length - 1]\n    assert.strictEqual(err, null)\n    assert.strictEqual(lastLine, 'gyp info ok', 'should end in ok')\n    assert.strictEqual(runHello(), 'world')\n  })\n})\n"
  },
  {
    "path": "update-gyp.py",
    "content": "#!/usr/bin/env python3\n\nimport argparse\nimport os\nimport shutil\nimport subprocess\nimport tarfile\nimport tempfile\nimport urllib.request\n\nBASE_URL = \"https://github.com/nodejs/gyp-next/archive/\"\nCHECKOUT_PATH = os.path.dirname(os.path.realpath(__file__))\nCHECKOUT_GYP_PATH = os.path.join(CHECKOUT_PATH, \"gyp\")\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\n    \"--no-commit\", action=\"store_true\", dest=\"no_commit\", help=\"do not run git-commit\"\n)\nparser.add_argument(\"tag\", help=\"gyp tag to update to\")\nargs = parser.parse_args()\n\ntar_url = BASE_URL + args.tag + \".tar.gz\"\n\nchanged_files = subprocess.check_output([\"git\", \"diff\", \"--name-only\"]).strip()\nif changed_files:\n    raise Exception(\"Can't update gyp while you have uncommitted changes in node-gyp\")\n\nwith tempfile.TemporaryDirectory() as tmp_dir:\n    tar_file = os.path.join(tmp_dir, \"gyp.tar.gz\")\n    unzip_target = os.path.join(tmp_dir, \"gyp\")\n    with open(tar_file, \"wb\") as f:\n        print(\"Downloading gyp-next@\" + args.tag + \" into temporary directory...\")\n        print(\"From: \" + tar_url)\n        with urllib.request.urlopen(tar_url) as in_file:\n            f.write(in_file.read())\n\n        print(\"Unzipping...\")\n        with tarfile.open(tar_file, \"r:gz\") as tar_ref:\n\n            def is_within_directory(directory, target):\n                abs_directory = os.path.abspath(directory)\n                abs_target = os.path.abspath(target)\n\n                prefix = os.path.commonprefix([abs_directory, abs_target])\n\n                return prefix == abs_directory\n\n            def safe_extract(tar, path=\".\", members=None, *, numeric_owner=False):\n                for member in tar.getmembers():\n                    member_path = os.path.join(path, member.name)\n                    if not is_within_directory(path, member_path):\n                        raise Exception(\"Attempted Path Traversal in Tar File\")\n\n                tar.extractall(path, members, numeric_owner=numeric_owner)\n\n            safe_extract(tar_ref, unzip_target)\n\n        print(\"Moving to current checkout (\" + CHECKOUT_PATH + \")...\")\n        if os.path.exists(CHECKOUT_GYP_PATH):\n            shutil.rmtree(CHECKOUT_GYP_PATH)\n        shutil.move(\n            os.path.join(unzip_target, os.listdir(unzip_target)[0]), CHECKOUT_GYP_PATH\n        )\n\nif not args.no_commit:\n    subprocess.check_output([\"git\", \"add\", \"gyp\"], cwd=CHECKOUT_PATH)\n    subprocess.check_output(\n        [\"git\", \"commit\", \"-m\", f\"feat(gyp): update gyp to {args.tag}\"]\n    )\n"
  }
]