コード例 #1
0
def MakeFile(quiet,
             output_file,
             input_file,
             no_git_hash,
             custom_for_pub,
             version_file=None):
    if version_file:
        version_string = utils.GetVersion(no_git_hash, version_file)
    else:
        version_string = MakeVersionString(quiet, no_git_hash, custom_for_pub)

    version_cc_text = open(input_file).read()
    version_cc_text = version_cc_text.replace("{{VERSION_STR}}",
                                              version_string)
    channel = utils.GetChannel()
    version_cc_text = version_cc_text.replace("{{CHANNEL}}", channel)
    version_time = utils.GetGitTimestamp()
    if no_git_hash or version_time == None:
        version_time = "Unknown timestamp"
    version_cc_text = version_cc_text.replace("{{COMMIT_TIME}}",
                                              version_time.decode("utf-8"))
    abi_version = utils.GetAbiVersion(version_file)
    version_cc_text = version_cc_text.replace("{{ABI_VERSION}}", abi_version)
    oldest_supported_abi_version = utils.GetOldestSupportedAbiVersion(
        version_file)
    version_cc_text = version_cc_text.replace(
        "{{OLDEST_SUPPORTED_ABI_VERSION}}", oldest_supported_abi_version)
    snapshot_hash = MakeSnapshotHashString()
    version_cc_text = version_cc_text.replace("{{SNAPSHOT_HASH}}",
                                              snapshot_hash)
    open(output_file, 'w').write(version_cc_text)
    return True
コード例 #2
0
def FormatVersionString(version,
                        no_git_hash,
                        custom_for_pub,
                        version_file=None,
                        git_revision_file=None):
    use_git_hash = not no_git_hash

    semantic_sdk_version = utils.GetSemanticSDKVersion(no_git_hash,
                                                       version_file,
                                                       git_revision_file)
    semantic_version_format = GetSemanticVersionFormat(no_git_hash,
                                                       custom_for_pub)
    version_str = (semantic_sdk_version
                   if version_file else semantic_version_format)

    version = version.replace('{{VERSION_STR}}', version_str)

    version = version.replace('{{SEMANTIC_SDK_VERSION}}', semantic_sdk_version)

    if custom_for_pub:
        # LATEST is only used for custom_for_pub.
        latest = None
        if use_git_hash:
            # If grabbing the dev tag fails, then fall back on the default VERSION file.
            latest = utils.GetLatestDevTag()
        if not latest:
            latest = utils.GetSemanticSDKVersion(no_git_hash=True)
        version = version.replace('{{LATEST}}', latest)

        version = version.replace('{{PUB_CUSTOM}}', custom_for_pub)

    git_hash = None
    if use_git_hash:
        git_hash = utils.GetShortGitHash()
    if git_hash is None or len(git_hash) != 10:
        git_hash = '0000000000'
    version = version.replace('{{GIT_HASH}}', git_hash)

    channel = utils.GetChannel()
    version = version.replace('{{CHANNEL}}', channel)

    version_time = None
    if use_git_hash:
        version_time = utils.GetGitTimestamp()
    if version_time == None:
        version_time = 'Unknown timestamp'
    version = version.replace('{{COMMIT_TIME}}', version_time.decode('utf-8'))

    abi_version = utils.GetAbiVersion(version_file)
    version = version.replace('{{ABI_VERSION}}', abi_version)

    oldest_supported_abi_version = utils.GetOldestSupportedAbiVersion(
        version_file)
    version = version.replace('{{OLDEST_SUPPORTED_ABI_VERSION}}',
                              oldest_supported_abi_version)

    snapshot_hash = MakeSnapshotHashString()
    version = version.replace('{{SNAPSHOT_HASH}}', snapshot_hash)

    return version
コード例 #3
0
def buildAllTests():
    abi_version = int(utils.GetAbiVersion())
    oldest_abi_version = int(utils.GetOldestSupportedAbiVersion())
    tests = [buildTest(None)]
    for version in xrange(oldest_abi_version, abi_version + 1):
        tests.append(buildTest(version))
    return tests
コード例 #4
0
def main():
    abi_version = int(utils.GetAbiVersion())
    oldest_abi_version = int(utils.GetOldestSupportedAbiVersion())
    for i in xrange(oldest_abi_version, abi_version):
        cmd = ['cipd', 'install', 'dart/abiversions/%d' % i, 'latest']
        result = subprocess.call(cmd)
        if result != 0:
            return 1
    return 0
コード例 #5
0
def main():
  abi_version = int(utils.GetAbiVersion())
  oldest_abi_version = int(utils.GetOldestSupportedAbiVersion())
  cmd = ['cipd', 'ensure', '-root', 'tools/abiversions', '-ensure-file', '-']
  ensure_file = ''
  for i in xrange(oldest_abi_version, abi_version):
    ensure_file += '@Subdir %d\ndart/abiversions/%d latest\n\n' % (i, i)
  if not ensure_file:
    return 0
  p = subprocess.Popen(cmd,
                       stdin = subprocess.PIPE,
                       shell = utils.IsWindows(),
                       cwd = utils.DART_DIR)
  p.communicate(ensure_file)
  p.stdin.close()
  return p.wait()