1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# TODO(brettw) Forking out to Python 4 times in serial just to get version
6# numbers is highly undesirable. Instead, there should be a build step to
7# generate an appropriate header so that the version can be generated at
8# build-time, and not at GN-time.
9
10# The |major|, |build| and |patch| versions are inherited from Chrome.
11# Since Chrome's |minor| version is always '0', we replace it with a
12# Chromoting-specific patch version.
13# Note that we check both the |chrome_version_path| file and the
14# |remoting_version_path| so that we can override the Chrome version
15# numbers if needed.
16_version_py_abspath = "//build/util/version.py"
17_remoting_version_abspath = "//remoting/VERSION"
18_chrome_version_abspath = "//chrome/VERSION"
19
20# Set these files as being input dependencies to the scripts, so the build will
21# be re-run if the files change.
22_script_deps = [ _remoting_version_abspath, _chrome_version_abspath ]
23
24_chrome_version_path = rebase_path(_chrome_version_abspath, root_build_dir)
25_remoting_version_path = rebase_path(_remoting_version_abspath, root_build_dir)
26
27version_major = exec_script(
28    _version_py_abspath,
29    [ "-f", _chrome_version_path,
30      "-f", _remoting_version_path,
31      "-t \"@MAJOR@\"" ],
32    "value",
33    _script_deps)
34
35version_minor = exec_script(
36    _version_py_abspath,
37    [ "-f", _remoting_version_path,
38      "-t \"@REMOTING_PATCH@\"" ],
39    "value",
40    _script_deps)
41
42version_short = "${version_major}.${version_minor}." + exec_script(
43    _version_py_abspath,
44    [ "-f", _chrome_version_path,
45      "-f", _remoting_version_path,
46      "-t \"@BUILD@\"" ],
47    "value",
48    _script_deps)
49
50version_full = "${version_short}." + exec_script(
51    _version_py_abspath,
52    [ "-f", _chrome_version_path,
53      "-f", _remoting_version_path,
54      "-t \"@PATCH@\"" ],
55    "value",
56    _script_deps)
57