mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	automate-git: Remove support for branches older than 3071.
3071 and newer branches use Git and GN exclusively.
This commit is contained in:
		| @@ -272,68 +272,29 @@ def write_branch_config_file(path, branch): | |||||||
|     write_config_file(config_file, {'branch': branch}) |     write_config_file(config_file, {'branch': branch}) | ||||||
|  |  | ||||||
|  |  | ||||||
| def remove_deps_entry(path, entry): | def apply_patch(name): | ||||||
|   """ Remove an entry from the Chromium DEPS file at the specified path. """ |   patch_file = os.path.join(cef_dir, 'patch', 'patches', name) | ||||||
|   msg('Updating DEPS file: %s' % path) |  | ||||||
|   if not options.dryrun: |  | ||||||
|     # Read the DEPS file. |  | ||||||
|     with open(path, 'r', encoding='utf-8') as fp: |  | ||||||
|       lines = fp.readlines() |  | ||||||
|  |  | ||||||
|     # Write the DEPS file. |  | ||||||
|     # Each entry takes 2 lines. Skip both lines if found. |  | ||||||
|     with open(path, 'w', encoding='utf-8') as fp: |  | ||||||
|       skip_next = False |  | ||||||
|       for line in lines: |  | ||||||
|         if skip_next: |  | ||||||
|           skip_next = False |  | ||||||
|           continue |  | ||||||
|         elif line.find(entry) >= 0: |  | ||||||
|           skip_next = True |  | ||||||
|           continue |  | ||||||
|         write_fp(fp, line) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def apply_deps_patch(): |  | ||||||
|   """ Patch the Chromium DEPS file before `gclient sync` if necessary. """ |  | ||||||
|   # Starting with 43.0.2357.126 the DEPS file is now 100% Git and the .DEPS.git |  | ||||||
|   # file is no longer created. Look for the older file first in case we're |  | ||||||
|   # building an older branch version. |  | ||||||
|   deps_file = '.DEPS.git' |  | ||||||
|   deps_path = os.path.join(chromium_src_dir, deps_file) |  | ||||||
|   if not os.path.isfile(deps_path): |  | ||||||
|     deps_file = 'DEPS' |  | ||||||
|     deps_path = os.path.join(chromium_src_dir, deps_file) |  | ||||||
|  |  | ||||||
|   if os.path.isfile(deps_path): |  | ||||||
|     msg("Chromium DEPS file: %s" % (deps_path)) |  | ||||||
|     patch_file = os.path.join(cef_dir, 'patch', 'patches', deps_file) |  | ||||||
|   if os.path.exists(patch_file + ".patch"): |   if os.path.exists(patch_file + ".patch"): | ||||||
|       if branch_is_3029_or_older: |     # Attempt to apply the patch file. | ||||||
|         patch_file = patch_file + ".patch" |  | ||||||
|       # Attempt to apply the DEPS patch file that may exist with newer branches. |  | ||||||
|     patch_tool = os.path.join(cef_dir, 'tools', 'patcher.py') |     patch_tool = os.path.join(cef_dir, 'tools', 'patcher.py') | ||||||
|     run('%s %s --patch-file "%s" --patch-dir "%s"' % |     run('%s %s --patch-file "%s" --patch-dir "%s"' % | ||||||
|         (python_exe, patch_tool, patch_file, |         (python_exe, patch_tool, patch_file, | ||||||
|          chromium_src_dir), chromium_src_dir, depot_tools_dir) |          chromium_src_dir), chromium_src_dir, depot_tools_dir) | ||||||
|     elif cef_branch != 'trunk' and int(cef_branch) <= 1916: |  | ||||||
|       # Release branch DEPS files older than 37.0.2007.0 may include a 'src' |  | ||||||
|       # entry. This entry needs to be removed otherwise `gclient sync` will | def apply_deps_patch(): | ||||||
|       # fail. |   """ Patch the Chromium DEPS file before `gclient sync` if necessary. """ | ||||||
|       remove_deps_entry(deps_path, "'src'") |   deps_path = os.path.join(chromium_src_dir, deps_file) | ||||||
|  |   if os.path.isfile(deps_path): | ||||||
|  |     msg("Chromium DEPS file: %s" % (deps_path)) | ||||||
|  |     apply_patch(deps_file) | ||||||
|   else: |   else: | ||||||
|     raise Exception("Path does not exist: %s" % (deps_path)) |     raise Exception("Path does not exist: %s" % (deps_path)) | ||||||
|  |  | ||||||
|  |  | ||||||
| def apply_runhooks_patch(): | def apply_runhooks_patch(): | ||||||
|   """ Patch the Chromium runhooks files before `gclient runhooks` if necessary. """ |   """ Patch the Chromium runhooks files before `gclient runhooks` if necessary. """ | ||||||
|   patch_file = os.path.join(cef_dir, 'patch', 'patches', 'runhooks') |   apply_patch('runhooks') | ||||||
|   if os.path.exists(patch_file + ".patch"): |  | ||||||
|     # Attempt to apply the runhooks patch file. |  | ||||||
|     patch_tool = os.path.join(cef_dir, 'tools', 'patcher.py') |  | ||||||
|     run('%s %s --patch-file "%s" --patch-dir "%s"' % |  | ||||||
|         (python_exe, patch_tool, patch_file, |  | ||||||
|          chromium_src_dir), chromium_src_dir, depot_tools_dir) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def run_patch_updater(args='', output_file=None): | def run_patch_updater(args='', output_file=None): | ||||||
| @@ -518,7 +479,7 @@ def get_chromium_target_version(os='win', channel='canary', target_distance=0): | |||||||
|  |  | ||||||
| def get_build_directory_name(is_debug): | def get_build_directory_name(is_debug): | ||||||
|   build_dir = ('Debug' if is_debug else 'Release') + '_' |   build_dir = ('Debug' if is_debug else 'Release') + '_' | ||||||
|   if use_gn: |  | ||||||
|   # CEF uses a consistent directory naming scheme for GN via |   # CEF uses a consistent directory naming scheme for GN via | ||||||
|   # GetAllPlatformConfigs in tools/gn_args.py. |   # GetAllPlatformConfigs in tools/gn_args.py. | ||||||
|   if options.x64build: |   if options.x64build: | ||||||
| @@ -529,11 +490,6 @@ def get_build_directory_name(is_debug): | |||||||
|     build_dir += 'GN_arm64' |     build_dir += 'GN_arm64' | ||||||
|   else: |   else: | ||||||
|     build_dir += 'GN_x86' |     build_dir += 'GN_x86' | ||||||
|   else: |  | ||||||
|     # GYP outputs both x86 and x64 builds to the same directory on Linux and |  | ||||||
|     # Mac OS X. On Windows it suffixes the directory name for x64 builds. |  | ||||||
|     if platform == 'windows' and options.x64build: |  | ||||||
|       build_dir += 'x64' |  | ||||||
|   return build_dir |   return build_dir | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -666,11 +622,11 @@ parser.add_option('--depot-tools-archive', dest='depottoolsarchive', | |||||||
|                   help='Zip archive file that contains a single top-level '+\ |                   help='Zip archive file that contains a single top-level '+\ | ||||||
|                        'depot_tools directory.', default='') |                        'depot_tools directory.', default='') | ||||||
| parser.add_option('--branch', dest='branch', | parser.add_option('--branch', dest='branch', | ||||||
|                   help='Branch of CEF to build (trunk, 1916, ...). This '+\ |                   help='Branch of CEF to build (master, 3987, ...). This '+\ | ||||||
|                        'will be used to name the CEF download directory and '+\ |                        'will be used to name the CEF download directory and '+\ | ||||||
|                        'to identify the correct URL if --url is not '+\ |                        'to identify the correct URL if --url is not '+\ | ||||||
|                        'specified. The default value is trunk.', |                        'specified. The default value is master.', | ||||||
|                   default='trunk') |                   default='master') | ||||||
| parser.add_option('--url', dest='url', | parser.add_option('--url', dest='url', | ||||||
|                   help='CEF download URL. If not specified the default URL '+\ |                   help='CEF download URL. If not specified the default URL '+\ | ||||||
|                        'will be used.', |                        'will be used.', | ||||||
| @@ -1032,43 +988,26 @@ if options.clientdistrib or options.clientdistribonly: | |||||||
|     sys.exit() |     sys.exit() | ||||||
|  |  | ||||||
| # CEF branch. | # CEF branch. | ||||||
| if options.branch != 'trunk' and not options.branch.isdigit(): |  | ||||||
|   print('Invalid branch value: %s' % (options.branch)) |  | ||||||
|   sys.exit() |  | ||||||
|  |  | ||||||
| cef_branch = options.branch | cef_branch = options.branch | ||||||
|  |  | ||||||
| if cef_branch != 'trunk' and int(cef_branch) <= 1453: | branch_is_master = (cef_branch == 'master' or cef_branch == 'trunk') | ||||||
|   print('The requested branch is too old to build using this tool.') | if not branch_is_master: | ||||||
|  |   # Verify that the branch value is numeric. | ||||||
|  |   if not cef_branch.isdigit(): | ||||||
|  |     print('Invalid branch value: %s' % cef_branch) | ||||||
|     sys.exit() |     sys.exit() | ||||||
|  |  | ||||||
| # True if the requested branch is 2272 or newer. |   # Verify the minimum supported branch number. | ||||||
| branch_is_2272_or_newer = (cef_branch == 'trunk' or int(cef_branch) >= 2272) |   if int(cef_branch) < 3071: | ||||||
|  |     print('The requested branch (%s) is too old to build using this tool. ' + | ||||||
|  |           'The minimum supported branch is 3071.' % cef_branch) | ||||||
|  |     sys.exit() | ||||||
|  |  | ||||||
| # True if the requested branch is 2357 or newer. | # True if the requested branch is 3538 or newer. | ||||||
| branch_is_2357_or_newer = (cef_branch == 'trunk' or int(cef_branch) >= 2357) | branch_is_3538_or_newer = (branch_is_master or int(cef_branch) >= 3538) | ||||||
|  |  | ||||||
| # True if the requested branch is 2743 or older. |  | ||||||
| branch_is_2743_or_older = (cef_branch != 'trunk' and int(cef_branch) <= 2743) |  | ||||||
|  |  | ||||||
| # True if the requested branch is newer than 2785. |  | ||||||
| branch_is_newer_than_2785 = (cef_branch == 'trunk' or int(cef_branch) > 2785) |  | ||||||
|  |  | ||||||
| # True if the requested branch is newer than 2840. |  | ||||||
| branch_is_newer_than_2840 = (cef_branch == 'trunk' or int(cef_branch) > 2840) |  | ||||||
|  |  | ||||||
| # True if the requested branch is 3029 or older. |  | ||||||
| branch_is_3029_or_older = (cef_branch != 'trunk' and int(cef_branch) <= 3029) |  | ||||||
|  |  | ||||||
| # True if the requested branch is newer than 3497. |  | ||||||
| branch_is_newer_than_3497 = (cef_branch == 'trunk' or int(cef_branch) > 3497) |  | ||||||
|  |  | ||||||
| # True if the requested branch is 3945 or newer. | # True if the requested branch is 3945 or newer. | ||||||
| branch_is_3945_or_newer = (cef_branch == 'trunk' or int(cef_branch) >= 3945) | branch_is_3945_or_newer = (branch_is_master or int(cef_branch) >= 3945) | ||||||
|  |  | ||||||
| # Enable GN by default for branches newer than 2785. |  | ||||||
| if branch_is_newer_than_2785 and not 'CEF_USE_GN' in os.environ.keys(): |  | ||||||
|   os.environ['CEF_USE_GN'] = '1' |  | ||||||
|  |  | ||||||
| # Enable Python 3 usage in Chromium for branches 3945 and newer. | # Enable Python 3 usage in Chromium for branches 3945 and newer. | ||||||
| if branch_is_3945_or_newer and not is_python2 and \ | if branch_is_3945_or_newer and not is_python2 and \ | ||||||
| @@ -1081,64 +1020,26 @@ if not branch_is_3945_or_newer and \ | |||||||
|         '(set GCLIENT_PY3=0 and run with Python 2 executable).') |         '(set GCLIENT_PY3=0 and run with Python 2 executable).') | ||||||
|   sys.exit() |   sys.exit() | ||||||
|  |  | ||||||
| # Whether to use GN or GYP. GYP is currently the default for older branches. |  | ||||||
| use_gn = bool(int(os.environ.get('CEF_USE_GN', '0'))) |  | ||||||
| if use_gn: |  | ||||||
|   if branch_is_2743_or_older: |  | ||||||
|     print('GN is not supported with branch 2743 and older (set CEF_USE_GN=0).') |  | ||||||
|     sys.exit() |  | ||||||
|  |  | ||||||
| if options.armbuild: | if options.armbuild: | ||||||
|   if platform != 'linux': |   if platform != 'linux': | ||||||
|     print('The ARM build option is only supported on Linux.') |     print('The ARM build option is only supported on Linux.') | ||||||
|     sys.exit() |     sys.exit() | ||||||
|  |  | ||||||
|     if not branch_is_newer_than_2785: |  | ||||||
|       print('The ARM build option is not supported with branch 2785 and older.') |  | ||||||
|       sys.exit() |  | ||||||
|  |  | ||||||
| if options.arm64build: | if options.arm64build: | ||||||
|   if platform != 'linux' and platform != 'windows': |   if platform != 'linux' and platform != 'windows': | ||||||
|     print('The ARM64 build option is only supported on Linux and Windows.') |     print('The ARM64 build option is only supported on Linux and Windows.') | ||||||
|     sys.exit() |     sys.exit() | ||||||
|  |  | ||||||
|     if not branch_is_newer_than_2840: |  | ||||||
|       print('The ARM build option is not supported with branch 2840 and older.') |  | ||||||
|       sys.exit() |  | ||||||
|  |  | ||||||
| else: |  | ||||||
|   if options.armbuild or options.arm64build: |  | ||||||
|     print('The ARM build option is not supported by GYP.') |  | ||||||
|     sys.exit() |  | ||||||
|  |  | ||||||
|   if options.x64build and platform != 'windows' and platform != 'macosx': |  | ||||||
|     print('The x64 build option is only used on Windows and Mac OS X.') |  | ||||||
|     sys.exit() |  | ||||||
|  |  | ||||||
|   if platform == 'windows' and not 'GYP_MSVS_VERSION' in os.environ.keys(): |  | ||||||
|     print('You must set the GYP_MSVS_VERSION environment variable on Windows.') |  | ||||||
|     sys.exit() |  | ||||||
|  |  | ||||||
|   # True if GYP_DEFINES=target_arch=x64 must be set. |  | ||||||
|   gyp_needs_target_arch_x64 = options.x64build and \ |  | ||||||
|     (platform == 'windows' or \ |  | ||||||
|       (platform == 'macosx' and not branch_is_2272_or_newer)) |  | ||||||
|  |  | ||||||
| # Starting with 43.0.2357.126 the DEPS file is now 100% Git and the .DEPS.git |  | ||||||
| # file is no longer created. |  | ||||||
| if branch_is_2357_or_newer: |  | ||||||
| deps_file = 'DEPS' | deps_file = 'DEPS' | ||||||
| else: |  | ||||||
|   deps_file = '.DEPS.git' |  | ||||||
|  |  | ||||||
| if platform == 'macosx' and not options.x64build and branch_is_2272_or_newer: | if platform == 'macosx' and not options.x64build: | ||||||
|   print('32-bit Mac OS X builds are no longer supported with 2272 branch and ' + |   print('32-bit Mac OS X builds are not supported. ' + | ||||||
|         'newer. Add --x64-build flag to generate a 64-bit build.') |         'Add --x64-build flag to generate a 64-bit build.') | ||||||
|   sys.exit() |   sys.exit() | ||||||
|  |  | ||||||
| # Platforms that build a cef_sandbox library. | # Platforms that build a cef_sandbox library. | ||||||
| sandbox_lib_platforms = ['windows'] | sandbox_lib_platforms = ['windows'] | ||||||
| if branch_is_newer_than_3497: | if branch_is_3538_or_newer: | ||||||
|   sandbox_lib_platforms.append('macosx') |   sandbox_lib_platforms.append('macosx') | ||||||
|  |  | ||||||
| if not platform in sandbox_lib_platforms and (options.sandboxdistrib or | if not platform in sandbox_lib_platforms and (options.sandboxdistrib or | ||||||
| @@ -1268,7 +1169,7 @@ msg("CEF Source Directory: %s" % (cef_dir)) | |||||||
| # Determine the CEF Git branch to use. | # Determine the CEF Git branch to use. | ||||||
| if options.checkout == '': | if options.checkout == '': | ||||||
|   # Target the most recent branch commit from the remote repo. |   # Target the most recent branch commit from the remote repo. | ||||||
|   if cef_branch == 'trunk': |   if branch_is_master: | ||||||
|     cef_checkout = 'origin/master' |     cef_checkout = 'origin/master' | ||||||
|   else: |   else: | ||||||
|     cef_checkout = 'origin/' + cef_branch |     cef_checkout = 'origin/' + cef_branch | ||||||
| @@ -1458,10 +1359,6 @@ if chromium_checkout_changed: | |||||||
|   # Patch the Chromium DEPS file if necessary. |   # Patch the Chromium DEPS file if necessary. | ||||||
|   apply_deps_patch() |   apply_deps_patch() | ||||||
|  |  | ||||||
|   # Set the GYP_CHROMIUM_NO_ACTION value temporarily so that `gclient sync` does |  | ||||||
|   # not run gyp. |  | ||||||
|   os.environ['GYP_CHROMIUM_NO_ACTION'] = '1' |  | ||||||
|  |  | ||||||
|   # Update third-party dependencies including branch/tag information. |   # Update third-party dependencies including branch/tag information. | ||||||
|   run("gclient sync %s--nohooks --with_branch_heads --jobs 16" % \ |   run("gclient sync %s--nohooks --with_branch_heads --jobs 16" % \ | ||||||
|       ('--reset ' if discard_local_changes else ''), chromium_dir, depot_tools_dir) |       ('--reset ' if discard_local_changes else ''), chromium_dir, depot_tools_dir) | ||||||
| @@ -1472,9 +1369,6 @@ if chromium_checkout_changed: | |||||||
|   # Runs hooks for files that have been modified in the local working copy. |   # Runs hooks for files that have been modified in the local working copy. | ||||||
|   run("gclient runhooks --jobs 16", chromium_dir, depot_tools_dir) |   run("gclient runhooks --jobs 16", chromium_dir, depot_tools_dir) | ||||||
|  |  | ||||||
|   # Clear the GYP_CHROMIUM_NO_ACTION value. |  | ||||||
|   del os.environ['GYP_CHROMIUM_NO_ACTION'] |  | ||||||
|  |  | ||||||
|   # Delete the src/out directory created by `gclient sync`. |   # Delete the src/out directory created by `gclient sync`. | ||||||
|   delete_directory(out_src_dir) |   delete_directory(out_src_dir) | ||||||
|  |  | ||||||
| @@ -1535,25 +1429,10 @@ if not options.nobuild and (chromium_checkout_changed or \ | |||||||
|   # Building should also force a distribution. |   # Building should also force a distribution. | ||||||
|   options.forcedistrib = True |   options.forcedistrib = True | ||||||
|  |  | ||||||
|   if use_gn: |  | ||||||
|   # Make sure the GN configuration exists. |   # Make sure the GN configuration exists. | ||||||
|   if not options.dryrun and \ |   if not options.dryrun and \ | ||||||
|     not os.path.exists(os.path.join(cef_src_dir, 'BUILD.gn')): |     not os.path.exists(os.path.join(cef_src_dir, 'BUILD.gn')): | ||||||
|       raise Exception('GN configuration does not exist; set CEF_USE_GN=0') |     raise Exception('GN configuration does not exist.') | ||||||
|   else: |  | ||||||
|     # Make sure the GYP configuration exists. |  | ||||||
|     if not options.dryrun and \ |  | ||||||
|       not os.path.exists(os.path.join(cef_src_dir, 'cef.gyp')): |  | ||||||
|       raise Exception('GYP configuration does not exist; set CEF_USE_GN=1') |  | ||||||
|  |  | ||||||
|     # Set GYP environment variables. |  | ||||||
|     os.environ['GYP_GENERATORS'] = 'ninja' |  | ||||||
|     if gyp_needs_target_arch_x64: |  | ||||||
|       if 'GYP_DEFINES' in os.environ.keys(): |  | ||||||
|         os.environ['GYP_DEFINES'] = os.environ['GYP_DEFINES'] + ' ' + \ |  | ||||||
|                                     'target_arch=x64' |  | ||||||
|       else: |  | ||||||
|         os.environ['GYP_DEFINES'] = 'target_arch=x64' |  | ||||||
|  |  | ||||||
|   # Print all build-related environment variables including any that were set |   # Print all build-related environment variables including any that were set | ||||||
|   # previously. |   # previously. | ||||||
| @@ -1583,7 +1462,6 @@ if not options.nobuild and (chromium_checkout_changed or \ | |||||||
|   # Make a CEF Debug build. |   # Make a CEF Debug build. | ||||||
|   if not options.nodebugbuild: |   if not options.nodebugbuild: | ||||||
|     build_path = os.path.join('out', get_build_directory_name(True)) |     build_path = os.path.join('out', get_build_directory_name(True)) | ||||||
|     if use_gn: |  | ||||||
|     args_path = os.path.join(chromium_src_dir, build_path, 'args.gn') |     args_path = os.path.join(chromium_src_dir, build_path, 'args.gn') | ||||||
|     msg(args_path + ' contents:\n' + read_file(args_path)) |     msg(args_path + ' contents:\n' + read_file(args_path)) | ||||||
|  |  | ||||||
| @@ -1591,7 +1469,7 @@ if not options.nobuild and (chromium_checkout_changed or \ | |||||||
|         os.path.join(download_dir, 'build-%s-debug.log' % (cef_branch)) \ |         os.path.join(download_dir, 'build-%s-debug.log' % (cef_branch)) \ | ||||||
|           if options.buildlogfile else None) |           if options.buildlogfile else None) | ||||||
|  |  | ||||||
|     if use_gn and platform in sandbox_lib_platforms: |     if platform in sandbox_lib_platforms: | ||||||
|       # Make the separate cef_sandbox build when GN is_official_build=true. |       # Make the separate cef_sandbox build when GN is_official_build=true. | ||||||
|       build_path += '_sandbox' |       build_path += '_sandbox' | ||||||
|       if os.path.exists(os.path.join(chromium_src_dir, build_path)): |       if os.path.exists(os.path.join(chromium_src_dir, build_path)): | ||||||
| @@ -1605,7 +1483,6 @@ if not options.nobuild and (chromium_checkout_changed or \ | |||||||
|   # Make a CEF Release build. |   # Make a CEF Release build. | ||||||
|   if not options.noreleasebuild: |   if not options.noreleasebuild: | ||||||
|     build_path = os.path.join('out', get_build_directory_name(False)) |     build_path = os.path.join('out', get_build_directory_name(False)) | ||||||
|     if use_gn: |  | ||||||
|     args_path = os.path.join(chromium_src_dir, build_path, 'args.gn') |     args_path = os.path.join(chromium_src_dir, build_path, 'args.gn') | ||||||
|     msg(args_path + ' contents:\n' + read_file(args_path)) |     msg(args_path + ' contents:\n' + read_file(args_path)) | ||||||
|  |  | ||||||
| @@ -1613,7 +1490,7 @@ if not options.nobuild and (chromium_checkout_changed or \ | |||||||
|         os.path.join(download_dir, 'build-%s-release.log' % (cef_branch)) \ |         os.path.join(download_dir, 'build-%s-release.log' % (cef_branch)) \ | ||||||
|           if options.buildlogfile else None) |           if options.buildlogfile else None) | ||||||
|  |  | ||||||
|     if use_gn and platform in sandbox_lib_platforms: |     if platform in sandbox_lib_platforms: | ||||||
|       # Make the separate cef_sandbox build when GN is_official_build=true. |       # Make the separate cef_sandbox build when GN is_official_build=true. | ||||||
|       build_path += '_sandbox' |       build_path += '_sandbox' | ||||||
|       if os.path.exists(os.path.join(chromium_src_dir, build_path)): |       if os.path.exists(os.path.join(chromium_src_dir, build_path)): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user