[M108 Migration][HBBTV] Implement ewk_context_register_jsplugin_mime_types API
[platform/framework/web/chromium-efl.git] / chrome / version.gni
1 # Copyright 2015 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # This exposes the Chrome version as GN variables for use in build files.
6 # This also generates the various version codes used for builds of chrome for
7 # android.
8 #
9 # PREFER NOT TO USE THESE. The GYP build uses this kind of thing extensively.
10 # However, it is far better to write an action (or use
11 # //build/util/process_version.gni) to generate a file at build-time with the
12 # information you need. This allows better dependency checking and GN will
13 # run faster.
14 #
15 # These values should only be used if you REALLY need to depend on them at
16 # build-time, for example, in the computation of output file names.
17
18 # Give version.py a pattern that will expand to a GN scope consisting of
19 # all values we need at once.
20 _version_dictionary_template = "full = \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\" " +
21                                "major = \"@MAJOR@\" minor = \"@MINOR@\" " +
22                                "build = \"@BUILD@\" patch = \"@PATCH@\" "
23
24 # The file containing the Chrome version number.
25 chrome_version_file = "//chrome/VERSION"
26
27 _script_arguments = []
28
29 if (is_mac) {
30   _version_dictionary_template += "patch_hi = @PATCH_HI@ patch_lo = @PATCH_LO@ "
31
32   _script_arguments += [
33     "-e",
34     "PATCH_HI=int(PATCH)//256",
35     "-e",
36     "PATCH_LO=int(PATCH)%256",
37   ]
38 } else if (target_os == "android") {
39   import("//build/config/android/config.gni")
40
41   _version_dictionary_template +=
42       "chrome_version_code = " + "\"@CHROME_VERSION_CODE@\" " +
43       "chrome_modern_version_code = \"@CHROME_MODERN_VERSION_CODE@\" " +
44       "monochrome_version_code = \"@MONOCHROME_VERSION_CODE@\" " +
45       "trichrome_version_code = \"@TRICHROME_VERSION_CODE@\" " +
46       "trichrome_beta_version_code = \"@TRICHROME_BETA_VERSION_CODE@\" " +
47       "webview_stable_version_code = \"@WEBVIEW_STABLE_VERSION_CODE@\" " +
48       "webview_beta_version_code = \"@WEBVIEW_BETA_VERSION_CODE@\" " +
49       "webview_dev_version_code = \"@WEBVIEW_DEV_VERSION_CODE@\" "
50
51   if (target_cpu == "arm64" || target_cpu == "x64") {
52     _version_dictionary_template +=
53         "monochrome_32_version_code = \"@MONOCHROME_32_VERSION_CODE@\" "
54     _version_dictionary_template +=
55         "monochrome_32_64_version_code = \"@MONOCHROME_32_64_VERSION_CODE@\" "
56     _version_dictionary_template +=
57         "monochrome_64_32_version_code = \"@MONOCHROME_64_32_VERSION_CODE@\" "
58     _version_dictionary_template +=
59         "monochrome_64_version_code = \"@MONOCHROME_64_VERSION_CODE@\" "
60     _version_dictionary_template +=
61         "trichrome_32_version_code = \"@TRICHROME_32_VERSION_CODE@\" "
62     _version_dictionary_template +=
63         "trichrome_32_64_version_code = \"@TRICHROME_32_64_VERSION_CODE@\" "
64     _version_dictionary_template +=
65         "trichrome_64_32_version_code = \"@TRICHROME_64_32_VERSION_CODE@\" "
66     _version_dictionary_template +=
67         "trichrome_64_version_code = \"@TRICHROME_64_VERSION_CODE@\" "
68     _version_dictionary_template +=
69         "trichrome_32_beta_version_code = \"@TRICHROME_32_BETA_VERSION_CODE@\" "
70     _version_dictionary_template += "trichrome_32_64_beta_version_code = \"@TRICHROME_32_64_BETA_VERSION_CODE@\" "
71     _version_dictionary_template += "trichrome_64_32_beta_version_code = \"@TRICHROME_64_32_BETA_VERSION_CODE@\" "
72     _version_dictionary_template +=
73         "trichrome_64_beta_version_code = \"@TRICHROME_64_BETA_VERSION_CODE@\" "
74     _version_dictionary_template +=
75         "webview_32_stable_version_code = \"@WEBVIEW_32_STABLE_VERSION_CODE@\" "
76     _version_dictionary_template +=
77         "webview_32_beta_version_code = \"@WEBVIEW_32_BETA_VERSION_CODE@\" "
78     _version_dictionary_template +=
79         "webview_32_dev_version_code = \"@WEBVIEW_32_DEV_VERSION_CODE@\" "
80     _version_dictionary_template +=
81         "webview_64_stable_version_code = \"@WEBVIEW_64_STABLE_VERSION_CODE@\" "
82     _version_dictionary_template +=
83         "webview_64_beta_version_code = \"@WEBVIEW_64_BETA_VERSION_CODE@\" "
84     _version_dictionary_template +=
85         "webview_64_dev_version_code = \"@WEBVIEW_64_DEV_VERSION_CODE@\" "
86   }
87
88   _script_arguments += [
89     "-a",
90     target_cpu,
91   ]
92
93   if (defined(final_android_sdk) && !final_android_sdk) {
94     _script_arguments += [ "--next" ]
95   }
96 }
97
98 _script_arguments += [
99   "-f",
100   rebase_path(chrome_version_file, root_build_dir),
101   "-t",
102   _version_dictionary_template,
103   "--os",
104   target_os,
105 ]
106
107 _result = exec_script("//build/util/version.py",
108                       _script_arguments,
109                       "scope",
110                       [
111                         chrome_version_file,
112                         "//build/util/android_chrome_version.py",
113                       ])
114
115 # Full version. For example "45.0.12321.0"
116 chrome_version_full = _result.full
117
118 # The constituent parts of the full version.
119 chrome_version_major = _result.major
120 chrome_version_minor = _result.minor
121 chrome_version_build = _result.build
122 chrome_version_patch = _result.patch
123
124 if (is_mac) {
125   chrome_version_patch_hi = _result.patch_hi
126   chrome_version_patch_lo = _result.patch_lo
127
128   chrome_dylib_version = "$chrome_version_build.$chrome_version_patch_hi" +
129                          ".$chrome_version_patch_lo"
130 } else if (target_os == "android") {
131   forward_variables_from(_result,
132                          [
133                            "chrome_modern_version_code",
134                            "chrome_version_code",
135                            "monochrome_version_code",
136                            "monochrome_32_version_code",
137                            "monochrome_32_64_version_code",
138                            "monochrome_64_32_version_code",
139                            "monochrome_64_version_code",
140                            "trichrome_version_code",
141                            "trichrome_32_version_code",
142                            "trichrome_32_64_version_code",
143                            "trichrome_64_32_version_code",
144                            "trichrome_64_version_code",
145                            "trichrome_beta_version_code",
146                            "trichrome_32_beta_version_code",
147                            "trichrome_32_64_beta_version_code",
148                            "trichrome_64_32_beta_version_code",
149                            "trichrome_64_beta_version_code",
150                            "webview_beta_version_code",
151                            "webview_dev_version_code",
152                            "webview_stable_version_code",
153                            "webview_32_beta_version_code",
154                            "webview_32_dev_version_code",
155                            "webview_32_stable_version_code",
156                            "webview_64_beta_version_code",
157                            "webview_64_dev_version_code",
158                            "webview_64_stable_version_code",
159                          ])
160
161   chrome_version_name = chrome_version_full
162
163   lines_to_write = [
164     "VersionName: $chrome_version_name",
165     "Chrome: $chrome_version_code",
166     "ChromeModern: $chrome_modern_version_code",
167     "Monochrome: $monochrome_version_code",
168     "TrichromeChrome: $trichrome_version_code",
169     "TrichromeChromeOpenBeta: $trichrome_beta_version_code",
170     "AndroidWebviewStable: $webview_stable_version_code",
171     "AndroidWebviewBeta: $webview_beta_version_code",
172     "AndroidWebviewDev: $webview_dev_version_code",
173   ]
174
175   if (target_cpu == "arm64" || target_cpu == "x64") {
176     lines_to_write += [
177       "Monochrome32: $monochrome_32_version_code",
178       "Monochrome3264: $monochrome_32_64_version_code",
179       "Monochrome6432: $monochrome_64_32_version_code",
180       "Monochrome64: $monochrome_64_version_code",
181       "TrichromeChrome32: $trichrome_32_version_code",
182       "TrichromeChrome3264: $trichrome_32_64_version_code",
183       "TrichromeChrome6432: $trichrome_64_32_version_code",
184       "TrichromeChrome64: $trichrome_64_version_code",
185       "TrichromeChrome32OpenBeta: $trichrome_32_beta_version_code",
186       "TrichromeChrome3264OpenBeta: $trichrome_32_64_beta_version_code",
187       "TrichromeChrome6432OpenBeta: $trichrome_64_32_beta_version_code",
188       "TrichromeChrome64OpenBeta: $trichrome_64_beta_version_code",
189       "AndroidWebview32Stable: $webview_32_stable_version_code",
190       "AndroidWebview32Beta: $webview_32_beta_version_code",
191       "AndroidWebview32Dev: $webview_32_dev_version_code",
192       "AndroidWebview64Stable: $webview_64_stable_version_code",
193       "AndroidWebview64Beta: $webview_64_beta_version_code",
194       "AndroidWebview64Dev: $webview_64_dev_version_code",
195     ]
196   }
197
198   write_file("$root_out_dir/android_chrome_versions.txt", lines_to_write)
199 }