def MakeVersionString(quiet, no_git_hash, custom_for_pub=None): channel = utils.GetChannel() if custom_for_pub and channel == 'be': latest = utils.GetLatestDevTag() if not latest: # If grabbing the dev tag fails, then fall back on the VERSION file. latest = utils.GetSemanticSDKVersion(no_git_hash=True) if no_git_hash: version_string = ("%s.%s" % (latest, custom_for_pub)) else: git_hash = utils.GetShortGitHash() version_string = ("%s.%s-%s" % (latest, custom_for_pub, git_hash)) # TODO(athom): remove the custom 2.7.0 logic post release. # For 2.7.0, we want flutter to claim Dart is 2.7.0 even before it is # decided what exactly 2.7.0 will be. Dart & Flutter stable releases # will be synced, so that what will be released as Dart 2.7.0 will also # be what will be packaged with Flutter. version = utils.ReadVersionFile() custom_version_string = "%s.%s.%s" % (version.major, version.minor, version.patch) if custom_version_string == "2.7.0" and custom_for_pub == "flutter": version_string = "2.7.0" else: version_string = utils.GetSemanticSDKVersion(no_git_hash=no_git_hash) if not quiet: debugLog("Returning version string: %s " % version_string) return version_string
def Main(): parser = argparse.ArgumentParser() parser.add_argument( '--fail-loudly', action='store_true', default=False, help= "Return an error code if a prebuilt couldn't be fetched and extracted") args = parser.parse_args() fail_loudly = 1 if args.fail_loudly else 0 prebuilt_enabled = os.environ.get(FLUTTER_PREBUILTS_ENV_VAR, 'false') if prebuilt_enabled == '0' or prebuilt_enabled.lower() == 'false': return 0 os.makedirs(FLUTTER_PREBUILTS_DIR, exist_ok=True) # Read //third_party/dart/tools/VERSION to extract information about the # Dart SDK version. version = utils.ReadVersionFile() if version == None: return fail_loudly channel = version.channel # A short Dart SDK version string used in the download url. if channel == 'be': dart_git_rev = utils.GetGitRevision() semantic_version = 'hash/{}'.format(dart_git_rev) semantic_version = utils.GetSemanticSDKVersion() os_name = GuessOS() if os_name == None: return fail_loudly architectures = ArchitecturesForOS(os_name) if architectures == None: return fail_loudly # Download and extract variants in parallel pool = multiprocessing.Pool() tasks = [(channel, semantic_version, os_name, arch) for arch in architectures] async_results = [pool.apply_async(DownloadAndExtract, t) for t in tasks] success = True for async_result in async_results: result = async_result.get() success = success and (result == 0) return 0 if success else fail_loudly
def Main(): parser = argparse.ArgumentParser() parser.add_argument( '--fail-loudly', action='store_true', default=False, help= "Return an error code if a prebuilt couldn't be fetched and extracted") parser.add_argument('--verbose', action='store_true', default='LUCI_CONTEXT' in os.environ, help='Emit verbose output') args = parser.parse_args() fail_loudly = 1 if args.fail_loudly else 0 verbose = args.verbose prebuilt_enabled = os.environ.get(FLUTTER_PREBUILTS_ENV_VAR, 'true') if prebuilt_enabled == '0' or prebuilt_enabled.lower() == 'false': if verbose: print('Skipping prebuild Dart SDK download.') return 0 os.makedirs(FLUTTER_PREBUILTS_DIR, exist_ok=True) # Read //third_party/dart/tools/VERSION to extract information about the # Dart SDK version. version = utils.ReadVersionFile() if version == None: eprint('Failed to read the Dart VERSION file.') return fail_loudly channel = version.channel if verbose: print('Dart SDK channel = "%s".' % channel) # A short Dart SDK version string used in the download url. if channel == 'be': dart_git_rev = utils.GetGitRevision() semantic_version = 'hash/{}'.format(dart_git_rev) else: semantic_version = utils.GetSemanticSDKVersion() if verbose: print('Semantic Dart SDK version = "%s".' % semantic_version) os_name = GuessOS() if os_name == None: return fail_loudly architectures = ArchitecturesForOS(os_name) if architectures == None: return fail_loudly # Work around a bug in Python. # # The multiprocessing package relies on the win32 WaitForMultipleObjects() # call, which supports waiting on a maximum of MAXIMUM_WAIT_OBJECTS (defined # by Windows to be 64) handles, processes in this case. To avoid hitting # this, we limit ourselves to 60 handles (since there are a couple extra # processes launched for the queue reader and thread wakeup reader). # # See: https://bugs.python.org/issue26903 max_processes = os.cpu_count() if sys.platform.startswith(('cygwin', 'win')) and max_processes > 60: max_processes = 60 # Download and extract variants in parallel pool = multiprocessing.Pool(processes=max_processes) tasks = [(channel, semantic_version, os_name, arch, verbose) for arch in architectures] async_results = [pool.apply_async(DownloadAndExtract, t) for t in tasks] success = True for async_result in async_results: result = async_result.get() success = success and (result == 0) return 0 if success else fail_loudly