diff --git a/.gitignore b/.gitignore index f19d1c8ae0..8c3524b716 100644 --- a/.gitignore +++ b/.gitignore @@ -34,8 +34,7 @@ /util/bot/sde-win32 /util/bot/sde-win32.tar.xz /util/bot/tools -/util/bot/win_toolchain -/util/bot/win_toolchain.json +/util/bot/windows_sdk # Ignore target under any directory. target/ diff --git a/LICENSE b/LICENSE index a0f82a1f8e..37a5b7439b 100644 --- a/LICENSE +++ b/LICENSE @@ -236,37 +236,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -BoringSSL uses the Chromium test infrastructure to run a continuous build, -trybots etc. The scripts which manage this, and the script for generating build -metadata, are under the Chromium license. Distributing code linked against -BoringSSL does not trigger this license. - -Copyright 2015 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/util/bot/DEPS b/util/bot/DEPS index 40aa280c74..c680cdd868 100644 --- a/util/bot/DEPS +++ b/util/bot/DEPS @@ -25,7 +25,6 @@ vars = { 'checkout_nasm': False, 'checkout_libcxx': False, 'checkout_riscv64': False, - 'vs_version': '2022', # Run the following command to see the latest builds in CIPD: # cipd describe PACKAGE_NAME -version latest @@ -39,6 +38,9 @@ vars = { 'go_version': 'version:3@1.24.1', # infra/3pp/tools/perl/windows-amd64 'perl_version': 'version:3@5.38.2.2', + # chrome_internal/third_party/sdk/windows, but if an update switches this to a + # new major VS release, keep some bots at the older version. + 'windows_sdk_version': 'uploaded:2024-01-11', # Update the following from # https://chromium.googlesource.com/chromium/src/+/main/DEPS @@ -150,6 +152,15 @@ deps = { 'dep_type': 'cipd', }, + 'boringssl/util/bot/windows_sdk': { + 'packages': [{ + 'package': 'chrome_internal/third_party/sdk/windows', + 'version': Var('windows_sdk_version'), + }], + 'condition': 'host_os == "win"', + 'dep_type': 'cipd', + }, + 'boringssl/util/bot/tools/clang': { 'url': Var('chromium_git') + '/chromium/src/tools/clang.git' + '@' + Var('tools_clang_revision'), 'condition': 'checkout_clang', @@ -174,16 +185,6 @@ hooks = [ '-s', 'boringssl/util/bot/nasm-win32.exe.sha1', ], }, - { - 'name': 'win_toolchain', - 'pattern': '.', - 'condition': 'host_os == "win"', - 'action': [ 'python3', - 'boringssl/util/bot/vs_toolchain.py', - 'update', - Var('vs_version'), - ], - }, { 'name': 'clang', 'pattern': '.', diff --git a/util/bot/UPDATING b/util/bot/UPDATING index 5a97e488e7..8c0c635665 100644 --- a/util/bot/UPDATING +++ b/util/bot/UPDATING @@ -10,11 +10,6 @@ To update to newer revisions, follow these instructions: DEPS: Update the variables as described in the comments. -vs_toolchain.py: Update _GetDesiredVsToolchainHashes from Chromium, found at - https://chromium.googlesource.com/chromium/src/+/main/build/vs_toolchain.py - This may require taking other updates to that file. (Don't remove MSVC - versions if BoringSSL still needs to support them.) - The .sha1 files correspond to files downloaded from Google Cloud Storage. To update, place the updated files in their intended location and run: diff --git a/util/bot/vs_env.py b/util/bot/vs_env.py index 47f975ac66..9b572eef46 100644 --- a/util/bot/vs_env.py +++ b/util/bot/vs_env.py @@ -12,12 +12,46 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - +import json +import os +import os.path import subprocess import sys -import vs_toolchain +script_dir = os.path.dirname(os.path.realpath(__file__)) +sdk_root = os.path.join(script_dir, 'windows_sdk') + +def SetEnvironmentForCPU(cpu): + """Sets the environment to build with the selected toolchain for |cpu|.""" + assert cpu in ('x86', 'x64', 'arm', 'arm64') + sdk_dir = os.path.join(sdk_root, 'Windows Kits', '10') + os.environ['WINDOWSSDKDIR'] = sdk_dir + # Include the VS runtime in the PATH in case it's not machine-installed. + runtime_dir = {'x86': 'sys32', 'x64': 'sys64', 'arm64': 'sysarm64'} + os.environ['PATH'] = os.path.join(sdk_root, runtime_dir[cpu]) + \ + os.pathsep + os.environ['PATH'] + + # Set up the architecture-specific environment from the SetEnv files. See + # _LoadToolchainEnv() from setup_toolchain.py in Chromium. + with open(os.path.join(sdk_dir, 'bin', 'SetEnv.%s.json' % cpu)) as f: + env = json.load(f)['env'] + if env['VSINSTALLDIR'] == [["..", "..\\"]]: + # Old-style paths were relative to the win_sdk\bin directory. + json_relative_dir = os.path.join(sdk_dir, 'bin') + else: + # New-style paths are relative to the toolchain directory. + json_relative_dir = sdk_root + for k in env: + entries = [os.path.join(*([json_relative_dir] + e)) for e in env[k]] + # clang-cl wants INCLUDE to be ;-separated even on non-Windows, + # lld-link wants LIB to be ;-separated even on non-Windows. Path gets :. + sep = os.pathsep if k == 'PATH' else ';' + env[k] = sep.join(entries) + # PATH is a bit of a special case, it's in addition to the current PATH. + env['PATH'] = env['PATH'] + os.pathsep + os.environ['PATH'] + + for k, v in env.items(): + os.environ[k] = v if len(sys.argv) < 2: print("Usage: vs_env.py TARGET_ARCH CMD...", file=sys.stderr) @@ -26,5 +60,5 @@ if len(sys.argv) < 2: target_arch = sys.argv[1] cmd = sys.argv[2:] -vs_toolchain.SetEnvironmentForCPU(target_arch) +SetEnvironmentForCPU(target_arch) sys.exit(subprocess.call(cmd)) diff --git a/util/bot/vs_toolchain.py b/util/bot/vs_toolchain.py deleted file mode 100644 index 4fb70eac6e..0000000000 --- a/util/bot/vs_toolchain.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -from __future__ import print_function - -import json -import os -import os.path -import subprocess -import sys - - -script_dir = os.path.dirname(os.path.realpath(__file__)) -toolchain_dir = os.path.join(script_dir, 'win_toolchain') -json_data_file = os.path.join(script_dir, 'win_toolchain.json') - - -def SetEnvironmentForCPU(cpu): - """Sets the environment to build with the selected toolchain for |cpu|.""" - with open(json_data_file, 'r') as tempf: - toolchain_data = json.load(tempf) - sdk_dir = toolchain_data['win_sdk'] - os.environ['WINDOWSSDKDIR'] = sdk_dir - os.environ['WDK_DIR'] = toolchain_data['wdk'] - # Include the VS runtime in the PATH in case it's not machine-installed. - vs_runtime_dll_dirs = toolchain_data['runtime_dirs'] - runtime_path = os.pathsep.join(vs_runtime_dll_dirs) - os.environ['PATH'] = runtime_path + os.pathsep + os.environ['PATH'] - - # Set up the architecture-specific environment from the SetEnv files. See - # _LoadToolchainEnv() from setup_toolchain.py in Chromium. - assert cpu in ('x86', 'x64', 'arm', 'arm64') - with open(os.path.join(sdk_dir, 'bin', 'SetEnv.%s.json' % cpu)) as f: - env = json.load(f)['env'] - if env['VSINSTALLDIR'] == [["..", "..\\"]]: - # Old-style paths were relative to the win_sdk\bin directory. - json_relative_dir = os.path.join(sdk_dir, 'bin') - else: - # New-style paths are relative to the toolchain directory. - json_relative_dir = toolchain_data['path'] - for k in env: - entries = [os.path.join(*([json_relative_dir] + e)) for e in env[k]] - # clang-cl wants INCLUDE to be ;-separated even on non-Windows, - # lld-link wants LIB to be ;-separated even on non-Windows. Path gets :. - sep = os.pathsep if k == 'PATH' else ';' - env[k] = sep.join(entries) - # PATH is a bit of a special case, it's in addition to the current PATH. - env['PATH'] = env['PATH'] + os.pathsep + os.environ['PATH'] - - for k, v in env.items(): - os.environ[k] = v - - -def FindDepotTools(): - """Returns the path to depot_tools in $PATH.""" - for path in os.environ['PATH'].split(os.pathsep): - if os.path.isfile(os.path.join(path, 'gclient.py')): - return path - raise Exception("depot_tools not found!") - - -def _GetDesiredVsToolchainHashes(version): - """Load a list of SHA1s corresponding to the toolchains that we want installed - to build with.""" - if version == '2022': - # VS 2022 17.9.2 with 10.0.22621.2428 SDK with ARM64 libraries and UWP - # support. - return ['7393122652'] - raise Exception('Unsupported VS version %s' % version) - - -def Update(version): - """Requests an update of the toolchain to the specific hashes we have at - this revision. The update outputs a .json of the various configuration - information required to pass to vs_env.py which we use in - |SetEnvironmentForCPU()|. - """ - depot_tools_path = FindDepotTools() - get_toolchain_args = [ - sys.executable, - os.path.join(depot_tools_path, - 'win_toolchain', - 'get_toolchain_if_necessary.py'), - '--output-json', json_data_file, - '--toolchain-dir', toolchain_dir, - ] + _GetDesiredVsToolchainHashes(version) - subprocess.check_call(get_toolchain_args) - return 0 - - -def main(): - if not sys.platform.startswith(('win32', 'cygwin')): - return 0 - commands = { - 'update': Update, - } - if len(sys.argv) < 2 or sys.argv[1] not in commands: - print('Expected one of: %s' % ', '.join(commands), file=sys.stderr) - return 1 - return commands[sys.argv[1]](*sys.argv[2:]) - - -if __name__ == '__main__': - sys.exit(main())