diff options
Diffstat (limited to 'third_party/libwebrtc/build/util/version.gni')
-rw-r--r-- | third_party/libwebrtc/build/util/version.gni | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/third_party/libwebrtc/build/util/version.gni b/third_party/libwebrtc/build/util/version.gni new file mode 100644 index 0000000000..998ce077d2 --- /dev/null +++ b/third_party/libwebrtc/build/util/version.gni @@ -0,0 +1,155 @@ +# Copyright 2015 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. + +# This exposes the Chrome version as GN variables for use in build files. +# This also generates the various version codes used for builds of chrome for +# android. +# +# PREFER NOT TO USE THESE. The GYP build uses this kind of thing extensively. +# However, it is far better to write an action (or use the process_version +# wrapper in build/util/version.gni) to generate a file at build-time with the +# information you need. This allows better dependency checking and GN will +# run faster. +# +# These values should only be used if you REALLY need to depend on them at +# build-time, for example, in the computation of output file names. + +# Give version.py a pattern that will expand to a GN scope consisting of +# all values we need at once. +_version_dictionary_template = "full = \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\" " + + "major = \"@MAJOR@\" minor = \"@MINOR@\" " + + "build = \"@BUILD@\" patch = \"@PATCH@\" " + +# The file containing the Chrome version number. +chrome_version_file = "//chrome/VERSION" + +_script_arguments = [] + +if (is_mac) { + _version_dictionary_template += "patch_hi = @PATCH_HI@ patch_lo = @PATCH_LO@ " + + _script_arguments += [ + "-e", + "PATCH_HI=int(PATCH)//256", + "-e", + "PATCH_LO=int(PATCH)%256", + ] +} else if (target_os == "android") { + import("//build/config/android/config.gni") + + _version_dictionary_template += + "chrome_version_code = " + "\"@CHROME_VERSION_CODE@\" " + + "chrome_modern_version_code = \"@CHROME_MODERN_VERSION_CODE@\" " + + "monochrome_version_code = \"@MONOCHROME_VERSION_CODE@\" " + + "trichrome_version_code = \"@TRICHROME_VERSION_CODE@\" " + + "webview_stable_version_code = \"@WEBVIEW_STABLE_VERSION_CODE@\" " + + "webview_beta_version_code = \"@WEBVIEW_BETA_VERSION_CODE@\" " + + "webview_dev_version_code = \"@WEBVIEW_DEV_VERSION_CODE@\" " + + if (target_cpu == "arm64" || target_cpu == "x64") { + _version_dictionary_template += "monochrome_32_version_code = \"@MONOCHROME_32_VERSION_CODE@\" " + "monochrome_32_64_version_code = \"@MONOCHROME_32_64_VERSION_CODE@\" " + "monochrome_64_32_version_code = \"@MONOCHROME_64_32_VERSION_CODE@\" " + "monochrome_64_version_code = \"@MONOCHROME_64_VERSION_CODE@\" " + "trichrome_32_version_code = \"@TRICHROME_32_VERSION_CODE@\" " + "trichrome_32_64_version_code = \"@TRICHROME_32_64_VERSION_CODE@\" " + "trichrome_64_32_version_code = \"@TRICHROME_64_32_VERSION_CODE@\" " + "trichrome_64_version_code = \"@TRICHROME_64_VERSION_CODE@\" " + "webview_32_stable_version_code = \"@WEBVIEW_32_STABLE_VERSION_CODE@\" " + "webview_32_beta_version_code = \"@WEBVIEW_32_BETA_VERSION_CODE@\" " + "webview_32_dev_version_code = \"@WEBVIEW_32_DEV_VERSION_CODE@\" " + "webview_64_stable_version_code = \"@WEBVIEW_64_STABLE_VERSION_CODE@\" " + "webview_64_beta_version_code = \"@WEBVIEW_64_BETA_VERSION_CODE@\" " + "webview_64_dev_version_code = \"@WEBVIEW_64_DEV_VERSION_CODE@\" " + } + + _script_arguments += [ + "-a", + target_cpu, + ] + + if (defined(final_android_sdk) && !final_android_sdk) { + _script_arguments += [ "--next" ] + } +} + +_script_arguments += [ + "-f", + rebase_path(chrome_version_file, root_build_dir), + "-t", + _version_dictionary_template, + "--os", + target_os, +] + +_result = exec_script("version.py", + _script_arguments, + "scope", + [ + chrome_version_file, + "android_chrome_version.py", + ]) + +# Full version. For example "45.0.12321.0" +chrome_version_full = _result.full + +# The consituent parts of the full version. +chrome_version_major = _result.major +chrome_version_minor = _result.minor +chrome_version_build = _result.build +chrome_version_patch = _result.patch + +if (is_mac) { + chrome_version_patch_hi = _result.patch_hi + chrome_version_patch_lo = _result.patch_lo + + chrome_dylib_version = "$chrome_version_build.$chrome_version_patch_hi" + + ".$chrome_version_patch_lo" +} else if (target_os == "android") { + forward_variables_from(_result, + [ + "chrome_modern_version_code", + "chrome_version_code", + "monochrome_version_code", + "monochrome_32_version_code", + "monochrome_32_64_version_code", + "monochrome_64_32_version_code", + "monochrome_64_version_code", + "trichrome_version_code", + "trichrome_32_version_code", + "trichrome_32_64_version_code", + "trichrome_64_32_version_code", + "trichrome_64_version_code", + "webview_beta_version_code", + "webview_dev_version_code", + "webview_stable_version_code", + "webview_32_beta_version_code", + "webview_32_dev_version_code", + "webview_32_stable_version_code", + "webview_64_beta_version_code", + "webview_64_dev_version_code", + "webview_64_stable_version_code", + ]) + + chrome_version_name = chrome_version_full + + lines_to_write = [ + "VersionName: $chrome_version_name", + "Chrome: $chrome_version_code", + "ChromeModern: $chrome_modern_version_code", + "Monochrome: $monochrome_version_code", + "TrichromeChrome: $trichrome_version_code", + "AndroidWebviewStable: $webview_stable_version_code", + "AndroidWebviewBeta: $webview_beta_version_code", + "AndroidWebviewDev: $webview_dev_version_code", + ] + + if (target_cpu == "arm64" || target_cpu == "x64") { + lines_to_write += [ + "Monochrome32: $monochrome_32_version_code", + "Monochrome3264: $monochrome_32_64_version_code", + "Monochrome6432: $monochrome_64_32_version_code", + "Monochrome64: $monochrome_64_version_code", + "TrichromeChrome32: $trichrome_32_version_code", + "TrichromeChrome3264: $trichrome_32_64_version_code", + "TrichromeChrome6432: $trichrome_64_32_version_code", + "TrichromeChrome64: $trichrome_64_version_code", + "AndroidWebview32Stable: $webview_32_stable_version_code", + "AndroidWebview32Beta: $webview_32_beta_version_code", + "AndroidWebview32Dev: $webview_32_dev_version_code", + "AndroidWebview64Stable: $webview_64_stable_version_code", + "AndroidWebview64Beta: $webview_64_beta_version_code", + "AndroidWebview64Dev: $webview_64_dev_version_code", + ] + } + + write_file("$root_out_dir/android_chrome_versions.txt", lines_to_write) +} |